Autzoo.1288 net.sources utcsrgv!utzoo!henry Tue Jan 19 03:22:25 1982 getopt(1) The following is the source and manual page for a getopt program (for use in shell programming) written locally to match the description in a copy of the Unix 3.0 manual that I got to see once. Behavior is believed identical to the Bell one, but this is NOT Bell code and carries no nondisclosure restrictions. Use it on any system you wish. NB unlike the previous getopt(3), this has not been too well shaken down. ----------- #include main(argc, argv) int argc; char *argv[]; { extern int optind; extern char *optarg; int c; int status = 0; optind = 2; /* Past the program name and the option letters. */ while ((c = getopt(argc, argv, argv[1])) != EOF) switch (c) { case '?': status = 1; /* getopt routine gave message */ break; default: if (optarg != NULL) printf(" -%c %s", c, optarg); else printf(" -%c", c); break; } printf(" --"); for (; optind
This Usenet Oldnews Archive article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.
2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright© 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.


Goto NEXT article in NET.sources Newsgroup
Return to NET.sources index
Return to the Usenet Oldnews Archive index ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.