: nply/fiche2

commit 047ecf672c3c9809ff885b2e1491c1459c3ba3fb
parent 73bc067641372d4c0001601f6fef9bfa5b9db7ff
Author: Renaud Allard <renaud@allard.it>
Date: Sat, 29 Aug 2015 11:34:32 +0200

Add -e option to use the extended charset I committed before.
"reduced" charset makes it easier to remember the URL by default
2 files changed, 14 insertions(+), 7 deletions(-)
M
fiche.c
|
11
++++++++---
M
fiche.h
|
10
++++++----
diff --git a/fiche.c b/fiche.c
@@ -9,11 +9,13 @@ Live example: http://code.solusipse.net/
 
 -------------------------------------------------------------------------------
 
-usage: fiche [-pbsdolBuw].
-             [-d domain] [-p port] [-s slug size]
+usage: fiche [-epbsdolBuw].
+             [-e] [-d domain] [-p port] [-s slug size]
              [-o output directory] [-B buffer size] [-u user name]
              [-l log file] [-b banlist] [-w whitelist]
 
+-e option is for using an extended character set for the URL
+
 Compile with Makefile or manually with -O2 and -pthread flags.
 To install use `make install` command.
 

@@ -371,9 +373,12 @@ void parse_parameters(int argc, char **argv)
 {
     int c;
 
-    while ((c = getopt (argc, argv, "p:b:s:d:o:l:B:u:w:")) != -1)
+    while ((c = getopt (argc, argv, "ep:b:s:d:o:l:B:u:w:")) != -1)
         switch (c)
         {
+            case 'e':
+                snprintf(symbols, sizeof symbols, "%s", "abcdefghijklmnopqrstuvwxyz0123456789-+_=.ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+                break;
             case 'd':
                 snprintf(DOMAIN, sizeof DOMAIN, "%s%s%s", "http://", optarg, "/");
                 break;
diff --git a/fiche.h b/fiche.h
@@ -9,11 +9,13 @@ Live example: http://code.solusipse.net/
 
 -------------------------------------------------------------------------------
 
-usage: fiche [-pbsdolBuw].
-             [-d domain] [-p port] [-s slug size]
+usage: fiche [-epbsdolBuw].
+             [-e] [-d domain] [-p port] [-s slug size]
              [-o output directory] [-B buffer size] [-u user name]
              [-l log file] [-b banlist] [-w whitelist]
 
+-e option is for using an extended character set for the URL
+
 Compile with Makefile or manually with -O2 and -pthread flags.
 To install use `make install` command.
 

@@ -50,13 +52,13 @@ char *BANFILE;
 char *WHITEFILE;
 char *WHITELIST;
 int PORT = 9999;
-int SLUG_SIZE = 8;
+int SLUG_SIZE = 4;
 int BUFSIZE = 32768;
 int QUEUE_SIZE = 500;
 char DOMAIN[128] = "http://localhost/";
+char symbols[67] = "abcdefghijklmnopqrstuvwxyz0123456789";
 
 unsigned int time_seed;
-const char *symbols = "abcdefghijklmnopqrstuvwxyz0123456789-+_=.ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
 struct thread_arguments
 {