- invo_name = r1bindex (argv[0], '/');
-
- /* read user profile/context */
- context_read();
-
- arguments = getarguments (invo_name, argc, argv, 1);
- argp = arguments;
-
- /*
- * Allocate the initial space to record message
- * names, ranges, and sequences.
- */
- nummsgs = 0;
- maxmsgs = MAXMSGS;
- if (!(msgs = (char **) malloc ((size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to allocate storage");
-
- /*
- * Parse arguments
- */
- while ((cp = *argp++)) {
- if (*cp == '-') {
- switch (smatch (++cp, switches)) {
- case AMBIGSW:
- ambigsw (cp, switches);
- done (1);
- case UNKWNSW:
- adios (NULL, "-%s unknown\n", cp);
-
- case HELPSW:
- snprintf (buf, sizeof(buf), "%s [msgs] [switches] +folder ...",
- invo_name);
- print_help (buf, switches, 1);
- done (1);
- case VERSIONSW:
- print_version(invo_name);
- done (1);
-
- case LINKSW:
- linkf++;
- continue;
- case NLINKSW:
- linkf = 0;
- continue;
-
- case PRESSW:
- preserve++;
- continue;
- case NPRESSW:
- preserve = 0;
- continue;
-
- case UNLINKSW:
- unlink_msgs++;
- continue;
- case NUNLINKSW:
- unlink_msgs = 0;
- continue;
-
- case SRCSW:
- if (folder)
- adios (NULL, "only one source folder at a time!");
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- folder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
- *cp != '@' ? TFOLDER : TSUBCWF);
- continue;
- case DRAFTSW:
- if (filep > NFOLDERS)
- adios (NULL, "only %d files allowed!", NFOLDERS);
- isdf = 0;
- files[filep++] = getcpy (m_draft (NULL, NULL, 1, &isdf));
- continue;
- case FILESW:
- if (filep > NFOLDERS)
- adios (NULL, "only %d files allowed!", NFOLDERS);
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- files[filep++] = path (cp, TFILE);
- continue;
-
- case RPROCSW:
- if (!(rmmproc = *argp++) || *rmmproc == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
- case NRPRCSW:
- rmmproc = NULL;
- continue;
- }
+ invo_name = r1bindex (argv[0], '/');
+
+ /* read user profile/context */
+ context_read();
+
+ arguments = getarguments (invo_name, argc, argv, 1);
+ argp = arguments;
+
+ /*
+ * Parse arguments
+ */
+ while ((cp = *argp++)) {
+ if (*cp == '-') {
+ switch (smatch (++cp, switches)) {
+ case AMBIGSW:
+ ambigsw (cp, switches);
+ done (1);
+ case UNKWNSW:
+ adios (NULL, "-%s unknown\n", cp);
+
+ case HELPSW:
+ snprintf (buf, sizeof(buf), "%s [msgs] [switches] +folder ...",
+ invo_name);
+ print_help (buf, switches, 1);
+ done (1);
+ case VERSIONSW:
+ print_version(invo_name);
+ done (1);
+
+ case LINKSW:
+ linkf++;
+ continue;
+ case NLINKSW:
+ linkf = 0;
+ continue;
+
+ case PRESSW:
+ preserve++;
+ continue;
+ case NPRESSW:
+ preserve = 0;
+ continue;
+
+ case UNLINKSW:
+ unlink_msgs++;
+ continue;
+ case NUNLINKSW:
+ unlink_msgs = 0;
+ continue;
+
+ case SRCSW:
+ if (folder)
+ adios (NULL, "only one source folder at a time!");
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ folder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
+ *cp != '@' ? TFOLDER : TSUBCWF);
+ continue;
+ case FILESW:
+ if (filep > NFOLDERS)
+ adios (NULL, "only %d files allowed!", NFOLDERS);
+ if (!(cp = *argp++) || *cp == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ files[filep++] = path (cp, TFILE);
+ continue;
+
+ case RPROCSW:
+ if (!(rmmproc = *argp++) || *rmmproc == '-')
+ adios (NULL, "missing argument to %s", argp[-2]);
+ continue;
+ case NRPRCSW:
+ rmmproc = NULL;
+ continue;
+ }
+ }
+ if (*cp == '+' || *cp == '@') {
+ if (foldp > NFOLDERS)
+ adios (NULL, "only %d folders allowed!", NFOLDERS);
+ folders[foldp++].f_name =
+ pluspath (cp);
+ } else
+ app_msgarg(&msgs, cp);