summaryrefslogtreecommitdiff
path: root/usr/src/lib/libbc/libc/stdio/common
diff options
context:
space:
mode:
authormuffin <none@none>2005-10-20 11:47:44 -0700
committermuffin <none@none>2005-10-20 11:47:44 -0700
commit5d54f3d8999eac1762fe0a8c7177d20f1f201fae (patch)
tree65c7761c305dbd97609e64517f5781b433efa980 /usr/src/lib/libbc/libc/stdio/common
parent1b42782e10f177b2bd092559506a96dbbefefa54 (diff)
downloadillumos-joyent-5d54f3d8999eac1762fe0a8c7177d20f1f201fae.tar.gz
6309237 gcc and libbc don't get along
Diffstat (limited to 'usr/src/lib/libbc/libc/stdio/common')
-rw-r--r--usr/src/lib/libbc/libc/stdio/common/doprnt.c79
-rw-r--r--usr/src/lib/libbc/libc/stdio/common/doscan.c58
-rw-r--r--usr/src/lib/libbc/libc/stdio/common/findiop.c34
-rw-r--r--usr/src/lib/libbc/libc/stdio/common/fputs.c28
-rw-r--r--usr/src/lib/libbc/libc/stdio/common/fread.c14
-rw-r--r--usr/src/lib/libbc/libc/stdio/common/gets.c10
-rw-r--r--usr/src/lib/libbc/libc/stdio/common/scanf.c82
-rw-r--r--usr/src/lib/libbc/libc/stdio/common/setbuffer.c27
8 files changed, 154 insertions, 178 deletions
diff --git a/usr/src/lib/libbc/libc/stdio/common/doprnt.c b/usr/src/lib/libbc/libc/stdio/common/doprnt.c
index cc7324534c..eb5e3438cd 100644
--- a/usr/src/lib/libbc/libc/stdio/common/doprnt.c
+++ b/usr/src/lib/libbc/libc/stdio/common/doprnt.c
@@ -20,8 +20,8 @@
* CDDL HEADER END
*/
/*
- * Copyright (c) 1988-1995, by Sun Microsystems, Inc.
- * All rights reserved
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
@@ -41,7 +41,7 @@
#include <stdio.h>
#include <ctype.h>
-#include <varargs.h>
+#include <stdarg.h>
#include <values.h>
#include <locale.h>
#include "doprnt.h"
@@ -63,13 +63,8 @@
extern void _fourdigitsquick();
#endif
-void _mkarglst();
-void _getarg();
-static char *_check_dol();
-
-
#define emitchar(c) { if (--filecnt < 0) { \
- register FILE *iop = file; \
+ FILE *iop = file; \
if (((iop->_flag & (_IOLBF|_IONBF)) == 0 \
|| -filecnt >= iop->_bufsiz)) { \
iop->_ptr = fileptr; \
@@ -99,27 +94,29 @@ typedef struct stva_list {
va_list ap;
} stva_list;
-_doprnt(format, in_args, file)
- char *format;
- va_list in_args;
- FILE *file;
+void _mkarglst(char *, stva_list, stva_list []);
+void _getarg(char *, stva_list *, int);
+static char *_check_dol(char *, int *);
+
+int
+_doprnt(char *format, va_list in_args, FILE *file)
{
char convertbuffer[1024] ;
/* Current position in format */
- register char *cp;
+ char *cp;
/* Starting and ending points for value to be printed */
- register char *bp;
+ char *bp;
char *p;
/* Pointer and count for I/O buffer */
- register unsigned char *fileptr;
- register int filecnt;
+ unsigned char *fileptr;
+ int filecnt;
/* Field width and precision */
int width;
- register int prec;
+ int prec;
/* Format code */
char fcode;
@@ -177,15 +174,15 @@ _doprnt(format, in_args, file)
/* The value being converted, if integer */
- register unsigned long val;
+ unsigned long val;
/* Work variables */
- register int n;
- register char c;
+ int n;
+ char c;
char radix;
int svswitch = 0;
/* count of output characters */
- register int count;
+ int count;
/* variables for positional parameters */
char *sformat = format; /* save the beginning of the format */
@@ -285,7 +282,7 @@ _doprnt(format, in_args, file)
val = va_arg(args.ap, unsigned);
udcommon:
{
- register char *stringp = lowerhex;
+ char *stringp = lowerhex;
bp = buf+MAXDIGS;
stringp = lowerhex;
do {
@@ -297,7 +294,7 @@ _doprnt(format, in_args, file)
case 'X':
{
- register char *stringp = upperhex;
+ char *stringp = upperhex;
val = va_arg(args.ap, unsigned);
bp = buf + MAXDIGS;
if (val == 0)
@@ -312,7 +309,7 @@ _doprnt(format, in_args, file)
case 'x':
case 'p':
{
- register char *stringp = lowerhex;
+ char *stringp = lowerhex;
val = va_arg(args.ap, unsigned);
bp = buf + MAXDIGS;
if (val == 0)
@@ -327,7 +324,7 @@ _doprnt(format, in_args, file)
case 'O':
case 'o':
{
- register char *stringp = lowerhex;
+ char *stringp = lowerhex;
val = va_arg(args.ap, unsigned);
bp = buf + MAXDIGS;
if (val == 0)
@@ -613,7 +610,7 @@ _doprnt(format, in_args, file)
}
/* Set translate table for digits */
{
- register char *stringp;
+ char *stringp;
if (fcode == 'X')
stringp = upperhex;
else
@@ -674,7 +671,7 @@ _doprnt(format, in_args, file)
break;
#if FLOAT
-#ifdef sparc
+#if defined(__sparc)
#define GETQVAL /* Sun-4 macro to get a quad q from the argument list, passed as a pointer. */ \
{ qval = *(va_arg(args.ap, quadruple*)) ; }
#else
@@ -717,7 +714,7 @@ _doprnt(format, in_args, file)
goto ebreak ;
}
{
- register char *stringp;
+ char *stringp;
/* Place the first digit in the buffer */
stringp = &buf[0];
*stringp++ = *bp != '\0'? *bp++: '0';
@@ -807,7 +804,7 @@ ebreak:
goto fbreak ;
}
{
- register char *stringp;
+ char *stringp;
/* Initialize buffer pointer */
stringp = &buf[0];
@@ -1000,7 +997,7 @@ out:
return (ferror(file)? EOF: count);
}
-#ifdef sparc
+#if defined(__sparc)
/*
* We use "double *" instead of "quadruple *" to skip over the pointer to
* long double on the argument list since a pointer is a pointer after all.
@@ -1015,13 +1012,12 @@ out:
(void) va_arg(args.ap, unsigned long); \
}
#endif
-/* This function initializes arglst, to contain the appropriate va_list values
- * for the first MAXARGS arguments. */
+/*
+ * This function initializes arglst, to contain the appropriate va_list values
+ * for the first MAXARGS arguments.
+ */
void
-_mkarglst(fmt, args, arglst)
-char *fmt;
-stva_list args;
-stva_list arglst[];
+_mkarglst(char *fmt, stva_list args, stva_list arglst[])
{
static char *digits = "01234567890", *skips = "# +-.0123456789h$";
@@ -1152,10 +1148,7 @@ stva_list arglst[];
* pargs is assumed to contain the value of arglst[MAXARGS - 1].
*/
void
-_getarg(fmt, pargs, argno)
-char *fmt;
-stva_list *pargs;
-int argno;
+_getarg(char *fmt, stva_list *pargs, int argno)
{
static char *digits = "01234567890", *skips = "# +-.0123456789h$";
int i, n, curargno, flags;
@@ -1256,9 +1249,7 @@ int argno;
* parse a string, mini parse
*/
static char *
-_check_dol(s, val)
- char *s;
- int *val;
+_check_dol(char *s, int *val)
{
char *os; /* save old string */
int tmp_val = 0;
diff --git a/usr/src/lib/libbc/libc/stdio/common/doscan.c b/usr/src/lib/libbc/libc/stdio/common/doscan.c
index 45ba3cb308..08cc3ff215 100644
--- a/usr/src/lib/libbc/libc/stdio/common/doscan.c
+++ b/usr/src/lib/libbc/libc/stdio/common/doscan.c
@@ -20,31 +20,34 @@
* CDDL HEADER END
*/
/*
- * Copyright (c) 1988-1995, by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
+#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdio.h>
#include <ctype.h>
-#include <varargs.h>
+#include <stdarg.h>
#include <values.h>
#include <floatingpoint.h>
#include <errno.h>
+#include <memory.h>
#define NCHARS (1 << BITSPERBYTE)
#define locgetc() (chcount+=1,getc(iop))
#define locungetc(x) (chcount-=1,ungetc(x,iop))
-extern char *memset();
static int chcount,flag_eof;
+static int number(int, int, int, int, FILE *, va_list *);
+static int string(int, int, int, char *, FILE *, va_list *);
+static unsigned char *setup(unsigned char *, char *);
+
#ifdef S5EMUL
#define isws(c) isspace(c)
#else
@@ -77,14 +80,10 @@ static char _sptab[1+256] = {
#endif
int
-_doscan(iop, fmt, va_alist)
-register FILE *iop;
-register unsigned char *fmt;
-va_list va_alist;
+_doscan(FILE *iop, unsigned char *fmt, va_list va_alist)
{
- extern unsigned char *setup();
char tab[NCHARS];
- register int ch;
+ int ch;
int nmatch = 0, len, inchar, stow, size;
chcount=0; flag_eof=0;
@@ -193,19 +192,18 @@ out:
return (nmatch != 0 ? nmatch : EOF); /* end of input */
}
-/***************************************************************
+/*
+ **************************************************************
* Functions to read the input stream in an attempt to match incoming
* data to the current pattern from the main loop of _doscan().
- ***************************************************************/
+ **************************************************************
+ */
static int
-number(stow, type, len, size, iop, listp)
-int stow, type, len, size;
-register FILE *iop;
-va_list *listp;
+number(int stow, int type, int len, int size, FILE *iop, va_list *listp)
{
char numbuf[64], inchar, lookahead;
- register char *np = numbuf;
- register int c, base;
+ char *np = numbuf;
+ int c, base;
int digitseen = 0, floater = 0, negflg = 0;
long lcval = 0;
switch(type)
@@ -355,7 +353,7 @@ va_list *listp;
}
if (isdigit(c))
{
- register int digit;
+ int digit;
digit = c - '0';
if (base == 8)
{
@@ -381,7 +379,7 @@ va_list *listp;
}
else if (base == 16 && isxdigit(c))
{
- register int digit;
+ int digit;
digit = c - (isupper(c) ? 'A' - 10 : 'a' - 10);
if (stow)
lcval = (lcval<<4) + digit;
@@ -413,14 +411,10 @@ va_list *listp;
}
static int
-string(stow, type, len, tab, iop, listp)
-register int stow, type, len;
-register char *tab;
-register FILE *iop;
-va_list *listp;
+string(int stow, int type, int len, char *tab, FILE *iop, va_list *listp)
{
- register int ch;
- register char *ptr;
+ int ch;
+ char *ptr;
char *start;
start = ptr = stow ? va_arg(*listp, char *) : NULL;
@@ -480,11 +474,9 @@ va_list *listp;
}
static unsigned char *
-setup(fmt, tab)
-register unsigned char *fmt;
-register char *tab;
+setup(unsigned char *fmt, char *tab)
{
- register int b, c, d, t = 0;
+ int b, c, d, t = 0;
if (*fmt == '^')
{
diff --git a/usr/src/lib/libbc/libc/stdio/common/findiop.c b/usr/src/lib/libbc/libc/stdio/common/findiop.c
index a8175927f0..b038b0bc8d 100644
--- a/usr/src/lib/libbc/libc/stdio/common/findiop.c
+++ b/usr/src/lib/libbc/libc/stdio/common/findiop.c
@@ -27,17 +27,16 @@
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 1.2 */
+#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdio.h>
#include <errno.h>
+#include <malloc.h>
#include "iob.h"
#define active(iop) ((iop)->_flag & (_IOREAD|_IOWRT|_IORW))
-extern char *calloc();
-
static unsigned char sbuf[NSTATIC][_SBFSIZ];
unsigned char (*_smbuf)[_SBFSIZ] = sbuf;
static FILE **iobglue;
@@ -53,10 +52,10 @@ static FILE **endglue;
* the old and new FILE entries, which are then no longer contiguous.
*/
FILE *
-_findiop()
+_findiop(void)
{
- register FILE **iov, *iop;
- register FILE *fp;
+ FILE **iov, *iop;
+ FILE *fp;
if(iobglue == NULL) {
for(iop = _iob; iop < _iob + NSTATIC; iop++)
@@ -82,11 +81,12 @@ _findiop()
return(*iov);
}
-_f_morefiles()
+int
+_f_morefiles(void)
{
- register FILE **iov;
- register FILE *fp;
- register unsigned char *cp;
+ FILE **iov;
+ FILE *fp;
+ unsigned char *cp;
int nfiles;
nfiles = getdtablesize();
@@ -109,10 +109,11 @@ _f_morefiles()
return(1);
}
-f_prealloc()
+void
+f_prealloc(void)
{
- register FILE **iov;
- register FILE *fp;
+ FILE **iov;
+ FILE *fp;
if(iobglue == NULL && _f_morefiles() == 0)
return;
@@ -123,11 +124,10 @@ f_prealloc()
}
void
-_fwalk(function)
-register int (*function)();
+_fwalk(int (*function)(FILE *))
{
- register FILE **iov;
- register FILE *fp;
+ FILE **iov;
+ FILE *fp;
if(function == NULL)
return;
diff --git a/usr/src/lib/libbc/libc/stdio/common/fputs.c b/usr/src/lib/libbc/libc/stdio/common/fputs.c
index a18ba04b12..c91c890f85 100644
--- a/usr/src/lib/libbc/libc/stdio/common/fputs.c
+++ b/usr/src/lib/libbc/libc/stdio/common/fputs.c
@@ -20,8 +20,8 @@
* CDDL HEADER END
*/
/*
- * Copyright (c) 1995, by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 1995 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
/* Copyright (c) 1984 AT&T */
@@ -39,25 +39,23 @@
#include <stdio.h>
#include "stdiom.h"
#include <errno.h>
+#include <memory.h>
-extern char *memccpy();
-static char *memnulccpy();
+static char *memnulccpy(char *, char *, int, int);
int
-fputs(ptr, iop)
-char *ptr;
-register FILE *iop;
+fputs(char *ptr, FILE *iop)
{
- register int ndone = 0, n;
- register unsigned char *cptr, *bufend;
- register char *p;
- register char c;
+ int ndone = 0, n;
+ unsigned char *cptr, *bufend;
+ char *p;
+ char c;
if (_WRTCHK(iop)) {
iop->_flag |= _IOERR;
#ifdef POSIX
errno = EBADF;
-#endif POSIX
+#endif /* POSIX */
return (EOF);
}
bufend = iop->_base + iop->_bufsiz;
@@ -131,11 +129,9 @@ register FILE *iop;
* or NULL if c or NUL is not found in the first n bytes.
*/
static char *
-memnulccpy(s1, s2, c, n)
-register char *s1, *s2;
-register int c, n;
+memnulccpy(char *s1, char *s2, int c, int n)
{
- register int cmoved;
+ int cmoved;
while (--n >= 0) {
cmoved = *s2++;
diff --git a/usr/src/lib/libbc/libc/stdio/common/fread.c b/usr/src/lib/libbc/libc/stdio/common/fread.c
index c195690c5f..0a0aeea727 100644
--- a/usr/src/lib/libbc/libc/stdio/common/fread.c
+++ b/usr/src/lib/libbc/libc/stdio/common/fread.c
@@ -27,7 +27,7 @@
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 3.11 */
+#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
/*
@@ -37,21 +37,17 @@
*/
#include <stdio.h>
#include "stdiom.h"
+#include <memory.h>
#define MIN(x, y) (x < y ? x : y)
extern int _filbuf();
-extern _bufsync();
-extern char *memcpy();
int
-fread(ptr, size, count, iop)
-char *ptr;
-int size, count;
-register FILE *iop;
+fread(char *ptr, int size, int count, FILE *iop)
{
- register unsigned int nleft;
- register int n;
+ unsigned int nleft;
+ int n;
if (size <= 0 || count <= 0) return 0;
nleft = count * size;
diff --git a/usr/src/lib/libbc/libc/stdio/common/gets.c b/usr/src/lib/libbc/libc/stdio/common/gets.c
index 3cf3a49af6..a78346dbab 100644
--- a/usr/src/lib/libbc/libc/stdio/common/gets.c
+++ b/usr/src/lib/libbc/libc/stdio/common/gets.c
@@ -22,7 +22,7 @@
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI" /* from S5R2 3.3 */
+#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
/*
@@ -32,17 +32,15 @@
*/
#include <stdio.h>
#include "stdiom.h"
+#include <memory.h>
extern int _filbuf();
-extern _bufsync();
-extern char *memccpy();
char *
-gets(ptr)
-char *ptr;
+gets(char *ptr)
{
char *p, *ptr0 = ptr;
- register int n;
+ int n;
for ( ; ; ) {
if (stdin->_cnt <= 0) { /* empty buffer */
diff --git a/usr/src/lib/libbc/libc/stdio/common/scanf.c b/usr/src/lib/libbc/libc/stdio/common/scanf.c
index 0a54f708d4..e024fb7c4f 100644
--- a/usr/src/lib/libbc/libc/stdio/common/scanf.c
+++ b/usr/src/lib/libbc/libc/stdio/common/scanf.c
@@ -19,9 +19,9 @@
*
* CDDL HEADER END
*/
-/*
- * Copyright (c) 1995, by Sun Microsystems, Inc.
- * All rights reserved.
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
/* Copyright (c) 1984 AT&T */
@@ -32,8 +32,10 @@
/*LINTLIBRARY*/
#include <stdio.h>
#include <ctype.h>
-#include <varargs.h>
+#include <stdarg.h>
#include <errno.h>
+#include <string.h>
+#include <malloc.h>
#define ON 1
#define OFF 0
@@ -41,99 +43,106 @@
#define ARGMAX 64
static unsigned char newap[ARGMAX * sizeof(double)];
static unsigned char newform[256];
-extern char *strcpy();
-extern char *malloc();
extern int _doscan();
-static int format_arg();
-/*VARARGS1*/
+static int format_arg(unsigned char *, unsigned char *, unsigned char *);
+
int
-scanf(fmt, va_alist)
-char *fmt;
-va_dcl
+scanf(char *fmt, ...)
{
va_list ap;
char *nf;
int ret_val;
+
- va_start(ap);
+ va_start(ap, fmt);
if (strlen(fmt) >= sizeof(newform)) {
nf = malloc(strlen(fmt)+1);
- if (format_arg(strcpy(nf, fmt), ap, newap) == ON) {
+ if (format_arg((unsigned char *)strcpy(nf, fmt), ap, newap)
+ == ON) {
+ va_end(ap);
ret_val = _doscan(stdin, nf, newap);
free(nf);
return(ret_val);
}
free(nf);
- } else if (format_arg(strcpy(newform, fmt), ap, newap) == ON) {
+ } else if (format_arg((unsigned char *)strcpy(newform, fmt), ap, newap)
+ == ON) {
+ va_end(ap);
return(_doscan(stdin, newform, newap));
}
- return(_doscan(stdin, fmt, ap));
+ ret_val = _doscan(stdin, fmt, ap);
+ va_end(ap);
+ return (ret_val);
}
-/*VARARGS2*/
int
-fscanf(iop, fmt, va_alist)
-FILE *iop;
-char *fmt;
-va_dcl
+fscanf(FILE *iop, char *fmt, ...)
{
va_list ap;
char *nf;
int ret_val;
- va_start(ap);
#ifdef POSIX
if ( !(iop->_flag & (_IOREAD|_IORW)) ) {
iop->_flag |= _IOERR;
errno = EBADF;
return (EOF);
}
-#endif POSIX
+#endif /* POSIX */
+ va_start(ap, fmt);
if (strlen(fmt) >= sizeof(newform)) {
nf = malloc(strlen(fmt)+1);
- if (format_arg(strcpy(nf, fmt), ap, newap) == ON) {
+ if (format_arg((unsigned char *)strcpy(nf, fmt), ap, newap)
+ == ON) {
+ va_end(ap);
ret_val = _doscan(stdin, nf, newap);
free(nf);
return(ret_val);
}
free(nf);
- } else if (format_arg(strcpy(newform, fmt), ap, newap) == ON) {
+ } else if (format_arg((unsigned char *)strcpy(newform, fmt), ap, newap)
+ == ON) {
+ va_end(ap);
return(_doscan(iop, newform, newap));
}
- return(_doscan(iop, fmt, ap));
+ ret_val = _doscan(iop, fmt, ap);
+ va_end(ap);
+ return (ret_val);
}
-/*VARARGS2*/
int
-sscanf(str, fmt, va_alist)
-register char *str;
-char *fmt;
-va_dcl
+sscanf(char *str, char *fmt, ...)
{
va_list ap;
FILE strbuf;
char *nf;
int ret_val;
- va_start(ap);
+ va_start(ap, fmt);
strbuf._flag = _IOREAD|_IOSTRG;
strbuf._ptr = strbuf._base = (unsigned char*)str;
strbuf._cnt = strlen(str);
strbuf._bufsiz = strbuf._cnt;
if (strlen(fmt) >= sizeof(newform)) {
nf = malloc(strlen(fmt)+1);
- if (format_arg(strcpy(nf, fmt), ap, newap) == ON) {
+ if (format_arg((unsigned char *)strcpy(nf, fmt), ap, newap)
+ == ON) {
+ va_end(ap);
ret_val = _doscan(stdin, nf, newap);
free(nf);
return(ret_val);
}
free(nf);
- } else if (format_arg(strcpy(newform, fmt), ap, newap) == ON) {
+ } else if (format_arg((unsigned char *)strcpy(newform, fmt), ap, newap)
+ == ON) {
+ va_end(ap);
return(_doscan(&strbuf, newform, newap));
}
- return(_doscan(&strbuf, fmt, ap));
+ ret_val = _doscan(&strbuf, fmt, ap);
+ va_end(ap);
+ return (ret_val);
}
/*
@@ -153,11 +162,10 @@ struct al {
};
static int
-format_arg(format, list, newlist)
-unsigned char *format, *list, *newlist;
+format_arg(unsigned char *format, unsigned char *list, unsigned char *newlist)
{
unsigned char *aptr, *bptr, *cptr;
- register i, fcode, nl_fmt, num, length, j;
+ int i, fcode, nl_fmt, num, length, j;
unsigned char *fmtsav;
struct al args[ARGMAX + 1];
diff --git a/usr/src/lib/libbc/libc/stdio/common/setbuffer.c b/usr/src/lib/libbc/libc/stdio/common/setbuffer.c
index 5b8ffb2aca..dd1afa49d9 100644
--- a/usr/src/lib/libbc/libc/stdio/common/setbuffer.c
+++ b/usr/src/lib/libbc/libc/stdio/common/setbuffer.c
@@ -34,23 +34,18 @@
* contributors.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
- /* from UCB 4.2 83/02/27 */
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
+#include <malloc.h>
+#include <unistd.h>
-extern void free();
-extern int isatty();
extern unsigned char (*_smbuf)[_SBFSIZ];
-extern void _getsmbuf();
void
-setbuffer(iop, buf, size)
- register FILE *iop;
- char *buf;
- int size;
+setbuffer(FILE *iop, char *buf, int size)
{
- register int fno = fileno(iop); /* file number */
+ int fno = fileno(iop); /* file number */
if (iop->_base != NULL && iop->_flag&_IOMYBUF)
free((char *)iop->_base);
@@ -73,17 +68,17 @@ setbuffer(iop, buf, size)
/*
* set line buffering
*/
-setlinebuf(iop)
- register FILE *iop;
+int
+setlinebuf(FILE *iop)
{
- register unsigned char *buf;
- extern char *malloc();
+ char *buf;
fflush(iop);
- setbuffer(iop, (unsigned char *)NULL, 0);
- buf = (unsigned char *)malloc(128);
+ setbuffer(iop, NULL, 0);
+ buf = (char *)malloc(128);
if (buf != NULL) {
setbuffer(iop, buf, 128);
iop->_flag |= _IOLBF|_IOMYBUF;
}
+ return (0);
}