Next batch.

This commit is contained in:
Manoel Trapier
2013-03-08 19:13:03 +01:00
committed by Manoël Trapier
parent 60330b05cd
commit 3d1d1277b7
34 changed files with 568 additions and 603 deletions

View File

@@ -8,10 +8,7 @@
#include <system.h>
#include "print.h"
extern char *long2str();
static int
integral(c)
static int integral(int c)
{
switch (c) {
case 'b':
@@ -35,10 +32,7 @@ integral(c)
%[uxbo] = unsigned int
%d = int
$ */
int
_format(buf, fmt, argp)
char *buf, *fmt;
register va_list argp;
int _format(char *buf, char *fmt, va_list argp)
{
register char *pf = fmt;
register char *pb = buf;
@@ -75,7 +69,7 @@ _format(buf, fmt, argp)
else
if (*pf == 'l') {
/* alignment ??? */
if (base = integral(*++pf)) {
if ((base = integral(*++pf))) {
arg = long2str(va_arg(argp,long), base);
}
else {
@@ -84,7 +78,7 @@ _format(buf, fmt, argp)
}
}
else
if (base = integral(*pf)) {
if ((base = integral(*pf))) {
arg = long2str((long)va_arg(argp,int), base);
}
else
@@ -98,7 +92,7 @@ _format(buf, fmt, argp)
while (npad-- > 0)
*pb++ = pad;
while (*pb++ = *arg++);
while (((*pb++) = (*arg++)));
pb--;
pf++;
}

View File

@@ -20,4 +20,6 @@ _PROTOTYPE(void doprnt, (File *f, char *fmt, va_list ap));
_PROTOTYPE(int _format, (char *buf, char *fmt, va_list ap));
_PROTOTYPE(char *sprint, (char *buf, char *fmt, ...));
char *long2str(long val, int base);
#endif /* __PRINT_INCLUDED__ */