- /*
- ** Merge any arguments from command line (now in vec)
- ** and arguments from profile.
- */
- arguments = getarguments(sp, n, vec, 1);
- argp = arguments;
-
- debugsw = 0;
- forwsw = 1;
- inplace = 1;
-
- altmsg = NULL;
- annotext = NULL;
- distfile = NULL;
-
- vecp = 1; /* we'll get the zero'th element later */
- vec[vecp++] = "-library";
- vec[vecp++] = getcpy(toabsdir("+"));
-
- while ((cp = *argp++)) {
- if (*cp == '-') {
- switch (smatch(++cp, sendswitches)) {
- case AMBIGSW:
- ambigsw(cp, sendswitches);
- return;
- case UNKWNSW:
- advise(NULL, "-%s unknown\n", cp);
- return;
-
- case SHELPSW:
- snprintf(buf, sizeof(buf),
- "%s [switches]", sp);
- print_help(buf, sendswitches, 1);
- return;
- case SVERSIONSW:
- print_version(invo_name);
- return;
-
- case SPSHSW:
- pushed++;
- continue;
- case NSPSHSW:
- pushed = 0;
- continue;
-
- case FORWSW:
- forwsw++;
- continue;
- case NFORWSW:
- forwsw = 0;
- continue;
-
- case VERBSW:
- verbsw++;
- vec[vecp++] = --cp;
- continue;
- case NVERBSW:
- verbsw = 0;
- vec[vecp++] = --cp;
- continue;
-
- case DEBUGSW:
- debugsw++; /* fall */
- case NFILTSW:
- case FRMTSW:
- case NFRMTSW:
- case WATCSW:
- case NWATCSW:
- vec[vecp++] = --cp;
- continue;
-
- case ALIASW:
- case FILTSW:
- case WIDTHSW:
- vec[vecp++] = --cp;
- if (!(cp = *argp++) || *cp == '-') {
- advise(NULL, "missing argument to %s",
- argp[-2]);
- return;
- }
- vec[vecp++] = cp;
- continue;
-
- }
- }
- advise(NULL, "usage: %s [switches]", sp);
- return;
- }
-
- /* allow Aliasfile: profile entry */
- if ((cp = context_find("Aliasfile"))) {
- char **ap, *dp;
-
- dp = getcpy(cp);
- for (ap = brkstring(dp, " ", "\n"); ap && *ap; ap++) {
- vec[vecp++] = "-alias";
- vec[vecp++] = getcpy(etcpath(*ap));
- }
- }
-
- if (!(cp = getenv("SIGNATURE")) || !*cp)
- if ((cp = context_find("signature")) && *cp)
- m_putenv("SIGNATURE", cp);
-
- if ((annotext = getenv("mhannotate")) == NULL || *annotext == 0)
- annotext = NULL;
- if ((altmsg = getenv("mhaltmsg")) == NULL || *altmsg == 0)
- altmsg = NULL;
- if (annotext && ((cp = getenv("mhinplace")) != NULL && *cp != 0))
- inplace = atoi(cp);
-
- if ((cp = getenv("mhdist")) && *cp
-#ifndef lint
- && (distsw = atoi (cp))
-#endif /* not lint */
- && altmsg) {
- vec[vecp++] = "-dist";
- distfile = getcpy(m_mktemp2(altmsg, invo_name, NULL, NULL));
- if (link(altmsg, distfile) == NOTOK)
- adios(distfile, "unable to link %s to", altmsg);
- } else {
- distfile = NULL;
- }
-
- if (altmsg == NULL || stat(altmsg, &st) == NOTOK) {
- st.st_mtime = 0;
- st.st_dev = 0;
- st.st_ino = 0;
- }
- if ((pushsw = pushed))
- push();
-
- vec[0] = mhbasename(postproc);
- closefds(3);