summaryrefslogtreecommitdiff
path: root/bin/ed/buf.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-10-09 19:47:03 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-10-09 19:47:03 +0000
commitcc33c08f54534b4e7946341bf432536e2b8dcb53 (patch)
treefec5e40ae015d0d32b214278080239f94b87c125 /bin/ed/buf.c
parent8594b981c567f80885e46649303e812f14ea6b08 (diff)
Mark static globals that are only used in their respective .c files.
Also make stdin unbuffered since that is the same as using a single-byte buffer. OK tobias@
Diffstat (limited to 'bin/ed/buf.c')
-rw-r--r--bin/ed/buf.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/bin/ed/buf.c b/bin/ed/buf.c
index ad1aa4ed94e..0482430d014 100644
--- a/bin/ed/buf.c
+++ b/bin/ed/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.21 2015/07/28 17:46:52 deraadt Exp $ */
+/* $OpenBSD: buf.c,v 1.22 2015/10/09 19:47:02 millert Exp $ */
/* $NetBSD: buf.c,v 1.15 1995/04/23 10:07:28 cgd Exp $ */
/* buf.c: This file contains the scratch-file buffer routines for the
@@ -34,10 +34,10 @@
#include "ed.h"
-FILE *sfp; /* scratch file pointer */
-off_t sfseek; /* scratch file position */
-int seek_write; /* seek before writing */
-line_t buffer_head; /* incore buffer */
+static FILE *sfp; /* scratch file pointer */
+static off_t sfseek; /* scratch file position */
+static int seek_write; /* seek before writing */
+static line_t buffer_head; /* incore buffer */
/* get_sbuf_line: get a line of text from the scratch file; return pointer
to the text */
@@ -190,7 +190,7 @@ get_addressed_line_node(int n)
extern int newline_added;
#define SCRATCH_TEMPLATE "/tmp/ed.XXXXXXXXXX"
-char sfn[sizeof(SCRATCH_TEMPLATE)+1] = ""; /* scratch file name */
+static char sfn[sizeof(SCRATCH_TEMPLATE)+1] = ""; /* scratch file name */
/* open_sbuf: open scratch file */
int
@@ -242,7 +242,7 @@ quit(int n)
}
-unsigned char ctab[256]; /* character translation table */
+static unsigned char ctab[256]; /* character translation table */
/* init_buffers: open scratch buffer; initialize line queue */
void
@@ -256,7 +256,7 @@ init_buffers(void)
!cat
hello, world
EOF */
- setbuffer(stdin, stdinbuf, 1);
+ setvbuf(stdin, NULL, _IONBF, 0);
if (open_sbuf() < 0)
quit(2);
REQUE(&buffer_head, &buffer_head);