* Copyright (c) 1992 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Rodney Ruddock of the University of Guelph.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)bang.c 5.3 (Berkeley) %G%";
* Execute a command in sh (and always sh). For those wondering the
* proper name for '!' _is_ bang.
static int l_cnt_last_pos
; /* "!!", l_shellcmd offset */
static char l_shellcmd
[FILENAME_LEN
]; /* "!!" */
int l_cnt
= 0, l_esc
= 0;
if ((ss
== '\\') && (l_esc
== 0)) {
if ((ss
== '\n') || (ss
== EOF
)) {
strcpy(help_msg
, "no shell command given");
l_shellcmd
[l_cnt
] = '\0';
if ((ss
== '!') && (l_esc
== 0))
if ((ss
== '%') && (l_esc
== 0)) {
l_shellcmd
[l_cnt
] = '\0';
strlen(filename_current
);
l_shellcmd
[l_cnt
++] = ss
;
if (l_cnt
>= FILENAME_LEN
) {
strcpy(help_msg
, "shell command too long");
if (explain_flag
!= 0) /* for the -s option */