=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mail/fio.c,v retrieving revision 1.7 retrieving revision 1.8 diff -c -r1.7 -r1.8 *** src/usr.bin/mail/fio.c 1997/07/13 23:53:59 1.7 --- src/usr.bin/mail/fio.c 1997/07/14 00:24:26 1.8 *************** *** 1,4 **** ! /* $OpenBSD: fio.c,v 1.7 1997/07/13 23:53:59 millert Exp $ */ /* $NetBSD: fio.c,v 1.8 1997/07/07 22:57:55 phil Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: fio.c,v 1.8 1997/07/14 00:24:26 millert Exp $ */ /* $NetBSD: fio.c,v 1.8 1997/07/07 22:57:55 phil Exp $ */ /* *************** *** 38,44 **** #if 0 static char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95"; #else ! static char rcsid[] = "$OpenBSD: fio.c,v 1.7 1997/07/13 23:53:59 millert Exp $"; #endif #endif /* not lint */ --- 38,44 ---- #if 0 static char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95"; #else ! static char rcsid[] = "$OpenBSD: fio.c,v 1.8 1997/07/14 00:24:26 millert Exp $"; #endif #endif /* not lint */ *************** *** 360,370 **** break; if (prevfile[0] == 0) { puts("No previous file"); ! return(NOSTR); } return(savestr(prevfile)); case '&': ! if (name[1] == 0 && (name = value("MBOX")) == NOSTR) name = "~/mbox"; /* fall through */ } --- 360,370 ---- break; if (prevfile[0] == 0) { puts("No previous file"); ! return(NULL); } return(savestr(prevfile)); case '&': ! if (name[1] == 0 && (name = value("MBOX")) == NULL) name = "~/mbox"; /* fall through */ } *************** *** 384,415 **** return(name); } snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name); ! if ((shell = value("SHELL")) == NOSTR) shell = _PATH_CSHELL; ! pid = start_command(shell, 0, -1, pivec[1], "-c", cmdbuf, NOSTR); if (pid < 0) { (void)close(pivec[0]); (void)close(pivec[1]); ! return(NOSTR); } (void)close(pivec[1]); l = read(pivec[0], xname, PATHSIZE); (void)close(pivec[0]); if (wait_child(pid) < 0 && wait_status.w_termsig != SIGPIPE) { fprintf(stderr, "\"%s\": Expansion failed.\n", name); ! return(NOSTR); } if (l < 0) { warn("read"); ! return(NOSTR); } if (l == 0) { fprintf(stderr, "\"%s\": No match.\n", name); ! return(NOSTR); } if (l == PATHSIZE) { fprintf(stderr, "\"%s\": Expansion buffer overflow.\n", name); ! return(NOSTR); } xname[l] = '\0'; for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--) --- 384,415 ---- return(name); } snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name); ! if ((shell = value("SHELL")) == NULL) shell = _PATH_CSHELL; ! pid = start_command(shell, 0, -1, pivec[1], "-c", cmdbuf, NULL); if (pid < 0) { (void)close(pivec[0]); (void)close(pivec[1]); ! return(NULL); } (void)close(pivec[1]); l = read(pivec[0], xname, PATHSIZE); (void)close(pivec[0]); if (wait_child(pid) < 0 && wait_status.w_termsig != SIGPIPE) { fprintf(stderr, "\"%s\": Expansion failed.\n", name); ! return(NULL); } if (l < 0) { warn("read"); ! return(NULL); } if (l == 0) { fprintf(stderr, "\"%s\": No match.\n", name); ! return(NULL); } if (l == PATHSIZE) { fprintf(stderr, "\"%s\": Expansion buffer overflow.\n", name); ! return(NULL); } xname[l] = '\0'; for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--) *************** *** 417,423 **** cp[1] = '\0'; if (strchr(xname, ' ') && stat(xname, &sbuf) < 0) { fprintf(stderr, "\"%s\": Ambiguous.\n", name); ! return(NOSTR); } return(savestr(xname)); } --- 417,423 ---- cp[1] = '\0'; if (strchr(xname, ' ') && stat(xname, &sbuf) < 0) { fprintf(stderr, "\"%s\": Ambiguous.\n", name); ! return(NULL); } return(savestr(xname)); } *************** *** 432,438 **** { char *folder; ! if ((folder = value("folder")) == NOSTR) return(-1); if (*folder == '/') { strncpy(name, folder, namelen-1); --- 432,438 ---- { char *folder; ! if ((folder = value("folder")) == NULL) return(-1); if (*folder == '/') { strncpy(name, folder, namelen-1); *************** *** 450,456 **** { register char *cp; ! if ((cp = value("DEAD")) == NOSTR || (cp = expand(cp)) == NOSTR) cp = expand("~/dead.letter"); else if (*cp != '/') { char buf[PATHSIZE]; --- 450,456 ---- { register char *cp; ! if ((cp = value("DEAD")) == NULL || (cp = expand(cp)) == NULL) cp = expand("~/dead.letter"); else if (*cp != '/') { char buf[PATHSIZE];