[TUHS] Any Good dmr Anecdotes?

Larry McVoy lm at mcvoy.com
Wed Jul 11 11:31:27 AEST 2018

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:

main(int ac, string av[])
	string	c;
	string	lopts[] = {

	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;
			printf("Usage: photos.l");
			foreach(c in lopts) {
				if (c =~ /(.*):/) {
					printf(" --%s=<val>", $1);
				} else {
					printf(" --%s", c);

More information about the TUHS mailing list