summaryrefslogtreecommitdiff
path: root/bin/ksh/io.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-12-20 11:34:27 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-12-20 11:34:27 +0000
commite445c3ad8a040ce5aa9ffd47e72de71f7cd3dd16 (patch)
treef321abeceffdba61fb97e64b666e8793cf6e1d4e /bin/ksh/io.c
parentc6e78b160bb0e446bb146be6b8b66890b48e5b31 (diff)
Ansification plus some minor knf. No binary change on i386 and
sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
Diffstat (limited to 'bin/ksh/io.c')
-rw-r--r--bin/ksh/io.c63
1 files changed, 19 insertions, 44 deletions
diff --git a/bin/ksh/io.c b/bin/ksh/io.c
index 4ba9d638718..12e9c120935 100644
--- a/bin/ksh/io.c
+++ b/bin/ksh/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.17 2004/12/18 22:35:41 millert Exp $ */
+/* $OpenBSD: io.c,v 1.18 2004/12/20 11:34:26 otto Exp $ */
/*
* shell buffered IO and formatted output
@@ -100,8 +100,7 @@ internal_errorf(int jump, const char *fmt, ...)
/* used by error reporting functions to print "ksh: .kshrc[25]: " */
void
-error_prefix(fileline)
- int fileline;
+error_prefix(int fileline)
{
/* Avoid foo: foo[2]: ... */
if (!fileline || !source || !source->file
@@ -145,7 +144,7 @@ shprintf(const char *fmt, ...)
static struct shf *kshdebug_shf;
void
-kshdebug_init_()
+kshdebug_init_(void)
{
if (kshdebug_shf)
shf_close(kshdebug_shf);
@@ -174,10 +173,7 @@ kshdebug_printf_(const char *fmt, ...)
}
void
-kshdebug_dump_(str, mem, nbytes)
- const char *str;
- const void *mem;
- int nbytes;
+kshdebug_dump_(const char *str, const void *mem, int nbytes)
{
int i, j;
int nprow = 16;
@@ -200,8 +196,7 @@ kshdebug_dump_(str, mem, nbytes)
/* test if we can seek backwards fd (returns 0 or SHF_UNBUF) */
int
-can_seek(fd)
- int fd;
+can_seek(int fd)
{
struct stat statb;
@@ -212,7 +207,7 @@ can_seek(fd)
struct shf shf_iob[3];
void
-initio()
+initio(void)
{
shf_fdopen(1, SHF_WR, shl_stdout); /* force buffer allocation */
shf_fdopen(2, SHF_WR, shl_out);
@@ -223,10 +218,7 @@ initio()
/* A dup2() with error checking */
int
-ksh_dup2(ofd, nfd, errok)
- int ofd;
- int nfd;
- int errok;
+ksh_dup2(int ofd, int nfd, int errok)
{
int ret = dup2(ofd, nfd);
@@ -241,9 +233,7 @@ ksh_dup2(ofd, nfd, errok)
* set close-on-exec flag.
*/
int
-savefd(fd, noclose)
- int fd;
- int noclose;
+savefd(int fd, int noclose)
{
int nfd;
@@ -264,8 +254,7 @@ savefd(fd, noclose)
}
void
-restfd(fd, ofd)
- int fd, ofd;
+restfd(int fd, int ofd)
{
if (fd == 2)
shf_flush(&shf_iob[fd]);
@@ -278,8 +267,7 @@ restfd(fd, ofd)
}
void
-openpipe(pv)
- int *pv;
+openpipe(int *pv)
{
if (pipe(pv) < 0)
errorf("can't create pipe - try again");
@@ -288,8 +276,7 @@ openpipe(pv)
}
void
-closepipe(pv)
- int *pv;
+closepipe(int *pv)
{
close(pv[0]);
close(pv[1]);
@@ -299,10 +286,7 @@ closepipe(pv)
* a string (the X in 2>&X, read -uX, print -uX) into a file descriptor.
*/
int
-check_fd(name, mode, emsgp)
- char *name;
- int mode;
- const char **emsgp;
+check_fd(char *name, int mode, const char **emsgp)
{
int fd, fl;
@@ -338,7 +322,7 @@ check_fd(name, mode, emsgp)
/* Called once from main */
void
-coproc_init()
+coproc_init(void)
{
coproc.read = coproc.readw = coproc.write = -1;
coproc.njobs = 0;
@@ -347,8 +331,7 @@ coproc_init()
/* Called by c_read() when eof is read - close fd if it is the co-process fd */
void
-coproc_read_close(fd)
- int fd;
+coproc_read_close(int fd)
{
if (coproc.read >= 0 && fd == coproc.read) {
coproc_readw_close(fd);
@@ -361,8 +344,7 @@ coproc_read_close(fd)
* read pipe, so reads will actually terminate.
*/
void
-coproc_readw_close(fd)
- int fd;
+coproc_readw_close(int fd)
{
if (coproc.readw >= 0 && coproc.read >= 0 && fd == coproc.read) {
close(coproc.readw);
@@ -374,8 +356,7 @@ coproc_readw_close(fd)
* when co-process input is dup'd
*/
void
-coproc_write_close(fd)
- int fd;
+coproc_write_close(int fd)
{
if (coproc.write >= 0 && fd == coproc.write) {
close(coproc.write);
@@ -387,9 +368,7 @@ coproc_write_close(fd)
* (Used by check_fd() and by c_read/c_print to deal with -p option).
*/
int
-coproc_getfd(mode, emsgp)
- int mode;
- const char **emsgp;
+coproc_getfd(int mode, const char **emsgp)
{
int fd = (mode & R_OK) ? coproc.read : coproc.write;
@@ -404,8 +383,7 @@ coproc_getfd(mode, emsgp)
* Should be called with SIGCHLD blocked.
*/
void
-coproc_cleanup(reuse)
- int reuse;
+coproc_cleanup(int reuse)
{
/* This to allow co-processes to share output pipe */
if (!reuse || coproc.readw < 0 || coproc.read < 0) {
@@ -430,10 +408,7 @@ coproc_cleanup(reuse)
*/
struct temp *
-maketemp(ap, type, tlist)
- Area *ap;
- Temp_type type;
- struct temp **tlist;
+maketemp(Area *ap, Temp_type type, struct temp **tlist)
{
static unsigned int inc;
struct temp *tp;