summaryrefslogtreecommitdiffstats
path: root/bin/sh/input.c
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1996-12-14 06:20:03 +0000
committersteve <steve@FreeBSD.org>1996-12-14 06:20:03 +0000
commitc58aca035e2c61510b619368861598623eb95e52 (patch)
tree049d84189a59de29d49254b609a318b17ee59387 /bin/sh/input.c
parenta958416f1b4a022c358b94db0b8e6bcc6cb54ee0 (diff)
downloadFreeBSD-src-c58aca035e2c61510b619368861598623eb95e52.zip
FreeBSD-src-c58aca035e2c61510b619368861598623eb95e52.tar.gz
Merge in NetBSD mods and -Wall cleaning.
Obtained from: NetBSD, me
Diffstat (limited to 'bin/sh/input.c')
-rw-r--r--bin/sh/input.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/bin/sh/input.c b/bin/sh/input.c
index e1c530c..f8ca1da 100644
--- a/bin/sh/input.c
+++ b/bin/sh/input.c
@@ -33,11 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: input.c,v 1.5 1996/09/01 10:20:18 peter Exp $
+ * $Id: input.c,v 1.6 1996/09/03 14:15:50 peter Exp $
*/
#ifndef lint
-static char sccsid[] = "@(#)input.c 8.3 (Berkeley) 6/9/95";
+static char const sccsid[] = "@(#)input.c 8.3 (Berkeley) 6/9/95";
#endif /* not lint */
#include <stdio.h> /* defines BUFSIZ */
@@ -84,8 +84,8 @@ struct parsefile {
struct parsefile *prev; /* preceding file on stack */
int linno; /* current line */
int fd; /* file descriptor (or -1 if string) */
- int nleft; /* number of chars left in line */
- int lleft; /* number of lines left in buffer */
+ int nleft; /* number of chars left in this line */
+ int lleft; /* number of lines left in this buffer */
char *nextc; /* next char in buffer */
char *buf; /* input buffer */
struct strpush *strpush; /* for pushing strings at this level */
@@ -106,6 +106,7 @@ int whichprompt; /* 1 == PS1, 2 == PS2 */
EditLine *el; /* cookie for editline package */
STATIC void pushfile __P((void));
+static int pread __P((void));
#ifdef mkinit
INCLUDE "input.h"
@@ -165,16 +166,18 @@ pfgets(line, len)
*/
int
-pgetc() {
+pgetc()
+{
return pgetc_macro();
}
+
static int
pread()
{
int nr;
-
parsenextc = parsefile->buf;
+
retry:
if (parsefile->fd == 0 && el) {
const char *rl_cp;
@@ -184,9 +187,8 @@ retry:
nr = 0;
else {
/* XXX - BUFSIZE should redesign so not necessary */
- (void)strcpy(parsenextc, rl_cp);
+ (void) strcpy(parsenextc, rl_cp);
}
-
} else {
nr = read(parsefile->fd, parsenextc, BUFSIZ - 1);
}
@@ -206,7 +208,7 @@ retry:
}
}
}
- nr = -1;
+ nr = -1;
}
return nr;
}
@@ -217,12 +219,13 @@ retry:
* 1) If a string was pushed back on the input, pop it;
* 2) If an EOF was pushed back (parsenleft == EOF_NLEFT) or we are reading
* from a string so we can't refill the buffer, return EOF.
- * 3) If there is more in the buffer, use it; else call read to fill it.
- * 4) Process input up to next newline, deleting nul characters.
+ * 3) If there is more in this buffer, use it else call read to fill it.
+ * 4) Process input up to the next newline, deleting nul characters.
*/
int
-preadbuffer() {
+preadbuffer()
+{
char *p, *q;
int more;
int something;
OpenPOWER on IntegriCloud