🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #18077

standard practices

#18077
From: William Rosencranz
Date: Wed, 20 Mar 1991 20:42
80 lines
2427 bytes
while on the subject of standards, can i throw in my 2 cents on another
plead for consistency?

it would be really nice if unix-like programs on the ST (or anywhere, for
that matter) would include the following command line switches:

	-debug		to turn on internal debugging, if any
	-help		to print a usage synopsis
	-version	to print current program version
	-changes	to print major changes since last rev (or indicate
			that this is first rev)

it makes life a little easier and is no big deal to program, viz:

	for (argc--, argv++; argc && (**argv == '-'); argc--, argv++)
	{
		switch (*(*argv+1))
		{
		case 'd':
			if (!strncmp (*argv, "-debug", 6))
			{
				debugging++;
				break;
			}
			/* otherwise handle any "-d" option */
			break;

		case 'v':
			if (!strncmp (*argv, "-vers", 5))
			{
				printf"%s\n", versionon);
				exit (0);
			}
			/* otherwise handle any "-v" option */
			break;

		case 'h':
			if (!strncmp (*argv, "-help", 5))
			{
				usage ();
				exit (0);
			}
			/* otherwise handle any "-h" option */
			break;

		case 'c':
			if (!strncmp (*argv, "-chang", 6))
			{
				changes ();
				exit (0);
			}
			/* otherwise handle any "-c" option */
			break;

		/* any other options... */
		}
	}

i like debugging++ rather than debugging = 1 since you could potentially
have severall levels (-debug or -debug -debug or ...). if you really want
more generality, change to:

	case 'H':	/* for desktop's benefit */
	case 'h':
		if (!strncmp (stolower (*argv), "-help", 5))
		{
			/* stolower returns (char *) ptr after lowercasing
			   the string arg */
			...
		}

does this sound reasonable? i have adopted this myself for both unix and
TOS. i just wish P1003.2 would say something about this...

-bill
rosenkra@convex.com
--
Bill Rosenkranz            |UUCP: {uunet,texsun}!convex!c1yankee!rosenkra
Convex Computer Corp.      |ARPA: rosenkra%c1yankee@convex.com
Technical Details
Message-ID: <1991Mar20.204257.26740@convex.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!newstop!texsun!convex!rosenkra

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!newstop!texsun!convex!rosenkra
From: rosenkra@convex.com (William Rosencranz)
Newsgroups: comp.sys.atari.st
Subject: standard practices
Message-ID: <1991Mar20.204257.26740@convex.com>
Date: 20 Mar 91 20:42:57 GMT
Sender: news@convex.com (news access account)
Organization: Convex Computer Corporation, Richardson, Tx.
Lines: 80
Nntp-Posting-Host: convex1.convex.com