diff --git a/modules/src/print/doprnt.c b/modules/src/print/doprnt.c index dd7092232..a30d5c91e 100644 --- a/modules/src/print/doprnt.c +++ b/modules/src/print/doprnt.c @@ -8,6 +8,13 @@ #include #include "param.h" +/*FORMAT1 $ + %s = char * + %l = long + %c = int + %[uxbo] = unsigned int + %d = int +$ */ doprnt(fp, fmt, argp) File *fp; char *fmt; diff --git a/modules/src/print/format.c b/modules/src/print/format.c index 34aabbb02..392f5f458 100644 --- a/modules/src/print/format.c +++ b/modules/src/print/format.c @@ -6,7 +6,7 @@ #include -char *long2str(); +extern char *long2str(); static int integral(c) @@ -26,6 +26,13 @@ integral(c) return 0; } +/*FORMAT1 $ + %s = char * + %l = long + %c = int + %[uxbo] = unsigned int + %d = int +$ */ int _format(buf, fmt, argp) char *buf, *fmt; diff --git a/modules/src/print/fprint.c b/modules/src/print/fprint.c index 027cec170..fe5f59329 100644 --- a/modules/src/print/fprint.c +++ b/modules/src/print/fprint.c @@ -8,7 +8,13 @@ #include #include "param.h" -/*VARARGS*/ +/*FORMAT1v $ + %s = char * + %l = long + %c = int + %[uxbo] = unsigned int + %d = int +$ */ fprint(va_alist) va_dcl { diff --git a/modules/src/print/print.3 b/modules/src/print/print.3 index d79430a7a..8688606ec 100644 --- a/modules/src/print/print.3 +++ b/modules/src/print/print.3 @@ -14,13 +14,18 @@ print, fprint, sprint, doprnt -- very simple formatted-output routines .B File *filep; .B char *format; .PP -.B sprint(s, format [, arg] ... ) +.B char *sprint(s, format [, arg] ... ) .B char *s, *format; .PP .B doprnt(filep, format, args) .B File *filep; .B char *format; .B va_list args; +.PP +.B int _format(buf, format, args) +.B char *buf; +.B char *format; +.B va_list args; .fi .SH DESCRIPTION .I Print @@ -90,6 +95,12 @@ Padding takes place only if the specified field width exceeds the actual width. The printing routines build the string to be printed internally and use .I sys_write to print it. +.PP +The +.I _format +routine builds the string, but does not null-terminate it. It returns the +length of the string. +.PP .I Doprnt takes .I args diff --git a/modules/src/print/print.c b/modules/src/print/print.c index b92c7427b..1d99a8d25 100644 --- a/modules/src/print/print.c +++ b/modules/src/print/print.c @@ -8,7 +8,13 @@ #include #include "param.h" -/*VARARGS*/ +/*FORMAT0v $ + %s = char * + %l = long + %c = int + %[uxbo] = unsigned int + %d = int +$ */ print(va_alist) va_dcl { diff --git a/modules/src/print/sprint.c b/modules/src/print/sprint.c index 51f708eb3..ba4361b94 100644 --- a/modules/src/print/sprint.c +++ b/modules/src/print/sprint.c @@ -8,7 +8,13 @@ #include #include "param.h" -/*VARARGS*/ +/*FORMAT1v $ + %s = char * + %l = long + %c = int + %[uxbo] = unsigned int + %d = int +$ */ char * sprint(va_alist) va_dcl