|
|
1.1 root 1: printf format string decision tree
2: ------ ------ ------ -------- ----
3:
4: d,i flags:
5: - left justified in field
6: default is right justified
7: + always show sign
8: default is only show sign for negative
9: ' ' if non-negative or no characters, prefix with space
10: ignore if with +
11: # UNDEFINED
12: 0 pad to field width with zeros after any sign
13: ignore if with '-' flag
14: ignore if with precision
15: width:
16: if conv value has < width chars, pad field according to flag
17: * means read next input int, negative means '-' flag
18: precision:
19: minimum number of digits
20: if prec > digits, pad with 0
21: default is 1
22: . without digit means ".0"
23: .* reads next input int, negative number means ignore
24: 0 value with 0 precision writes no characters
25: conversion:
26: signed decimal number
27: pad to precision with leading 0s
28: following conversion spec:
29: h value is short
30: l value is long
31: L UNDEFINED
32:
33: o flags:
34: - left justified in field
35: default is right justified
36: + UNDEFINED
37: ' ' UNDEFINED
38: # increase precision to make first digit be 0
39: 0 pad to field width with zeros
40: ignore if with '-' flag
41: ignore if with precision
42: width:
43: if conv value has < width chars, pad field according to flag
44: * means read next input int, negative means '-' flag
45: precision:
46: minimum number of digits
47: default is 1
48: . without digit means ".0"
49: .* reads next input int, negative number means ignore
50: 0 value with 0 precision writes no characters
51: conversion:
52: unsigned octal
53: pad to precision with leading 0s
54: following conversion spec:
55: h value is unsigned short
56: l value is unsigned long
57: L UNDEFINED
58:
59: u flags:
60: - left justified in field
61: default is right justified
62: + UNDEFINED
63: ' ' UNDEFINED
64: # UNDEFINED
65: 0 pad to field width with zeros
66: ignore if with '-' flag
67: ignore if with precision
68: width:
69: if conv value has < width chars, pad field according to flag
70: * means read next input int, negative means '-' flag
71: precision:
72: minimum number of digits
73: default is 1
74: . without digit means ".0"
75: .* reads next input int, negative number means ignore
76: 0 value with 0 precision writes no characters
77: conversion:
78: unsigned decimal
79: pad to precision with leading 0s
80: following conversion spec:
81: h value is unsigned short
82: l value is unsigned long
83: L UNDEFINED
84:
85: x,X flags:
86: - left justified in field
87: default is right justified
88: + UNDEFINED
89: ' ' UNDEFINED
90: # non-zero result has 0x or 0X prefix
91: 0 pad to field width with zeros
92: ignore if with '-' flag
93: ignore if with precision
94: width:
95: if conv value has < width chars, pad field according to flag
96: * means read next input int, negative means '-' flag
97: precision:
98: minimum number of digits
99: default is 1
100: . without digit means ".0"
101: .* reads next input int, negative number means ignore
102: 0 value with 0 precision prints no characters
103: conversion:
104: unsigned hex
105: x uses lowercase, X uses upper case
106: pad to precision with leading 0s
107: following conversion spec:
108: h value is unsigned short
109: l value is unsigned long
110: L UNDEFINED
111:
112: f flags:
113: - left justified in field
114: default is right justified
115: + always show sign
116: default is only show sign if negative
117: ' ' if non-negative or no characters, prefix with space
118: ignore if with +
119: # always print a decimal point
120: default is to print decimal only if digits follow
121: 0 pad to field width with zeros after sign
122: ignore if with '-' flag
123: UNDEFINED if with precision
124: width:
125: if conv value has < width chars, pad field according to flag
126: * means read next input int, negative means '-' flag
127: precision:
128: maximum number of digits after the decimal point
129: default is 6
130: . without digit means ".0"
131: .* reads next input int, negative number means ignore
132: conversion:
133: double of form ddd.ddd
134: if precision is 0 and no '#' flag, supress decimal point
135: if decimal point is printed, at least one character precedes
136: value is rounded to appropriate number of digits
137: following conversion spec:
138: h UNDEFINED
139: l UNDEFINED
140: L value is long double
141:
142: e,E flags:
143: - left justified in field
144: default is right justified
145: + always show sign
146: default is only show sign on negative
147: ' ' if non-negative or no characters, prefix with space
148: ignore if with +
149: # always print a decimal point
150: default is to print decimal only if digits follow
151: 0 pad to field width with zeros after sign
152: ignore if with '-' flag
153: UNDEFINED if with precision
154: width:
155: if conv value has < width chars, pad field according to flag
156: * means read next input int, negative means '-' flag
157: precision:
158: maximum number of digits after the decimal point
159: default is 6
160: . without digit means ".0"
161: .* reads next input int, negative number means ignore
162: conversion:
163: d.dddde+/-ddd
164: one non-zero digit before decimal (if value is not 0)
165: 0 precision and no '#' flag suppresses decimal
166: value rounded to appropriate number of digits
167: E gives 'E' as exponent indicator, e gives 'e'
168: exponent is at least 2 digits
169: zero value guves 0 exponent
170: following conversion spec:
171: h UNDEFINED
172: l UNDEFINED
173: L value is long double
174:
175: g,G flags:
176: - left justified in field
177: default is right justified
178: + always show sign
179: default is only show sign on negative
180: ' ' if non-negative or no characters, prefix with space
181: ignore if with +
182: # always print a decimal point, do not remove trailing zeros
183: default is to print decimal only if digits follow
184: default is to strip trailing 0s after decimal point
185: 0 pad to field width with zeros after sign
186: ignore if with '-' flag
187: UNDEFINED if with precision
188: width:
189: if conv value has < width chars, pad field according to flag
190: * means read next input int, negative means '-' flag
191: precision:
192: maximum number of significant digits
193: . without digit means ".0"
194: .* reads next input int, negative number means ignore
195: missing or zero precision means 1
196: conversion:
197: if exponent < -4 or >= precision use e(E) format
198: otherwise use f format
199: trailing 0's removed if no '#' flag
200: decimal point suppressed if no character and no '#' flag
201: following conversion spec:
202: h UNDEFINED
203: l UNDEFINED
204: L value is long double
205:
206: c flags:
207: - left justified in field
208: default is right justified
209: + UNDEFINED
210: ' ' UNDEFINED
211: # UNDEFINED
212: 0 UNDEFINED
213: width:
214: if conv value has < width chars, pad field according to flag
215: * means read next input int, negative means '-' flag
216: precision
217: UNDEFINED
218: conversion
219: write the character
220: following conversion spec:
221: h UNDEFINED
222: l UNDEFINED
223: L UNDEFINED
224:
225: s flags:
226: - left justified in field
227: default is right justified
228: + UNDEFINED
229: ' ' UNDEFINED
230: # UNDEFINED
231: 0 UNDEFINED
232: width:
233: if conv value has < width chars, pad field with spaces left/right
234: * means read next input int, negative means '-' flag
235: precision:
236: maximum number of characters written
237: . without digit means ".0"
238: .* reads next input int, negative number means ignore
239: conversion:
240: write to end of string or (if specified) precision number of chars
241: if no precision or precision > size of string, must be NUL term.
242: following conversion spec:
243: h UNDEFINED
244: l UNDEFINED
245: L UNDEFINED
246:
247: p flags:
248: - left justified in field
249: default is right justified
250: + UNDEFINED
251: ' ' UNDEFINED
252: # UNDEFINED
253: 0 UNDEFINED
254: width:
255: if conv value has < width chars, pad field according to flag
256: * means read next input int, negative means '-' flag
257: precision:
258: UNDEFINED
259: conversion:
260: implementation defined pointer
261: following conversion spec:
262: h UNDEFINED
263: l UNDEFINED
264: L UNDEFINED
265:
266: n flags:
267: all flags are undefined
268: width:
269: UNDEFINED
270: precision:
271: UNDEFINED
272: conversion:
273: write number of characters written so far
274: following conversion specifier:
275: h pointer is to a short int
276: l pointer is to a long int
277: L UNDEFINED
278:
279:
280: misc:
281: %% is escapefor printing percent character
282: all other conversion specifiers have UNDEFINED behaviour
283: nonexistant or small field gets expanded to hold value
284: returns number of characters written, or negative number on output error
285:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.