This is optutil.c in view mode; [Download] [Up]
/*+++* * title: optutil.c * RCS optutil.c,v 1.2 1997/05/31 21:52:30 tom Exp * abstract: command-line option handling support stuff. * author: Tom Hageman, The Netherlands <tom@basil.icce.rug.nl> * created: November 1996 * modified: 31 May 1997 *---*/ #import <stdio.h> #import <stdlib.h> #import <string.h> #import "optutil.h" #import "version.h" const char *basename(const char *path) { const char *s = strrchr(path, '/'); return (s ? ++s : path); } const char *_progname = "(unset)"; #ifndef __GNUC__ void set_progname(const char *name) { _progname = basename(name); } const char *progname() { return _progname; } #endif void handle_usage_help_version(int what, const char *usage, const char *help) { switch (what) { case EXIT_USAGE: fprintf(stderr, usage, progname()); fprintf(stderr, "try `%s -H' for more information.\n", progname()); break; case EXIT_HELP: printf(usage, progname()); printf(help, progname()); what = EXIT_SUCCESS; break; case EXIT_VERSION: printf("%s: %s version %s, %s.\n", progname(), PACKAGE, VERSION, VERSION_DATE); what = EXIT_SUCCESS; break; default: return; /* no-op. */ } exit(what); }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.