🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #313

diff 1.7 improved usage patch

#313
From: David MacKenzie
Date: Sun, 23 Jul 1989 05:43
62 lines
1791 bytes
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;
Technical Details
Message-ID: <8907230443.AA02220@rocky2>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ROCKY2.ROCKEFELLER.EDU!edf

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ROCKY2.ROCKEFELLER.EDU!edf
From: edf@ROCKY2.ROCKEFELLER.EDU (David MacKenzie)
Newsgroups: gnu.utils.bug
Subject: diff 1.7 improved usage patch
Message-ID: <8907230443.AA02220@rocky2>
Date: 23 Jul 89 05:43:05 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 62