improved layout

This commit is contained in:
ceriel 1988-04-25 16:17:29 +00:00
parent 6607dc999e
commit 71dd29ae30
6 changed files with 63 additions and 49 deletions

View file

@ -5,15 +5,16 @@
fprintf(va_alist) fprintf(va_alist)
va_dcl va_dcl
{ {
FILE *file;
char *fmt;
va_list ap; va_list ap;
va_start(ap); va_start(ap);
file = va_arg(ap, FILE *); {
fmt = va_arg(ap, char *); FILE *file = va_arg(ap, FILE *);
char *fmt = va_arg(ap, char *);
_doprnt (fmt, ap, file); _doprnt (fmt, ap, file);
if ( io_testflag(file,IO_PERPRINTF) ) if ( io_testflag(file,IO_PERPRINTF) )
fflush(file); fflush(file);
}
va_end(ap); va_end(ap);
} }

View file

@ -5,16 +5,18 @@
int fscanf(va_alist) int fscanf(va_alist)
va_dcl va_dcl
{ {
FILE *fp;
char *format;
va_list ap; va_list ap;
int retval; int retval;
va_start(ap); va_start(ap);
fp = va_arg(ap, FILE *); {
format = va_arg(ap, char *); FILE *fp = va_arg(ap, FILE *);
char *format = va_arg(ap, char *);
retval = _doscanf (fp, format, ap); retval = _doscanf (fp, format, ap);
}
va_end(ap); va_end(ap);
return retval; return retval;
} }

View file

@ -5,13 +5,15 @@
printf(va_alist) printf(va_alist)
va_dcl va_dcl
{ {
char *fmt;
va_list ap; va_list ap;
va_start(ap); va_start(ap);
fmt = va_arg(ap, char *); {
char *fmt = va_arg(ap, char *);
_doprnt (fmt, ap, stdout); _doprnt (fmt, ap, stdout);
if ( io_testflag(stdout,IO_PERPRINTF) ) if ( io_testflag(stdout,IO_PERPRINTF) )
fflush(stdout); fflush(stdout);
}
va_end(ap); va_end(ap);
} }

View file

@ -5,14 +5,17 @@
int scanf(va_alist) int scanf(va_alist)
va_dcl va_dcl
{ {
char *format;
va_list ap; va_list ap;
int retval; int retval;
va_start(ap); va_start(ap);
format = va_arg(ap, char *); {
char *format = va_arg(ap, char *);
retval = _doscanf (stdin, format, ap); retval = _doscanf (stdin, format, ap);
}
va_end(ap); va_end(ap);
return retval; return retval;
} }

View file

@ -5,13 +5,16 @@
char *sprintf(va_alist) char *sprintf(va_alist)
va_dcl va_dcl
{ {
char *buf, *format;
FILE _tempfile;
va_list ap; va_list ap;
char *retval;
va_start(ap); va_start(ap);
buf = va_arg(ap, char *); {
format = va_arg(ap, char *); char *buf = va_arg(ap, char *);
char *format = va_arg(ap, char *);
FILE _tempfile;
retval = buf;
_tempfile._fd = -1; _tempfile._fd = -1;
_tempfile._flags = IO_WRITEMODE + IO_UNBUFF; _tempfile._flags = IO_WRITEMODE + IO_UNBUFF;
_tempfile._buf = (unsigned char *) buf; _tempfile._buf = (unsigned char *) buf;
@ -20,7 +23,8 @@ va_dcl
_doprnt(format, ap, &_tempfile); _doprnt(format, ap, &_tempfile);
putc('\0',&_tempfile); putc('\0',&_tempfile);
}
va_end(ap); va_end(ap);
return buf;
return retval;
} }

View file

@ -5,15 +5,15 @@
int sscanf(va_alist) int sscanf(va_alist)
va_dcl va_dcl
{ {
char *string; /* source of data */
char *format; /* control string */
FILE _tempfile;
va_list ap; va_list ap;
int retval; int retval;
va_start(ap); va_start(ap);
string = va_arg(ap, char *); {
format = va_arg(ap, char *); char *string = va_arg(ap, char *);
char *format = va_arg(ap, char *);
FILE _tempfile;
_tempfile._fd = -1; _tempfile._fd = -1;
_tempfile._flags = IO_READMODE + IO_UNBUFF; _tempfile._flags = IO_READMODE + IO_UNBUFF;
_tempfile._buf = (unsigned char *) string; _tempfile._buf = (unsigned char *) string;
@ -21,6 +21,8 @@ va_dcl
_tempfile._count = 32767; _tempfile._count = 32767;
retval = _doscanf (&_tempfile, format, ap); retval = _doscanf (&_tempfile, format, ap);
}
va_end(ap); va_end(ap);
return retval; return retval;
} }