diff options
author | steve <steve@FreeBSD.org> | 1997-04-28 03:11:52 +0000 |
---|---|---|
committer | steve <steve@FreeBSD.org> | 1997-04-28 03:11:52 +0000 |
commit | 6ce1ec6c045fe1db7bf425686506f2f2c227df87 (patch) | |
tree | ce44b6aff1a03d6c77cc93c76e2f2affe9a5e8f8 /bin/sh/input.c | |
parent | 101652d62132008837e3506320d3da66eda40f91 (diff) | |
download | FreeBSD-src-6ce1ec6c045fe1db7bf425686506f2f2c227df87.zip FreeBSD-src-6ce1ec6c045fe1db7bf425686506f2f2c227df87.tar.gz |
Nuke register keyword usage, rename pread to preadfd, and open
input files FD_CLOEXEC.
Obtained from: NetBSD
Diffstat (limited to 'bin/sh/input.c')
-rw-r--r-- | bin/sh/input.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/bin/sh/input.c b/bin/sh/input.c index b68e1ae..66f51f0 100644 --- a/bin/sh/input.c +++ b/bin/sh/input.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: input.c,v 1.9 1997/02/22 13:58:28 peter Exp $ */ #ifndef lint @@ -106,7 +106,7 @@ int whichprompt; /* 1 == PS1, 2 == PS2 */ EditLine *el; /* cookie for editline package */ STATIC void pushfile __P((void)); -static int pread __P((void)); +static int preadfd __P((void)); #ifdef mkinit INCLUDE "input.h" @@ -139,7 +139,7 @@ pfgets(line, len) char *line; int len; { - register char *p = line; + char *p = line; int nleft = len; int c; @@ -173,12 +173,13 @@ pgetc() static int -pread() +preadfd() { int nr; parsenextc = parsefile->buf; retry: +#ifndef NO_HISTORY if (parsefile->fd == 0 && el) { const char *rl_cp; @@ -189,9 +190,9 @@ retry: /* XXX - BUFSIZE should redesign so not necessary */ (void) strcpy(parsenextc, rl_cp); } - } else { + } else +#endif nr = read(parsefile->fd, parsenextc, BUFSIZ - 1); - } if (nr <= 0) { if (nr < 0) { @@ -244,7 +245,7 @@ preadbuffer() again: if (parselleft <= 0) { - if ((parselleft = pread()) == -1) { + if ((parselleft = preadfd()) == -1) { parselleft = parsenleft = EOF_NLEFT; return PEOF; } @@ -403,6 +404,7 @@ void setinputfd(fd, push) int fd, push; { + (void)fcntl(fd, F_SETFD, FD_CLOEXEC); if (push) { pushfile(); parsefile->buf = ckmalloc(BUFSIZ); |