- break;
- case NOALLSW:
- all = FALSE;
- break;
-
- case SHOWZERO:
- showzero = TRUE;
- break;
- case NOSHOWZERO:
- showzero = FALSE;
- break;
-
- case ALPHASW:
- alphaOrder = TRUE;
- break;
- case NOALPHASW:
- alphaOrder = FALSE;
- break;
-
- case NOFASTSW:
- case TOTALSW:
- Total = TRUE;
- break;
-
- case FASTSW:
- case NOTOTALSW:
- Total = FALSE;
- break;
-
- case RECURSE:
- recurse = TRUE;
- break;
- case NORECURSE:
- recurse = FALSE;
- break;
- }
- } else {
- /*
- * Check if we need to allocate more space
- * for folder names.
- */
- if (numfolders >= maxfolders) {
- maxfolders += MAXFOLDERS;
- if (!(foldersToDo = (char **) realloc (foldersToDo,
- (size_t) (maxfolders * sizeof(*foldersToDo)))))
- adios (NULL, "unable to reallocate folder name storage");
- }
- if (*cp == '+' || *cp == '@') {
- foldersToDo[numfolders++] =
- path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
- } else
- foldersToDo[numfolders++] = cp;
+
+ arguments = getarguments (invo_name, argc, argv, 1);
+ argp = arguments;
+
+ /* allocate the initial space to record the folder names */
+ numfolders = 0;
+ maxfolders = MAXFOLDERS;
+ foldersToDo = (char **) mh_xmalloc ((size_t) (maxfolders * sizeof(*foldersToDo)));
+
+ /* no sequences yet */
+ numsequences = 0;
+
+ /* parse arguments */
+ while ((cp = *argp++)) {
+ if (*cp == '-') {
+ switch (smatch(++cp, switches)) {
+ case AMBIGSW:
+ ambigsw(cp, switches);
+ done(1);
+ case UNKWNSW:
+ adios(NULL, "-%s unknown", cp);
+
+ case HELPSW:
+ snprintf(buf, sizeof(buf), "%s [+folder1 [+folder2 ...]][switches]",
+ invo_name);
+ print_help(buf, switches, 1);
+ done(1);
+ case VERSIONSW:
+ print_version(invo_name);
+ done (1);
+
+ case SEQSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+
+ /* check if too many sequences specified */
+ if (numsequences >= NUMATTRS)
+ adios (NULL, "too many sequences (more than %d) specified", NUMATTRS);
+ sequencesToDo[numsequences++] = cp;
+ break;
+
+ case ALLSW:
+ all = TRUE;
+ break;
+ case NOALLSW:
+ all = FALSE;
+ break;
+
+ case SHOWZERO:
+ showzero = TRUE;
+ break;
+ case NOSHOWZERO:
+ showzero = FALSE;
+ break;
+
+ case ALPHASW:
+ alphaOrder = TRUE;
+ break;
+ case NOALPHASW:
+ alphaOrder = FALSE;
+ break;
+
+ case NOFASTSW:
+ case TOTALSW:
+ Total = TRUE;
+ break;
+
+ case FASTSW:
+ case NOTOTALSW:
+ Total = FALSE;
+ break;
+
+ case RECURSE:
+ recurse = TRUE;
+ break;
+ case NORECURSE:
+ recurse = FALSE;
+ break;
+ }
+ } else {
+ /*
+ * Check if we need to allocate more space
+ * for folder names.
+ */
+ if (numfolders >= maxfolders) {
+ maxfolders += MAXFOLDERS;
+ foldersToDo = (char **) mh_xrealloc (foldersToDo,
+ (size_t) (maxfolders * sizeof(*foldersToDo)));
+ }
+ if (*cp == '+' || *cp == '@') {
+ foldersToDo[numfolders++] =
+ pluspath (cp);
+ } else
+ foldersToDo[numfolders++] = cp;
+ }