The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Larry McVoy <lm@mcvoy.com>
To: Noel Hunt <noel.hunt@gmail.com>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] Any Good dmr Anecdotes?
Date: Tue, 10 Jul 2018 18:31:27 -0700	[thread overview]
Message-ID: <20180711013127.GC2012@mcvoy.com> (raw)
In-Reply-To: <CAGfO01yOqVkKGa+XdypeGYDhehkCLM0eycvH59nN+hFNuhCAQQ@mail.gmail.com>

On Wed, Jul 11, 2018 at 10:20:50AM +1000, Noel Hunt wrote:
> I'm surprised why anyone would bother with these routines
> anymore, given the startling simplicity of Plan9's arg(3).
> One stands in awe of such simplicity. I believe it was
> William Cheswick who designed it, but I may be wrong.

It's nice but I like long opts.  The getopt in BK (and now in L)
looks like this and produces its own help (which does miss the 
short opts, my bad, I could fix that).  Look at the default in
the switch:

int
main(int ac, string av[])
{
	string	c;
	string	lopts[] = {
		"bigy:",
		"date-split",
		"exif",
		"exif-hover",
		"force",
		"index:",
		"names",
		"nav",
		"parallel:",
		"quiet",
		"regen",
		"reverse",
		"sharpen",
		"slide:",
		"thumbnails",
		"title:",
		"ysize:",
	};

	while (c = getopt(av, "fj:", lopts)) {
		switch (c) {
		    case "bigy": bigy = (int)optarg; break;
		    case "date-split": dates = 1; break;
		    case "exif": exif = 1; break;
		    case "exif-hover": exif_hover = 1; break;
		    case "f":
		    case "force":
		    case "regen":
			force = 1; break;
		    case "index": indexf = optarg; break;
		    case "j":
		    case "parallel": parallel = (int)optarg; break;
		    case "quiet": quiet = 1; break;
		    case "names": names = 1; break;
		    case "nav": nav = 1; break;
		    case "reverse": reverse = 1; break;
		    case "sharpen": sharpen = 1; break;
		    case "slide": slidef = optarg; break;
		    case "title": title = optarg; break;
		    case "thumbnails": thumbnails = 1; break;
		    case "ysize": ysize = (int)optarg; break;
		    default: 
			printf("Usage: photos.l");
			foreach(c in lopts) {
				if (c =~ /(.*):/) {
					printf(" --%s=<val>", $1);
				} else {
					printf(" --%s", c);
				}
			}
			printf("\n");
			return(0);
		}
	}

  reply	other threads:[~2018-07-11  1:32 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  7:53 Warren Toomey
2018-06-29 10:53 ` ches@Cheswick.com
2018-06-29 12:51   ` John P. Linderman
2018-06-30  0:50   ` Steve Johnson
2018-06-30 11:44     ` Arrigo Triulzi
2018-06-30 22:42       ` Arthur Krewat
2018-06-30 23:29         ` Arrigo Triulzi
2018-07-01  4:17           ` Larry McVoy
2018-07-01 11:42           ` ron
2018-07-01  5:29       ` Dave Horsfall
2018-07-01  8:28         ` Arrigo Triulzi
2018-07-01 11:34         ` ron
2018-07-09 16:30           ` Random832
2018-07-09 17:13             ` Clem Cole
2018-07-10  5:54               ` arnold
2018-07-10  6:09                 ` George Michaelson
2018-07-10  7:19                   ` arnold
2018-07-11  0:20                     ` Noel Hunt
2018-07-11  1:31                       ` Larry McVoy [this message]
2018-07-11  1:37                         ` George Michaelson
2018-07-11  1:37                         ` ron minnich
2018-07-11  3:12                           ` Larry McVoy
2018-07-11  3:34                         ` [TUHS] getopt (was " Bakul Shah
2018-07-13  9:08                       ` [TUHS] " ches@Cheswick.com
2018-07-13 14:10                         ` ron
2018-07-10 14:10                 ` Clem Cole
2018-07-03 17:34       ` Perry E. Metzger
2018-06-29 23:55 ` Dave Horsfall
2018-06-30  0:06   ` Greg 'groggy' Lehey
2018-06-30 14:20   ` John P. Linderman
2018-06-30  1:31 Larry McVoy
2018-06-30  1:45 ` Jon Forrest
2018-06-30 18:43   ` Steve Johnson
2018-07-01 16:35 Norman Wilson
2018-07-02 19:55 Paul Ruizendaal
2018-07-03  7:27 arnold
2018-07-18  9:42 Hendrik Jan Thomassen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180711013127.GC2012@mcvoy.com \
    --to=lm@mcvoy.com \
    --cc=noel.hunt@gmail.com \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).