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