chiark
/
gitweb
/
~mdw
/
anag
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
7b468ee
)
Be more helpful. Improve full help message. Special-case error for
author
mdw
<mdw>
Fri, 16 Feb 2001 21:45:19 +0000
(21:45 +0000)
committer
mdw
<mdw>
Fri, 16 Feb 2001 21:45:19 +0000
(21:45 +0000)
empty command strings.
anag.c
patch
|
blob
|
blame
|
history
diff --git
a/anag.c
b/anag.c
index f160fa1d7cbd313fbb430fac8072aeae0e087684..724873da8c4a722004bbaf8bac2619676fc55a3f 100644
(file)
--- a/
anag.c
+++ b/
anag.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: anag.c,v 1.
2 2001/02/07 09:09:11
mdw Exp $
+ * $Id: anag.c,v 1.
3 2001/02/16 21:45:19
mdw Exp $
*
* Main driver for anag
*
*
* Main driver for anag
*
@@
-29,6
+29,10
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: anag.c,v $
/*----- 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.2 2001/02/07 09:09:11 mdw
* Fix spurious error when `-file' is used.
*
@@
-64,6
+68,14
@@
static void help(FILE *fp)
usage(fp);
fputs("\n\
Searches a wordlist, printing all of the words which match an expression.\n\
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\
The basic tests in the expression are:\n\
\n\
-anagram WORD matches a full-length anagram\n\
@@
-387,6
+399,11
@@
static node *p_argv(int argc, const char *const argv[])
ac = argc;
ai = 1;
p_next(&p);
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?)",
p_expr(&p, &n);
if (p.t != O_EOF) {
die("syntax error near `%s': rubbish at end of line (too many `)'s?)",