X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fconflict.c;h=4a20e4ba0d4fb7b021ad772541cdcfb57131ab6b;hb=8ff284ff9167eff8f5349481529332d59ed913b1;hp=30ff189bf5388c2db75fc196510068f17ad2e441;hpb=fce8a87e8a4a443a08a98b24eef270451a63fab8;p=mmh diff --git a/uip/conflict.c b/uip/conflict.c index 30ff189..4a20e4b 100644 --- a/uip/conflict.c +++ b/uip/conflict.c @@ -81,36 +81,39 @@ 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; @@ -189,7 +192,7 @@ grp_names(void) setgrent(); while ((gr = getgrent())) { for (i = 0; i < numgroups; i++) - if (!strcmp(grps[i], gr->gr_name)) { + if (strcmp(grps[i], gr->gr_name)==0) { setup(); fprintf(out, "duplicate group %s(gid=%d)\n", gr->gr_name, (int) gr->gr_gid); @@ -228,7 +231,7 @@ grp_members(void) while ((gr = getgrent())) { for (cp = gr->gr_mem; *cp; cp++) { for (hm = homehead; hm; hm = hm->h_next) - if (!strcmp(*cp, hm->h_name)) + if (strcmp(*cp, hm->h_name)==0) break; if (hm == NULL) { setup(); @@ -325,7 +328,7 @@ check(char *s) register struct home *hm; for (hm = homehead; hm; hm = hm->h_next) - if (!strcmp(s, hm->h_name)) + if (strcmp(s, hm->h_name)==0) return 1; return 0; } @@ -343,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, mhbasename(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); } } }