X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fconflict.c;h=82dfdcc0f3a4118b407aaa2014a206aa695ce5cd;hp=909bbc8fd9aa5bc5321f6248560ea855353e632e;hb=5b792c4424571f05bc2008e3109797d18d7d00d1;hpb=714b5c530ece27ea2835a313013f5b770163403c diff --git a/uip/conflict.c b/uip/conflict.c index 909bbc8..82dfdcc 100644 --- a/uip/conflict.c +++ b/uip/conflict.c @@ -68,7 +68,7 @@ main(int argc, char **argv) #ifdef LOCALE setlocale(LC_ALL, ""); #endif - invo_name = r1bindex(argv[0], '/'); + invo_name = mhbasename(argv[0]); /* foil search of user profile/context */ if (context_foil(NULL) == -1) @@ -81,43 +81,44 @@ main(int argc, char **argv) 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 [switches] [aliasfiles ...]", invo_name); - print_help(buf, switches, 0); - done(1); - case VERSIONSW: - print_version(invo_name); - done(1); - - case MAILSW: - if (!(cp = *argp++) || *cp == '-') - adios(NULL, "missing argument to %s", argp[-2]); - if (mail) - adios(NULL, "mail to one address only"); - else - mail = cp; - continue; - - case SERCHSW: - if (!(cp = *argp++) || *cp == '-') - adios(NULL, "missing argument to %s", argp[-2]); - if (dp >= NDIRS) - adios(NULL, "more than %d directories", NDIRS); - dirs[dp++] = cp; - continue; + case AMBIGSW: + ambigsw(cp, switches); + done(1); + case UNKWNSW: + adios(NULL, "-%s unknown", cp); + + case HELPSW: + snprintf(buf, sizeof(buf), "%s [switches] [aliasfiles ...]", invo_name); + print_help(buf, switches, 0); + done(1); + case VERSIONSW: + print_version(invo_name); + done(1); + + case MAILSW: + if (!(cp = *argp++) || *cp == '-') + adios(NULL, "missing argument to %s", + argp[-2]); + if (mail) + adios(NULL, "mail to one address only"); + else + mail = cp; + continue; + + case SERCHSW: + if (!(cp = *argp++) || *cp == '-') + adios(NULL, "missing argument to %s", + argp[-2]); + if (dp >= NDIRS) + adios(NULL, "more than %d directories", + NDIRS); + dirs[dp++] = cp; + continue; } } akv[akp++] = cp; } - if (akp == 0) - akv[akp++] = AliasFile; if (!homehead) init_pw(); if (!mail) @@ -345,30 +346,30 @@ setup(void) adios("pipe", "unable to"); switch (fork()) { - case NOTOK: - adios("fork", "unable to"); - - case OK: - close(pd[1]); - if (pd[0] != 0) { - dup2(pd[0], 0); - close(pd[0]); - } - if ((fd = open("/dev/null", O_WRONLY)) - != NOTOK) - if (fd != 1) { - dup2(fd, 1); - close(fd); - } - execlp(mailproc, r1bindex (mailproc, '/'), - mail, "-subject", invo_name, - NULL); - adios(mailproc, "unable to exec "); - - default: + case NOTOK: + adios("fork", "unable to"); + + case OK: + close(pd[1]); + if (pd[0] != 0) { + dup2(pd[0], 0); close(pd[0]); - out = fdopen(pd[1], "w"); - fprintf(out, "%s: the following is suspicious\n\n", invo_name); + } + if ((fd = open("/dev/null", O_WRONLY)) + != NOTOK) + if (fd != 1) { + dup2(fd, 1); + close(fd); + } + execlp(mailproc, mhbasename(mailproc), + mail, "-subject", invo_name, + NULL); + adios(mailproc, "unable to exec "); + + default: + close(pd[0]); + out = fdopen(pd[1], "w"); + fprintf(out, "%s: the following is suspicious\n\n", invo_name); } } }