home *** CD-ROM | disk | FTP | other *** search
- /*
- Stuff 2.0.
-
- Checksum: 1857136836 (verify with "brik")
-
- (C) Copyright 1988 Rahul Dhesi. Permission is granted to copy and
- distribute this file in modified or unmodified form, whether for
- noncommercial or commercial use, provided (a) this copyright notice
- is preserved, (b) no attempt is made to restrict redistribution of
- this file, and (c) this file is not distributed as part of any
- collection whose redistribution is restricted by a compilation
- copyright.
- */
-
- /*
- Main program for "stuff".
- */
-
- /* make sure there is plenty of stack space */
- extern unsigned int _stklen = 10000;
-
- #include <stdio.h>
- #include <string.h>
- #include "stuff.h"
-
- FILE *outfile; /* where output is going */
-
- main (argc, argv)
- char **argv;
- int argc;
- {
- int pathcount; /* count of pathnames */
- int i;
-
- outfile = stdout; /* may change later */
-
- if (argc < 2) {
- givehelp();
- exit(1);
- }
-
- /* count pathnames */
- for (i = 1; i < argc && *argv[i] != '-' && *argv[i] != '!'; )
- i++;
- pathcount = i - 1;
- if (pathcount < 1) {
- givehelp();
- exit(1);
- }
-
- for (; i < argc; i++) { /* parse options */
- parseopt (argv, &i, argc, NORMAL);
- }
-
- #ifdef DEBUG
- dumpopts();
- #endif
-
- for (i = 1; i <= pathcount; i++) {
- forceslash (argv[i]);
- doarg (argv[i]);
- }
- }
-
- void bugreport (char *func)
- {
- fprintf (stderr, "stuff: bug in function %s\n", func);
- exit(1);
- }
-
- extern int last_opt;
- extern request_rec *options[];
-
- #ifdef DEBUG
- void dumpopts (void)
- {
- int i;
- request_rec *optr;
- printf ("=== options ===\n");
- for (i = 0; i <= last_opt; i++) {
- optr = options[i];
- if (optr->choice == PRINT)
- printf ("%2d: PRINT\n", i);
- else if (optr->choice == NAME)
- printf ("%2d: %sNAME = [%s]\n",
- i, optr->negate ? "!" : " ", optr->info.name);
- else if (optr->choice == MTIME)
- printf ("%2d: MTIME\n", i);
- else if (optr->choice == OLDER)
- printf ("%2d: OLDER\n", i);
- else if (optr->choice == NEWER)
- printf ("%2d: NEWER\n", i);
- else if (optr->choice == TYPE)
- printf ("%2d: TYPE\n", i);
- else
- printf ("%2d: ????\n", i);
- }
- printf ("===============\n");
- }
- #endif
-