xref: /csrg-svn/usr.bin/ex/ovprintf.c (revision 63049)
148255Sbostic /*-
2*63049Sbostic  * Copyright (c) 1980, 1993
3*63049Sbostic  *	The Regents of the University of California.  All rights reserved.
448255Sbostic  *
548255Sbostic  * %sccs.include.proprietary.c%
621707Sdist  */
7726Sroot 
821707Sdist #ifndef lint
9*63049Sbostic static char sccsid[] = "@(#)ovprintf.c	8.1 (Berkeley) 06/09/93";
1048255Sbostic #endif /* not lint */
1121707Sdist 
12726Sroot /*
13726Sroot  * This version of printf calls doprnt, and as such is not portable,
14726Sroot  * since doprnt is written in pdp-11 assembly language.  (There is a
15726Sroot  * vax doprnt which has the first 2 arguments reversed.  We don't use it.)
16726Sroot  * This version is used because it is about 900 bytes smaller than the
17726Sroot  * portable version, which is also included in case it is needed.
18726Sroot  */
19726Sroot #ifdef TRACE
20726Sroot #include	<stdio.h>
21726Sroot #undef putchar
22726Sroot #endif
23726Sroot 
printf(fmt,args)24726Sroot printf(fmt, args)
25726Sroot char *fmt;
26726Sroot {
27726Sroot 	_doprnt(fmt, &args, 0);
28726Sroot }
29726Sroot 
_strout(string,count,adjust,file,fillch)30726Sroot _strout(string, count, adjust, file, fillch)
31726Sroot register char *string;
32726Sroot register count;
33726Sroot int adjust;
34726Sroot register struct _iobuf *file;
35726Sroot {
36726Sroot 	while (adjust < 0) {
37726Sroot 		if (*string=='-' && fillch=='0') {
38726Sroot 			putchar(*string++);
39726Sroot 			count--;
40726Sroot 		}
41726Sroot 		putchar(fillch);
42726Sroot 		adjust++;
43726Sroot 	}
44726Sroot 	while (--count>=0)
45726Sroot 		putchar(*string++);
46726Sroot 	while (adjust) {
47726Sroot 		putchar(fillch);
48726Sroot 		adjust--;
49726Sroot 	}
50726Sroot }
51