- Timestamp:
- Jan 6, 2007, 1:10:46 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/src/zzuf.c
r1573 r1574 1 1 /* 2 2 * zzuf - general purpose fuzzer 3 * Copyright (c) 200 6Sam Hocevar <sam@zoy.org>3 * Copyright (c) 2002, 2007 Sam Hocevar <sam@zoy.org> 4 4 * All Rights Reserved 5 5 * … … 108 108 { "exclude", 1, NULL, 'E' }, 109 109 { "max-forks", 1, NULL, 'F' }, 110 { "help", 0, NULL, 'h' },111 110 { "stdin", 0, NULL, 'i' }, 112 111 { "include", 1, NULL, 'I' }, … … 119 118 { "signal", 0, NULL, 'S' }, 120 119 { "max-time", 1, NULL, 'T' }, 120 { "help", 0, NULL, 'h' }, 121 121 { "version", 0, NULL, 'v' }, 122 122 }; 123 int c = getopt_long(argc, argv, "B:cC:dE:F: hiI:nP:qr:R:s:ST:v",123 int c = getopt_long(argc, argv, "B:cC:dE:F:iI:nP:qr:R:s:ST:hv", 124 124 long_options, &option_index); 125 125 # else 126 126 # define MOREINFO "Try `%s -h' for more information.\n" 127 int c = getopt(argc, argv, "B:cC:dE:F: hiI:nP:qr:R:s:ST:v");127 int c = getopt(argc, argv, "B:cC:dE:F:iI:nP:qr:R:s:ST:hv"); 128 128 # endif 129 129 if(c == -1) … … 132 132 switch(c) 133 133 { 134 case 'B': /* --max-bytes */ 135 maxbytes = atoi(optarg); 136 break; 137 case 'c': /* --cmdline */ 138 cmdline = 1; 139 break; 140 case 'C': /* --max-crashes */ 141 maxcrashes = atoi(optarg); 142 if(maxcrashes <= 0) 143 maxcrashes = 0; 144 break; 145 case 'd': /* --debug */ 146 setenv("ZZUF_DEBUG", "1", 1); 147 break; 148 case 'E': /* --exclude */ 149 exclude = merge_regex(exclude, optarg); 150 if(!exclude) 151 { 152 printf("%s: invalid regex -- `%s'\n", argv[0], optarg); 153 return EXIT_FAILURE; 154 } 155 break; 156 case 'F': /* --max-forks */ 157 maxforks = atoi(optarg) > 1 ? atoi(optarg) : 1; 158 break; 159 case 'i': /* --stdin */ 160 setenv("ZZUF_STDIN", "1", 1); 161 break; 134 162 case 'I': /* --include */ 135 163 include = merge_regex(include, optarg); … … 140 168 } 141 169 break; 142 case 'E': /* --exclude */143 exclude = merge_regex(exclude, optarg);144 if(!exclude)145 {146 printf("%s: invalid regex -- `%s'\n", argv[0], optarg);147 return EXIT_FAILURE;148 }149 break;150 case 'c': /* --cmdline */151 cmdline = 1;152 break;153 case 'i': /* --stdin */154 setenv("ZZUF_STDIN", "1", 1);155 break;156 170 case 'n': /* --network */ 157 171 setenv("ZZUF_NETWORK", "1", 1); 172 break; 173 case 'P': /* --protect */ 174 setenv("ZZUF_PROTECT", optarg, 1); 175 break; 176 case 'q': /* --quiet */ 177 quiet = 1; 178 break; 179 case 'r': /* --ratio */ 180 setenv("ZZUF_RATIO", optarg, 1); 181 break; 182 case 'R': /* --refuse */ 183 setenv("ZZUF_REFUSE", optarg, 1); 158 184 break; 159 185 case 's': /* --seed */ … … 162 188 endseed = parser ? atoi(parser + 1) : seed + 1; 163 189 break; 164 case 'r': /* --ratio */ 165 setenv("ZZUF_RATIO", optarg, 1); 166 break; 167 case 'F': /* --max-forks */ 168 maxforks = atoi(optarg) > 1 ? atoi(optarg) : 1; 169 break; 170 case 'B': /* --max-bytes */ 171 maxbytes = atoi(optarg); 190 case 'S': /* --signal */ 191 setenv("ZZUF_SIGNAL", "1", 1); 172 192 break; 173 193 case 'T': /* --max-time */ 174 194 maxtime = atof(optarg); 175 break;176 case 'C': /* --max-crashes */177 maxcrashes = atoi(optarg);178 if(maxcrashes <= 0)179 maxcrashes = 0;180 break;181 case 'P': /* --protect */182 setenv("ZZUF_PROTECT", optarg, 1);183 break;184 case 'R': /* --refuse */185 setenv("ZZUF_REFUSE", optarg, 1);186 break;187 case 'q': /* --quiet */188 quiet = 1;189 break;190 case 'S': /* --signal */191 setenv("ZZUF_SIGNAL", "1", 1);192 break;193 case 'd': /* --debug */194 setenv("ZZUF_DEBUG", "1", 1);195 195 break; 196 196 case 'h': /* --help */ … … 554 554 { 555 555 printf("zzuf %s\n", VERSION); 556 printf("Copyright (C) 200 6Sam Hocevar <sam@zoy.org>\n");556 printf("Copyright (C) 2002, 2007 Sam Hocevar <sam@zoy.org>\n"); 557 557 printf("This is free software. You may redistribute copies of it under the\n"); 558 558 printf("terms of the Do What The Fuck You Want To Public License, Version 2\n");
Note: See TracChangeset
for help on using the changeset viewer.