Added FORMAT information for our lint; Documented the _format routine

This commit is contained in:
ceriel 1989-02-07 11:17:22 +00:00
parent f3584b3d52
commit c64da88289
6 changed files with 48 additions and 5 deletions

View file

@ -8,6 +8,13 @@
#include <varargs.h> #include <varargs.h>
#include "param.h" #include "param.h"
/*FORMAT1 $
%s = char *
%l = long
%c = int
%[uxbo] = unsigned int
%d = int
$ */
doprnt(fp, fmt, argp) doprnt(fp, fmt, argp)
File *fp; File *fp;
char *fmt; char *fmt;

View file

@ -6,7 +6,7 @@
#include <varargs.h> #include <varargs.h>
char *long2str(); extern char *long2str();
static int static int
integral(c) integral(c)
@ -26,6 +26,13 @@ integral(c)
return 0; return 0;
} }
/*FORMAT1 $
%s = char *
%l = long
%c = int
%[uxbo] = unsigned int
%d = int
$ */
int int
_format(buf, fmt, argp) _format(buf, fmt, argp)
char *buf, *fmt; char *buf, *fmt;

View file

@ -8,7 +8,13 @@
#include <system.h> #include <system.h>
#include "param.h" #include "param.h"
/*VARARGS*/ /*FORMAT1v $
%s = char *
%l = long
%c = int
%[uxbo] = unsigned int
%d = int
$ */
fprint(va_alist) fprint(va_alist)
va_dcl va_dcl
{ {

View file

@ -14,13 +14,18 @@ print, fprint, sprint, doprnt -- very simple formatted-output routines
.B File *filep; .B File *filep;
.B char *format; .B char *format;
.PP .PP
.B sprint(s, format [, arg] ... ) .B char *sprint(s, format [, arg] ... )
.B char *s, *format; .B char *s, *format;
.PP .PP
.B doprnt(filep, format, args) .B doprnt(filep, format, args)
.B File *filep; .B File *filep;
.B char *format; .B char *format;
.B va_list args; .B va_list args;
.PP
.B int _format(buf, format, args)
.B char *buf;
.B char *format;
.B va_list args;
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.I Print .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 The printing routines build the string to be printed internally and use
.I sys_write .I sys_write
to print it. 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 .I Doprnt
takes takes
.I args .I args

View file

@ -8,7 +8,13 @@
#include <system.h> #include <system.h>
#include "param.h" #include "param.h"
/*VARARGS*/ /*FORMAT0v $
%s = char *
%l = long
%c = int
%[uxbo] = unsigned int
%d = int
$ */
print(va_alist) print(va_alist)
va_dcl va_dcl
{ {

View file

@ -8,7 +8,13 @@
#include <system.h> #include <system.h>
#include "param.h" #include "param.h"
/*VARARGS*/ /*FORMAT1v $
%s = char *
%l = long
%c = int
%[uxbo] = unsigned int
%d = int
$ */
char * char *
sprint(va_alist) sprint(va_alist)
va_dcl va_dcl