/* -*-c-*-
*
- * $Id: anag.c,v 1.1 2001/02/04 17:14:42 mdw Exp $
+ * $Id: anag.c,v 1.3 2001/02/16 21:45:19 mdw Exp $
*
* Main driver for anag
*
/*----- Revision history --------------------------------------------------*
*
* $Log: anag.c,v $
+ * Revision 1.3 2001/02/16 21:45:19 mdw
+ * Be more helpful. Improve full help message. Special-case error for
+ * empty command strings.
+ *
+ * Revision 1.2 2001/02/07 09:09:11 mdw
+ * Fix spurious error when `-file' is used.
+ *
* Revision 1.1 2001/02/04 17:14:42 mdw
* Initial checkin
*
usage(fp);
fputs("\n\
Searches a wordlist, printing all of the words which match an expression.\n\
+\n\
+Options supported are:\n\
+\n\
+-h, --help display this help text\n\
+-v, --version display the program's version number\n\
+-u, --usage display a very brief usage message\n\
+-f, --file FILE read wordlist from FILE, not `" DICTIONARY "'\n\
+\n\
The basic tests in the expression are:\n\
\n\
-anagram WORD matches a full-length anagram\n\
default:
return (oo->tag);
}
+ continue;
bad:
die("syntax error near `%s': unknown token type", av[ai - 1]);
}
ac = argc;
ai = 1;
p_next(&p);
+ if (p.t == O_EOF) {
+ usage(stderr);
+ pquis(stderr, "(Run `$ --help' for more detail.)\n");
+ exit(EXIT_FAILURE);
+ }
p_expr(&p, &n);
if (p.t != O_EOF) {
die("syntax error near `%s': rubbish at end of line (too many `)'s?)",