From 85f6af7cb2fa84ab484d432ffa779ddbb9892d0b Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 1 Jan 2007 19:49:57 +0000 Subject: [PATCH] * Alphabetise flags in help output and manpage. --- doc/zzuf.1 | 128 ++++++++++++++++++++++++++--------------------------- src/zzuf.c | 40 ++++++++--------- 2 files changed, 84 insertions(+), 84 deletions(-) diff --git a/doc/zzuf.1 b/doc/zzuf.1 index a17ff85..cc5e573 100644 --- a/doc/zzuf.1 +++ b/doc/zzuf.1 @@ -61,6 +61,70 @@ will try to interpret them as arguments for itself. .RI .SH OPTIONS .TP +.B \-B, \-\-max\-bytes +Automatically terminate child processes that output more than +.B +bytes on the standard output and standard error channels. This is useful to +detect infinite loops. +.TP +.B \-c, \-\-cmdline +Only fuzz files whose name is specified in the target application's command +line. This is mostly a shortcut to avoid specifiying twice the argument: +.B zzuf \-c cat file.txt +has the same effect as +.B zzuf \-I "^file\\.txt$" cat +.BR file.txt . +See the +.B \-I +flag for more information. +.TP +.B \-d, \-\-debug +Activate the display of debug messages. +.TP +.B \-E, \-\-exclude +Do not fuzz files whose name matches the +.B +regular expression. This option supersedes anything that is specified by the +.B \-\-exclude +flag. Use this for instance if you do not know for sure what files your +application is going to read, but do not want it to fuzz files in the +.B /etc +directory. + +Multiple +.B \-E +flags can be specified, in which case files matching any one of the regular +expressions will be ignored. +.TP +.B \-F, \-\-fork +Specify the number of simultaneous children that can be run. This option is +only useful if the +.B \-s +flag is used with an interval argument. +.TP +.B \-h, \-\-help +Display a short help message and exit. +.TP +.B \-i, \-\-stdin +Fuzz the application's standard input. By default +.B zzuf +only fuzzes files. +.TP +.B \-I, \-\-include +Only fuzz files whose name matches the +.B +regular expression. Use this for instance if your application reads +configuration files at startup and you only want specific files to be fuzzed. + +Multiple +.B \-I +flags can be specified, in which case files matching any one of the regular +expressions will be fuzzed. +.TP +.B \-q, \-\-quiet +Hide the output of the fuzzed application. This is useful if the application +is very verbose but only its exit code is really useful to you. +.TP .B \-r, \-\-ratio Specify the amount of bits that will be randomly fuzzed. A value of 0 will not fuzz anything. A value of 0.05 will fuzz 5% of the open files' @@ -89,76 +153,12 @@ If an interval is specified, will run the application several times, each time with a different seed, and report the behaviour of each run. .TP -.B \-F, \-\-fork -Specify the number of simultaneous children that can be run. This option is -only useful if the -.B \-s -flag is used with an interval argument. -.TP -.B \-B, \-\-max\-bytes -Automatically terminate child processes that output more than -.B -bytes on the standard output and standard error channels. This is useful to -detect infinite loops. -.TP .B \-T, \-\-max\-time Automatically terminate child processes that run for more than .B seconds. This is useful to detect infinite loops or processes stuck in other situations. .TP -.B \-q, \-\-quiet -Hide the output of the fuzzed application. This is useful if the application -is very verbose but only its exit code is really useful to you. -.TP -.B \-i, \-\-stdin -Fuzz the application's standard input. By default -.B zzuf -only fuzzes files. -.TP -.B \-I, \-\-include -Only fuzz files whose name matches the -.B -regular expression. Use this for instance if your application reads -configuration files at startup and you only want specific files to be fuzzed. - -Multiple -.B \-I -flags can be specified, in which case files matching any one of the regular -expressions will be fuzzed. -.TP -.B \-c, \-\-cmdline -Only fuzz files whose name is specified in the target application's command -line. This is mostly a shortcut to avoid specifiying twice the argument: -.B zzuf \-c cat file.txt -has the same effect as -.B zzuf \-I "^file\\.txt$" cat -.BR file.txt . -See the -.B \-I -flag for more information. -.TP -.B \-E, \-\-exclude -Do not fuzz files whose name matches the -.B -regular expression. This option supersedes anything that is specified by the -.B \-\-exclude -flag. Use this for instance if you do not know for sure what files your -application is going to read, but do not want it to fuzz files in the -.B /etc -directory. - -Multiple -.B \-E -flags can be specified, in which case files matching any one of the regular -expressions will be ignored. -.TP -.B \-d, \-\-debug -Activate the display of debug messages. -.TP -.B \-h, \-\-help -Display a short help message and exit. -.TP .B \-v, \-\-version Output version information and exit. .RI diff --git a/src/zzuf.c b/src/zzuf.c index 566aed0..9e1802d 100644 --- a/src/zzuf.c +++ b/src/zzuf.c @@ -110,11 +110,11 @@ int main(int argc, char *argv[]) { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'v' }, }; - int c = getopt_long(argc, argv, "I:E:cis:r:F:B:T:qdhv", + int c = getopt_long(argc, argv, "B:cdE:F:hiI:qr:s:T:v", long_options, &option_index); # else # define MOREINFO "Try `%s -h' for more information.\n" - int c = getopt(argc, argv, "I:E:cis:r:F:B:T:qdhv"); + int c = getopt(argc, argv, "B:cdE:F:hiI:qr:s:T:v"); # endif if(c == -1) break; @@ -516,34 +516,34 @@ static void usage(void) printf("\n"); printf("Mandatory arguments to long options are mandatory for short options too.\n"); # ifdef HAVE_GETOPT_LONG + printf(" -B, --max-bytes kill children that output more than bytes\n"); + printf(" -c, --cmdline only fuzz files specified in the command line\n"); + printf(" -d, --debug print debug messages\n"); + printf(" -E, --exclude do not fuzz files matching \n"); + printf(" -F, --fork number of concurrent children (default 1)\n"); + printf(" -h, --help display this help and exit\n"); + printf(" -i, --stdin fuzz standard input\n"); + printf(" -I, --include only fuzz files matching \n"); + printf(" -q, --quiet do not print children's messages\n"); printf(" -r, --ratio bit fuzzing ratio (default 0.004)\n"); printf(" -s, --seed random seed (default 0)\n"); printf(" --seed specify a seed range\n"); - printf(" -F, --fork number of concurrent children (default 1)\n"); - printf(" -B, --max-bytes kill children that output more than bytes\n"); printf(" -T, --max-time kill children that run for more than seconds\n"); - printf(" -q, --quiet do not print children's messages\n"); - printf(" -i, --stdin fuzz standard input\n"); - printf(" -I, --include only fuzz files matching \n"); - printf(" -c, --cmdline only fuzz files specified in the command line\n"); - printf(" -E, --exclude do not fuzz files matching \n"); - printf(" -d, --debug print debug messages\n"); - printf(" -h, --help display this help and exit\n"); printf(" -v, --version output version information and exit\n"); # else + printf(" -B kill children that output more than bytes\n"); + printf(" -c only fuzz files specified in the command line\n"); + printf(" -d print debug messages\n"); + printf(" -E do not fuzz files matching \n"); + printf(" -F number of concurrent forks (default 1)\n"); + printf(" -h display this help and exit\n"); + printf(" -i fuzz standard input\n"); + printf(" -I only fuzz files matching \n"); + printf(" -q do not print the fuzzed application's messages\n"); printf(" -r bit fuzzing ratio (default 0.004)\n"); printf(" -s random seed (default 0)\n"); printf(" specify a seed range\n"); - printf(" -F number of concurrent forks (default 1)\n"); - printf(" -B kill children that output more than bytes\n"); printf(" -T kill children that run for more than seconds\n"); - printf(" -q do not print the fuzzed application's messages\n"); - printf(" -i fuzz standard input\n"); - printf(" -I only fuzz files matching \n"); - printf(" -c only fuzz files specified in the command line\n"); - printf(" -E do not fuzz files matching \n"); - printf(" -d print debug messages\n"); - printf(" -h display this help and exit\n"); printf(" -v output version information and exit\n"); # endif printf("\n");