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

@ -3,17 +3,18 @@
#include <varargs.h> #include <varargs.h>
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 *);
_doprnt (fmt, ap, file); char *fmt = va_arg(ap, char *);
if ( io_testflag(file,IO_PERPRINTF) )
fflush(file); _doprnt (fmt, ap, file);
if ( io_testflag(file,IO_PERPRINTF) )
fflush(file);
}
va_end(ap); va_end(ap);
} }

View file

@ -3,18 +3,20 @@
#include <varargs.h> #include <varargs.h>
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 *);
retval = _doscanf (fp, format, ap); char *format = va_arg(ap, char *);
retval = _doscanf (fp, format, ap);
}
va_end(ap); va_end(ap);
return retval; return retval;
} }

View file

@ -3,15 +3,17 @@
#include <varargs.h> #include <varargs.h>
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 *); {
_doprnt (fmt, ap, stdout); char *fmt = va_arg(ap, char *);
if ( io_testflag(stdout,IO_PERPRINTF) )
fflush(stdout); _doprnt (fmt, ap, stdout);
if ( io_testflag(stdout,IO_PERPRINTF) )
fflush(stdout);
}
va_end(ap); va_end(ap);
} }

View file

@ -3,16 +3,19 @@
#include <varargs.h> #include <varargs.h>
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 *); {
retval = _doscanf (stdin, format, ap); char *format = va_arg(ap, char *);
retval = _doscanf (stdin, format, ap);
}
va_end(ap); va_end(ap);
return retval; return retval;
} }

View file

@ -3,24 +3,28 @@
#include <varargs.h> #include <varargs.h>
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 *);
_tempfile._fd = -1; char *format = va_arg(ap, char *);
_tempfile._flags = IO_WRITEMODE + IO_UNBUFF; FILE _tempfile;
_tempfile._buf = (unsigned char *) buf;
_tempfile._ptr = (unsigned char *) buf;
_tempfile._count = 32767;
_doprnt(format, ap, &_tempfile); retval = buf;
putc('\0',&_tempfile); _tempfile._fd = -1;
_tempfile._flags = IO_WRITEMODE + IO_UNBUFF;
_tempfile._buf = (unsigned char *) buf;
_tempfile._ptr = (unsigned char *) buf;
_tempfile._count = 32767;
_doprnt(format, ap, &_tempfile);
putc('\0',&_tempfile);
}
va_end(ap); va_end(ap);
return buf;
return retval;
} }

View file

@ -3,24 +3,26 @@
#include <varargs.h> #include <varargs.h>
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 *);
_tempfile._fd = -1; char *format = va_arg(ap, char *);
_tempfile._flags = IO_READMODE + IO_UNBUFF; FILE _tempfile;
_tempfile._buf = (unsigned char *) string;
_tempfile._ptr = (unsigned char *) string;
_tempfile._count = 32767;
retval = _doscanf (&_tempfile, format, ap); _tempfile._fd = -1;
_tempfile._flags = IO_READMODE + IO_UNBUFF;
_tempfile._buf = (unsigned char *) string;
_tempfile._ptr = (unsigned char *) string;
_tempfile._count = 32767;
retval = _doscanf (&_tempfile, format, ap);
}
va_end(ap); va_end(ap);
return retval; return retval;
} }