xref: /original-bsd/usr.bin/ex/ovprintf.c (revision aa3c3b6a)
1 /* Copyright (c) 1979 Regents of the University of California */
2 static char *sccsid = "@(#)ovprintf.c	1.1 08/26/80";
3 
4 /*
5  * This version of printf calls doprnt, and as such is not portable,
6  * since doprnt is written in pdp-11 assembly language.  (There is a
7  * vax doprnt which has the first 2 arguments reversed.  We don't use it.)
8  * This version is used because it is about 900 bytes smaller than the
9  * portable version, which is also included in case it is needed.
10  */
11 #ifdef TRACE
12 #include	<stdio.h>
13 #undef putchar
14 #endif
15 
16 printf(fmt, args)
17 char *fmt;
18 {
19 	_doprnt(fmt, &args, 0);
20 }
21 
22 _strout(string, count, adjust, file, fillch)
23 register char *string;
24 register count;
25 int adjust;
26 register struct _iobuf *file;
27 {
28 	while (adjust < 0) {
29 		if (*string=='-' && fillch=='0') {
30 			putchar(*string++);
31 			count--;
32 		}
33 		putchar(fillch);
34 		adjust++;
35 	}
36 	while (--count>=0)
37 		putchar(*string++);
38 	while (adjust) {
39 		putchar(fillch);
40 		adjust--;
41 	}
42 }
43