=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mail/cmd3.c,v retrieving revision 1.7 retrieving revision 1.8 diff -c -r1.7 -r1.8 *** src/usr.bin/mail/cmd3.c 1997/07/14 00:24:25 1.7 --- src/usr.bin/mail/cmd3.c 1997/07/30 06:32:38 1.8 *************** *** 1,4 **** ! /* $OpenBSD: cmd3.c,v 1.7 1997/07/14 00:24:25 millert Exp $ */ /* $NetBSD: cmd3.c,v 1.8 1997/07/09 05:29:49 mikel Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: cmd3.c,v 1.8 1997/07/30 06:32:38 millert Exp $ */ /* $NetBSD: cmd3.c,v 1.8 1997/07/09 05:29:49 mikel Exp $ */ /* *************** *** 38,44 **** #if 0 static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95"; #else ! static char rcsid[] = "$OpenBSD: cmd3.c,v 1.7 1997/07/14 00:24:25 millert Exp $"; #endif #endif /* not lint */ --- 38,44 ---- #if 0 static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95"; #else ! static char rcsid[] = "$OpenBSD: cmd3.c,v 1.8 1997/07/30 06:32:38 millert Exp $"; #endif #endif /* not lint */ *************** *** 65,72 **** char *shell; char cmd[BUFSIZ]; ! (void)strcpy(cmd, str); ! if (bangexp(cmd) < 0) return(1); if ((shell = value("SHELL")) == NULL) shell = _PATH_CSHELL; --- 65,73 ---- char *shell; char cmd[BUFSIZ]; ! (void)strncpy(cmd, str, sizeof(cmd) - 1); ! cmd[sizeof(cmd) - 1] = '\0'; ! if (bangexp(cmd, sizeof(cmd)) < 0) return(1); if ((shell = value("SHELL")) == NULL) shell = _PATH_CSHELL; *************** *** 99,112 **** * Expand the shell escape by expanding unescaped !'s into the * last issued command where possible. */ - - char lastbang[128]; - int ! bangexp(str) char *str; { char bangbuf[BUFSIZ]; register char *cp, *cp2; register int n; int changed = 0; --- 100,112 ---- * Expand the shell escape by expanding unescaped !'s into the * last issued command where possible. */ int ! bangexp(str, strsize) char *str; + size_t strsize; { char bangbuf[BUFSIZ]; + static char lastbang[BUFSIZ]; register char *cp, *cp2; register int n; int changed = 0; *************** *** 141,151 **** } *cp2 = 0; if (changed) { ! printf("!%s\n", bangbuf); ! fflush(stdout); } ! strcpy(str, bangbuf); ! strncpy(lastbang, bangbuf, sizeof(lastbang) - 1); lastbang[sizeof(lastbang) - 1] = '\0'; return(0); } --- 141,152 ---- } *cp2 = 0; if (changed) { ! (void)printf("!%s\n", bangbuf); ! (void)fflush(stdout); } ! (void)strncpy(str, bangbuf, strsize - 1); ! str[strsize - 1] = '\0'; ! (void)strncpy(lastbang, bangbuf, sizeof(lastbang) - 1); lastbang[sizeof(lastbang) - 1] = '\0'; return(0); }