=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mail/cmd3.c,v retrieving revision 1.4 retrieving revision 1.5 diff -c -r1.4 -r1.5 *** src/usr.bin/mail/cmd3.c 1997/05/30 08:51:35 1.4 --- src/usr.bin/mail/cmd3.c 1997/07/13 21:21:09 1.5 *************** *** 1,5 **** ! /* $OpenBSD: cmd3.c,v 1.4 1997/05/30 08:51:35 deraadt Exp $ */ ! /* $NetBSD: cmd3.c,v 1.5 1996/06/08 19:48:14 christos Exp $ */ /* * Copyright (c) 1980, 1993 --- 1,5 ---- ! /* $OpenBSD: cmd3.c,v 1.5 1997/07/13 21:21:09 millert Exp $ */ ! /* $NetBSD: cmd3.c,v 1.8 1997/07/09 05:29:49 mikel Exp $ */ /* * Copyright (c) 1980, 1993 *************** *** 36,44 **** #ifndef lint #if 0 ! static char sccsid[] = "@(#)cmd3.c 8.1 (Berkeley) 6/6/93"; #else ! static char rcsid[] = "$OpenBSD: cmd3.c,v 1.4 1997/05/30 08:51:35 deraadt Exp $"; #endif #endif /* not lint */ --- 36,44 ---- #ifndef lint #if 0 ! static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95"; #else ! static char rcsid[] = "$OpenBSD: cmd3.c,v 1.5 1997/07/13 21:21:09 millert Exp $"; #endif #endif /* not lint */ *************** *** 67,79 **** (void) strcpy(cmd, str); if (bangexp(cmd) < 0) ! return 1; if ((shell = value("SHELL")) == NOSTR) shell = _PATH_CSHELL; (void) run_command(shell, 0, -1, -1, "-c", cmd, NOSTR); (void) signal(SIGINT, sigint); ! printf("!\n"); ! return 0; } /* --- 67,79 ---- (void) strcpy(cmd, str); if (bangexp(cmd) < 0) ! return(1); if ((shell = value("SHELL")) == NOSTR) shell = _PATH_CSHELL; (void) run_command(shell, 0, -1, -1, "-c", cmd, NOSTR); (void) signal(SIGINT, sigint); ! puts("!"); ! return(0); } /* *************** *** 92,98 **** (void) run_command(shell, 0, -1, -1, NOSTR, NOSTR, NOSTR); (void) signal(SIGINT, sigint); putchar('\n'); ! return 0; } /* --- 92,98 ---- (void) run_command(shell, 0, -1, -1, NOSTR, NOSTR, NOSTR); (void) signal(SIGINT, sigint); putchar('\n'); ! return(0); } /* *************** *** 118,124 **** if (*cp == '!') { if (n < strlen(lastbang)) { overf: ! printf("Command buffer overflow\n"); return(-1); } changed++; --- 118,124 ---- if (*cp == '!') { if (n < strlen(lastbang)) { overf: ! puts("Command buffer overflow"); return(-1); } changed++; *************** *** 145,152 **** fflush(stdout); } strcpy(str, bangbuf); ! strncpy(lastbang, bangbuf, 128); ! lastbang[128-1] = 0; return(0); } --- 145,152 ---- fflush(stdout); } strcpy(str, bangbuf); ! strncpy(lastbang, bangbuf, sizeof(lastbang) - 1); ! lastbang[sizeof(lastbang) - 1] = '\0'; return(0); } *************** *** 162,173 **** register FILE *f; if ((f = Fopen(_PATH_HELP, "r")) == NULL) { ! perror(_PATH_HELP); return(1); } while ((c = getc(f)) != EOF) putchar(c); ! Fclose(f); return(0); } --- 162,173 ---- register FILE *f; if ((f = Fopen(_PATH_HELP, "r")) == NULL) { ! warn(_PATH_HELP); return(1); } while ((c = getc(f)) != EOF) putchar(c); ! (void)Fclose(f); return(0); } *************** *** 187,196 **** if ((cp = expand(*arglist)) == NOSTR) return(1); if (chdir(cp) < 0) { ! perror(cp); return(1); } ! return 0; } int --- 187,196 ---- if ((cp = expand(*arglist)) == NOSTR) return(1); if (chdir(cp) < 0) { ! warn(cp); return(1); } ! return(0); } int *************** *** 199,207 **** { int *msgvec = v; if (value("Replyall") == NOSTR) ! return (_respond(msgvec)); else ! return (_Respond(msgvec)); } /* --- 199,207 ---- { int *msgvec = v; if (value("Replyall") == NOSTR) ! return(_respond(msgvec)); else ! return(_Respond(msgvec)); } /* *************** *** 219,225 **** struct header head; if (msgvec[1] != 0) { ! printf("Sorry, can't reply to multiple messages at once\n"); return(1); } mp = &message[msgvec[0] - 1]; --- 219,225 ---- struct header head; if (msgvec[1] != 0) { ! puts("Sorry, can't reply to multiple messages at once"); return(1); } mp = &message[msgvec[0] - 1]; *************** *** 246,252 **** np = cat(np, extract(rcv, GTO)); else if (np == NIL) { if (replyto != NOSTR) ! printf("Empty reply-to field -- replying to author\n"); np = extract(rcv, GTO); } head.h_to = np; --- 246,252 ---- np = cat(np, extract(rcv, GTO)); else if (np == NIL) { if (replyto != NOSTR) ! puts("Empty reply-to field -- replying to author"); np = extract(rcv, GTO); } head.h_to = np; *************** *** 279,293 **** char *newsubj; if (subj == NOSTR) ! return NOSTR; if ((subj[0] == 'r' || subj[0] == 'R') && (subj[1] == 'e' || subj[1] == 'E') && subj[2] == ':') ! return subj; newsubj = salloc(strlen(subj) + 5); strcpy(newsubj, "Re: "); strcpy(newsubj + 4, subj); ! return newsubj; } /* --- 279,293 ---- char *newsubj; if (subj == NOSTR) ! return(NOSTR); if ((subj[0] == 'r' || subj[0] == 'R') && (subj[1] == 'e' || subj[1] == 'E') && subj[2] == ':') ! return(subj); newsubj = salloc(strlen(subj) + 5); strcpy(newsubj, "Re: "); strcpy(newsubj + 4, subj); ! return(newsubj); } /* *************** *** 303,309 **** register int *ip, mesg; if (edit) { ! printf("Cannot \"preserve\" in edit mode\n"); return(1); } for (ip = msgvec; *ip != NULL; ip++) { --- 303,309 ---- register int *ip, mesg; if (edit) { ! puts("Cannot \"preserve\" in edit mode"); return(1); } for (ip = msgvec; *ip != NULL; ip++) { *************** *** 385,391 **** for (h = 0, s = 1; h < HSHSIZE; h++) for (vp = variables[h]; vp != NOVAR; vp = vp->v_link) s++; ! ap = (char **) salloc(s * sizeof *ap); for (h = 0, p = ap; h < HSHSIZE; h++) for (vp = variables[h]; vp != NOVAR; vp = vp->v_link) *p++ = vp->v_name; --- 385,391 ---- for (h = 0, s = 1; h < HSHSIZE; h++) for (vp = variables[h]; vp != NOVAR; vp = vp->v_link) s++; ! ap = (char **) salloc(s * sizeof(*ap)); for (h = 0, p = ap; h < HSHSIZE; h++) for (vp = variables[h]; vp != NOVAR; vp = vp->v_link) *p++ = vp->v_name; *************** *** 407,413 **** else cp++; if (equal(varbuf, "")) { ! printf("Non-null variable name required\n"); errs++; continue; } --- 407,413 ---- else cp++; if (equal(varbuf, "")) { ! puts("Non-null variable name required"); errs++; continue; } *************** *** 473,479 **** for (h = 0, s = 1; h < HSHSIZE; h++) for (gh = groups[h]; gh != NOGRP; gh = gh->g_link) s++; ! ap = (char **) salloc(s * sizeof *ap); for (h = 0, p = ap; h < HSHSIZE; h++) for (gh = groups[h]; gh != NOGRP; gh = gh->g_link) *p++ = gh->g_name; --- 473,479 ---- for (h = 0, s = 1; h < HSHSIZE; h++) for (gh = groups[h]; gh != NOGRP; gh = gh->g_link) s++; ! ap = (char **) salloc(s * sizeof(*ap)); for (h = 0, p = ap; h < HSHSIZE; h++) for (gh = groups[h]; gh != NOGRP; gh = gh->g_link) *p++ = gh->g_name; *************** *** 490,496 **** gname = *argv; h = hash(gname); if ((gh = findgroup(gname)) == NOGRP) { ! gh = (struct grouphead *) calloc(sizeof *gh, 1); gh->g_name = vcopy(gname); gh->g_list = NOGE; gh->g_link = groups[h]; --- 490,496 ---- gname = *argv; h = hash(gname); if ((gh = findgroup(gname)) == NOGRP) { ! gh = (struct grouphead *) calloc(sizeof(*gh), 1); gh->g_name = vcopy(gname); gh->g_list = NOGE; gh->g_link = groups[h]; *************** *** 504,510 **** */ for (ap = argv+1; *ap != NOSTR; ap++) { ! gp = (struct group *) calloc(sizeof *gp, 1); gp->ge_name = vcopy(*ap); gp->ge_link = gh->g_list; gh->g_list = gp; --- 504,510 ---- */ for (ap = argv+1; *ap != NOSTR; ap++) { ! gp = (struct group *) calloc(sizeof(*gp), 1); gp->ge_name = vcopy(*ap); gp->ge_link = gh->g_list; gh->g_list = gp; *************** *** 549,555 **** null(v) void *v; { ! return 0; } /* --- 549,555 ---- null(v) void *v; { ! return(0); } /* *************** *** 563,575 **** char **argv = v; if (argv[0] == NOSTR) { ! newfileinfo(); ! return 0; } if (setfile(*argv) < 0) ! return 1; announce(); ! return 0; } /* --- 563,575 ---- char **argv = v; if (argv[0] == NOSTR) { ! newfileinfo(0); ! return(0); } if (setfile(*argv) < 0) ! return(1); announce(); ! return(0); } /* *************** *** 588,598 **** if ((cp = expand(cp)) != NOSTR) { if (ap != argv) putchar(' '); ! printf("%s", cp); } } putchar('\n'); ! return 0; } int --- 588,598 ---- if ((cp = expand(cp)) != NOSTR) { if (ap != argv) putchar(' '); ! fputs(cp, stdout); } } putchar('\n'); ! return(0); } int *************** *** 601,609 **** { int *msgvec = v; if (value("Replyall") == NOSTR) ! return (_Respond(msgvec)); else ! return (_respond(msgvec)); } /* --- 601,609 ---- { int *msgvec = v; if (value("Replyall") == NOSTR) ! return(_Respond(msgvec)); else ! return(_respond(msgvec)); } /* *************** *** 630,636 **** head.h_to = cat(head.h_to, extract(cp, GTO)); } if (head.h_to == NIL) ! return 0; mp = &message[msgvec[0] - 1]; if ((head.h_subject = hfield("subject", mp)) == NOSTR) head.h_subject = hfield("subj", mp); --- 630,636 ---- head.h_to = cat(head.h_to, extract(cp, GTO)); } if (head.h_to == NIL) ! return(0); mp = &message[msgvec[0] - 1]; if ((head.h_subject = hfield("subject", mp)) == NOSTR) head.h_subject = hfield("subj", mp); *************** *** 639,645 **** head.h_bcc = NIL; head.h_smopts = NIL; mail1(&head, 1); ! return 0; } /* --- 639,645 ---- head.h_bcc = NIL; head.h_smopts = NIL; mail1(&head, 1); ! return(0); } /* *************** *** 654,660 **** register char *cp; if (cond != CANY) { ! printf("Illegal nested \"if\"\n"); return(1); } cond = CANY; --- 654,660 ---- register char *cp; if (cond != CANY) { ! puts("Illegal nested \"if\""); return(1); } cond = CANY; *************** *** 686,692 **** switch (cond) { case CANY: ! printf("\"Else\" without matching \"if\"\n"); return(1); case CSEND: --- 686,692 ---- switch (cond) { case CANY: ! puts("\"Else\" without matching \"if\""); return(1); case CSEND: *************** *** 698,704 **** break; default: ! printf("Mail's idea of conditions is screwed up\n"); cond = CANY; break; } --- 698,704 ---- break; default: ! puts("mail's idea of conditions is screwed up"); cond = CANY; break; } *************** *** 714,720 **** { if (cond == CANY) { ! printf("\"Endif\" without matching \"if\"\n"); return(1); } cond = CANY; --- 714,720 ---- { if (cond == CANY) { ! puts("\"Endif\" without matching \"if\""); return(1); } cond = CANY; *************** *** 738,751 **** return(0); for (ap = altnames; *ap; ap++) printf("%s ", *ap); ! printf("\n"); return(0); } if (altnames != 0) free((char *) altnames); ! altnames = (char **) calloc((unsigned) c, sizeof (char *)); for (ap = namelist, ap2 = altnames; *ap; ap++, ap2++) { ! cp = (char *) calloc((unsigned) strlen(*ap) + 1, sizeof (char)); strcpy(cp, *ap); *ap2 = cp; } --- 738,751 ---- return(0); for (ap = altnames; *ap; ap++) printf("%s ", *ap); ! putchar('\n'); return(0); } if (altnames != 0) free((char *) altnames); ! altnames = (char **) calloc((unsigned) c, sizeof(char *)); for (ap = namelist, ap2 = altnames; *ap; ap++, ap2++) { ! cp = (char *) calloc((unsigned) strlen(*ap) + 1, sizeof(char)); strcpy(cp, *ap); *ap2 = cp; }