[TUHS] Of flags and keyletters

Larry McVoy lm at mcvoy.com
Mon Mar 4 03:52:53 AEST 2024


I rewrote getopt() for BitKeeper because I wanted long options and 
wanted to allow optional args but also have required args.

On Sun, Mar 03, 2024 at 12:38:20PM -0500, Aaron wrote:
> Having written the first versions of getopt(3), getopt(1), and associated man pages around 1979, I do not recall any real orthodoxy in the use of ???options??? vs ???flags.??? In general, ???flags??? seemed to be reserved for single arguments in the form of ???-x???
> 
> I wrote getopt, and rewrote many commands to use it because I got annoyed at trying to remember which commands required ???-x -y -z??? vs ???-xyz???, and which flags required or allowed optional  arguments.
> 
> Aaron 
> 
> 
> 
> > On Mar 2, 2024, at 5:22???PM, jnc at mercury.lcs.mit.edu wrote:
> > 
> > ???
> >> 
> >> From: Bakul Shah
> > 
> >> Use of "flag" for this purpose seems strange. "option" makes more sense.
> > 
> > People on this list seem to forget that there were computers before UNIX.
> > 
> > The _syntax_ of "-f" probably predates any UNIX; Multics used it extensively.
> > See the "Introduction to Multics", MAC-TR-123, January 1974 (a little after
> > UNIX V1, but I expect I could probably track it back further in time, if I
> > cared to put in the effort); pg. 3-24.
> > 
> > Interestingly, I looked though the CTSS manual, and CTSS did not seem to use
> > this syntax for flag arguments: see, e.g., the SAVE command (section AH.3.03).
> > 
> > 
> > The _name_ "flag" came in early on UNIX. (Multics called them "arguments";
> > see above, pg. 3-27, top line.) We can see this happen - see:
> > 
> >  http://squoze.net/UNIX/v1man/man1/du
> > 
> > which calls the "-a" and "-s" "arguments"; but in:
> > 
> >  http://squoze.net/UNIX/v1man/man1/ld
> > 
> > "-s", "-u", etc are called "flag arguments".
> > 
> > Long enough ago that certainty about the etymology/rationale is probably now
> > lost.
> > 
> >    Noel

-- 
---
Larry McVoy           Retired to fishing          http://www.mcvoy.com/lm/boat


More information about the TUHS mailing list