edf@ROCKY2.ROCKEFELLER.EDU (David MacKenzie) (07/23/89)
Here is a patch to GNU indent 1.7 that gives it a more helpful usage message, though still not in the league of GNU tar. It also now gives the usage message if you hand it an invalid option. *** diff.c.prev Sun Jul 23 00:22:07 1989 --- diff.c Sun Jul 23 00:24:08 1989 *************** *** 271,288 **** ignore_all_space_flag = 1; length_varies = 1; break; } prev = c; } if (optind != argc - 2) ! fatal ("requires two file names. Usage: diff [-options] file1 file2"); ! ! /* ! * @@ need more complicated usage string for directory options?? ! * Note three liner at top of BSD documentation, and John Gilmore ! * message in his public domain tar being used by GNU. ! */ if (ignore_regexp) { --- 271,285 ---- ignore_all_space_flag = 1; length_varies = 1; break; + + default: + usage (); } prev = c; } if (optind != argc - 2) ! usage (); if (ignore_regexp) { *************** *** 321,326 **** --- 318,332 ---- exit (val); } + + usage () + { + fprintf (stderr, + "Usage: diff [-#] [-abBcdefhHilnNprstTw]\n"); + fprintf (stderr, + " [-C lines] [-F regexp] [-I regexp] [-S file] path1 path2\n"); + exit (1); + } specify_style (style) enum output_style style;