File: vprintf.doc

package info (click to toggle)
xrn 9.02-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,820 kB
  • ctags: 3,233
  • sloc: ansic: 24,690; makefile: 2,685; yacc: 888; sh: 252; lex: 92; perl: 35; awk: 31; csh: 13
file content (44 lines) | stat: -rw-r--r-- 1,707 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Portable vsprintf, vfprintf, and vprintf  by Robert A. Larson
	<blarson@skat.usc.edu>

Copyright 1989 Robert A. Larson.
Distribution in any form is allowed as long as the author
retains credit, changes are noted by their author and the
copyright message remains intact.  This program comes as-is
with no warentee of fitness for any purpouse.

Thanks to Doug Gwen, Chris Torek, and others who helped clarify
the ansi printf specs.

Please send any bug fixes and improvments to blarson@skat.usc.edu .
The use of goto is NOT a bug.


Feb  9, 1989		blarson		First usenet release

This code implements the vsprintf function, without relying on
the existance of _doprint or other system specific code.

Define NOVOID if void * is not a supported type.

Two compile options are available for efficency:
	INTSPRINTF	should be defined if sprintf is int and returns
			the number of chacters formated.
	LONGINT		should be defined if sizeof(long) == sizeof(int)

	They only make the code smaller and faster, they need not be 
	defined.

UNSIGNEDSPECIAL should be defined if unsigned is treated differently
than int in argument passing.  If this is definded, and LONGINT is not,
the compiler must support the type unsigned long.

Most quirks and bugs of the available sprintf and fprintf fuction are
duplicated, however * in the width and precision fields will work
correctly even if sprintf does not support this, and the %n format
will always work in vsprintf.  %n and return count will work properly
in vfprintf and vprintf only if fprintf returns the number of
characters formatted.

Bad format strings, or those with very long width and precision
fields (including expanded * fields) will cause undesired results.