version 1.7, 1997/07/14 00:24:25 |
version 1.8, 1997/07/30 06:32:38 |
|
|
char *shell; |
char *shell; |
char cmd[BUFSIZ]; |
char cmd[BUFSIZ]; |
|
|
(void)strcpy(cmd, str); |
(void)strncpy(cmd, str, sizeof(cmd) - 1); |
if (bangexp(cmd) < 0) |
cmd[sizeof(cmd) - 1] = '\0'; |
|
if (bangexp(cmd, sizeof(cmd)) < 0) |
return(1); |
return(1); |
if ((shell = value("SHELL")) == NULL) |
if ((shell = value("SHELL")) == NULL) |
shell = _PATH_CSHELL; |
shell = _PATH_CSHELL; |
|
|
* Expand the shell escape by expanding unescaped !'s into the |
* Expand the shell escape by expanding unescaped !'s into the |
* last issued command where possible. |
* last issued command where possible. |
*/ |
*/ |
|
|
char lastbang[128]; |
|
|
|
int |
int |
bangexp(str) |
bangexp(str, strsize) |
char *str; |
char *str; |
|
size_t strsize; |
{ |
{ |
char bangbuf[BUFSIZ]; |
char bangbuf[BUFSIZ]; |
|
static char lastbang[BUFSIZ]; |
register char *cp, *cp2; |
register char *cp, *cp2; |
register int n; |
register int n; |
int changed = 0; |
int changed = 0; |
|
|
} |
} |
*cp2 = 0; |
*cp2 = 0; |
if (changed) { |
if (changed) { |
printf("!%s\n", bangbuf); |
(void)printf("!%s\n", bangbuf); |
fflush(stdout); |
(void)fflush(stdout); |
} |
} |
strcpy(str, bangbuf); |
(void)strncpy(str, bangbuf, strsize - 1); |
strncpy(lastbang, bangbuf, sizeof(lastbang) - 1); |
str[strsize - 1] = '\0'; |
|
(void)strncpy(lastbang, bangbuf, sizeof(lastbang) - 1); |
lastbang[sizeof(lastbang) - 1] = '\0'; |
lastbang[sizeof(lastbang) - 1] = '\0'; |
return(0); |
return(0); |
} |
} |