mergerd renaudallard:master (#17)

This commit is contained in:
solusipse
2015-09-23 19:36:37 +02:00
6 changed files with 4016 additions and 6 deletions

View File

@@ -1,2 +1,2 @@
language: c
script: make
script: ./configure && make

View File

@@ -5,6 +5,7 @@
# -----------------------------------
CFLAGS+=-pthread -O2
CFLAGS+=@LIBS@
all: fiche

2
config.h.in Normal file
View File

@@ -0,0 +1,2 @@
#undef HAVE_ARC4RANDOM

3987
configure vendored Executable file

File diff suppressed because it is too large Load Diff

20
configure.in Normal file
View File

@@ -0,0 +1,20 @@
AC_INIT([fiche], [0.99])
AC_CONFIG_SRCDIR([fiche.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
# Function arc4random() is in BSD standard C or GNU systems -lbsd
AC_SEARCH_LIBS([arc4random], [bsd], [HAVE_ARC4RANDOM="yes"])
# Checks for library functions.
AC_CHECK_FUNCS([bzero arc4random])
AC_SUBST(HAVE_ARC4RANDOM)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

10
fiche.c
View File

@@ -30,6 +30,7 @@ $ cat fiche.c | nc localhost 9999
#include <sys/param.h>
#include <stdio.h>
#include "config.h"
#include "fiche.h"
int main(int argc, char **argv)
@@ -300,9 +301,8 @@ void generate_url(char *buffer, char *slug, size_t slug_length, struct client_da
for (i = 0; i <= SLUG_SIZE - 1; i++)
{
#if defined(BSD)
symbol_id = arc4random();
#if defined(HAVE_ARC4RANDOM)
int symbol_id = arc4random() % strlen(symbols);
#else
fread(&symbol_id, sizeof(symbol_id), 1, frandom);
#endif
@@ -311,8 +311,8 @@ void generate_url(char *buffer, char *slug, size_t slug_length, struct client_da
while (create_directory(slug) == -1)
{
#if defined(BSD)
symbol_id = arc4random();
#if defined(HAVE_ARC4RANDOM)
int symbol_id = arc4random() % strlen(symbols);
#else
fread(&symbol_id, sizeof(symbol_id), 1, frandom);
#endif