Permalink
Browse files

fix -p, so we don't need to supply a pattern

  • Loading branch information...
1 parent 2758a58 commit 831de01b13b309933d32efe8388444ef6a831cfb @ericpaulbishop ericpaulbishop committed with Jun 28, 2012
Showing with 10 additions and 6 deletions.
  1. +1 −1 src/error.c
  2. +9 −5 src/shallot.c
View
@@ -13,7 +13,7 @@ void usage(void) {
" -d : Daemonize (requires -f)\n"
" -m : Monitor mode (incompatible with -f)\n"
" -o : Optimize RSA key size to improve SHA-1 hashing speed\n"
- " -p : Print 'pattern' help and exit (requires pattern)\n"
+ " -p : Print 'pattern' help and exit\n"
" -f <file> : Write output to <file>\n"
" -t count : Forces exactly count threads to be spawned\n"
" -x secs : Sets a limit on the maximum execution time. Has no effect without -m\n"
View
@@ -25,7 +25,6 @@
/* TODO:
* - finish all TODOs
- * - figure out a way to allow for -p w/o a pattern being supplied
* - allow -m to be used with -f (use file for status output) [v0.0.3]
*/
@@ -125,6 +124,15 @@ int main(int argc, char *argv[]) { // onions are fun, here we go
printf("WARNING: Threads will default to 1 unless specified with -t\n");
#endif
+ // pattern help
+ if( argc >= x)
+ {
+ if( strcmp(argv[x], "-p") == 0)
+ {
+ pattern();
+ }
+ }
+
for(; x < argc - 1; x++) { // options parsing
if(argv[x][0] != '-') {
fprintf(stderr, "Error: Options must start with '-'\n");
@@ -146,10 +154,6 @@ int main(int argc, char *argv[]) { // onions are fun, here we go
optimum = 1;
break;
}
- case 'p': { // pattern help
- pattern();
- break;
- }
case 'f': { // file <file>
if((argv[x][y + 1] != '\0') || (x + 1 > argc)) {
fprintf(stderr, "Error: -f format is '-f <file>'\n");

0 comments on commit 831de01

Please sign in to comment.