blob: 0b004eaeb192f4b49df8d026924df727cbc64554 [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Eric Andersencc8ed391999-10-05 16:24:54 +00002/* printf - format and print data
Eric Andersencc8ed391999-10-05 16:24:54 +00003
Rob Landley251161f2006-01-06 20:28:05 +00004 Copyright 1999 Dave Cinege
5 Portions copyright (C) 1990-1996 Free Software Foundation, Inc.
Eric Andersencc8ed391999-10-05 16:24:54 +00006
Rob Landley251161f2006-01-06 20:28:05 +00007 Licensed under GPL v2 or later, see file LICENSE in this tarball for details.
8*/
Eric Andersencc8ed391999-10-05 16:24:54 +00009
10/* Usage: printf format [argument...]
11
12 A front end to the printf function that lets it be used from the shell.
13
14 Backslash escapes:
15
16 \" = double quote
17 \\ = backslash
18 \a = alert (bell)
19 \b = backspace
20 \c = produce no further output
21 \f = form feed
22 \n = new line
23 \r = carriage return
24 \t = horizontal tab
25 \v = vertical tab
26 \0ooo = octal number (ooo is 0 to 3 digits)
27 \xhhh = hexadecimal number (hhh is 1 to 3 digits)
28
29 Additional directive:
30
31 %b = print an argument string, interpreting backslash escapes
32
Denis Vlasenko13858992006-10-08 12:49:22 +000033 The 'format' argument is re-used as many times as necessary
Eric Andersencc8ed391999-10-05 16:24:54 +000034 to convert all of the given arguments.
35
Denis Vlasenko0f683f82008-07-17 09:17:51 +000036 David MacKenzie <djm@gnu.ai.mit.edu>
37*/
Erik Andersene49d5ec2000-02-08 19:58:47 +000038
Eric Andersencc8ed391999-10-05 16:24:54 +000039// 19990508 Busy Boxed! Dave Cinege
40
Denis Vlasenkob6adbf12007-05-26 19:00:18 +000041#include "libbb.h"
Eric Andersencc8ed391999-10-05 16:24:54 +000042
Denis Vlasenkoa48656b2008-07-18 11:10:51 +000043/* A note on bad input: neither bash 3.2 nor coreutils 6.10 stop on it.
44 * They report it:
45 * bash: printf: XXX: invalid number
46 * printf: XXX: expected a numeric value
47 * bash: printf: 123XXX: invalid number
48 * printf: 123XXX: value not completely converted
49 * but then they use 0 (or partially converted numeric prefix) as a value
50 * and continue. They exit with 1 in this case.
51 * Both accept insane field width/precision (e.g. %9999999999.9999999999d).
52 * Both print error message and assume 0 if %*.*f width/precision is "bad"
53 * (but negative numbers are not "bad").
54 * Both accept negative numbers for %u specifier.
55 *
56 * We try to be compatible. We are not compatible here:
57 * - we do not accept -NUM for %u
58 * - exit code is 0 even if "invalid number" was seen (FIXME)
59 * See "if (errno)" checks in the code below.
60 */
Denis Vlasenkoc2905632006-09-23 16:01:09 +000061
Denis Vlasenkoa48656b2008-07-18 11:10:51 +000062typedef void FAST_FUNC (*converter)(const char *arg, void *result);
63
64static int multiconvert(const char *arg, void *result, converter convert)
Rob Landley251161f2006-01-06 20:28:05 +000065{
Rob Landley251161f2006-01-06 20:28:05 +000066 if (*arg == '"' || *arg == '\'') {
Denis Vlasenko5f116622008-07-18 18:41:55 +000067 arg = utoa((unsigned char)arg[1]);
Rob Landley251161f2006-01-06 20:28:05 +000068 }
Denis Vlasenkoa48656b2008-07-18 11:10:51 +000069 errno = 0;
Denis Vlasenkod686a042006-11-27 14:43:21 +000070 convert(arg, result);
Denis Vlasenkoa48656b2008-07-18 11:10:51 +000071 if (errno) {
72 bb_error_msg("%s: invalid number", arg);
73 return 1;
74 }
75 return 0;
Rob Landley251161f2006-01-06 20:28:05 +000076}
Tim Rikerc1ef7bd2006-01-25 00:08:53 +000077
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +000078static void FAST_FUNC conv_strtoull(const char *arg, void *result)
Denis Vlasenkod686a042006-11-27 14:43:21 +000079{
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +000080 *(unsigned long long*)result = bb_strtoull(arg, NULL, 0);
Denis Vlasenkod686a042006-11-27 14:43:21 +000081}
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +000082static void FAST_FUNC conv_strtoll(const char *arg, void *result)
Denis Vlasenkod686a042006-11-27 14:43:21 +000083{
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +000084 *(long long*)result = bb_strtoll(arg, NULL, 0);
Denis Vlasenkod686a042006-11-27 14:43:21 +000085}
Denis Vlasenkoa48656b2008-07-18 11:10:51 +000086static void FAST_FUNC conv_strtod(const char *arg, void *result)
Denis Vlasenkod686a042006-11-27 14:43:21 +000087{
88 char *end;
Denis Vlasenkoa48656b2008-07-18 11:10:51 +000089 /* Well, this one allows leading whitespace... so what? */
90 /* What I like much less is that "-" accepted too! :( */
Denis Vlasenkod686a042006-11-27 14:43:21 +000091 *(double*)result = strtod(arg, &end);
Denis Vlasenkoa48656b2008-07-18 11:10:51 +000092 if (end[0]) {
93 errno = ERANGE;
94 *(double*)result = 0;
95 }
Denis Vlasenkod686a042006-11-27 14:43:21 +000096}
97
Denis Vlasenkoa48656b2008-07-18 11:10:51 +000098/* Callers should check errno to detect errors */
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +000099static unsigned long long my_xstrtoull(const char *arg)
Rob Landley251161f2006-01-06 20:28:05 +0000100{
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000101 unsigned long long result;
102 if (multiconvert(arg, &result, conv_strtoull))
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000103 result = 0;
Rob Landley251161f2006-01-06 20:28:05 +0000104 return result;
105}
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000106static long long my_xstrtoll(const char *arg)
Rob Landley251161f2006-01-06 20:28:05 +0000107{
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000108 long long result;
109 if (multiconvert(arg, &result, conv_strtoll))
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000110 result = 0;
Rob Landley251161f2006-01-06 20:28:05 +0000111 return result;
112}
Denis Vlasenkoa41fdf32007-01-29 22:51:00 +0000113static double my_xstrtod(const char *arg)
Rob Landley251161f2006-01-06 20:28:05 +0000114{
115 double result;
Denis Vlasenkod686a042006-11-27 14:43:21 +0000116 multiconvert(arg, &result, conv_strtod);
Rob Landley251161f2006-01-06 20:28:05 +0000117 return result;
118}
119
120static void print_esc_string(char *str)
121{
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000122 while (*str) {
Rob Landley251161f2006-01-06 20:28:05 +0000123 if (*str == '\\') {
124 str++;
Denis Vlasenko4daad902007-09-27 10:20:47 +0000125 bb_putchar(bb_process_escape_sequence((const char **)&str));
Rob Landley251161f2006-01-06 20:28:05 +0000126 } else {
Denis Vlasenko4daad902007-09-27 10:20:47 +0000127 bb_putchar(*str);
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000128 str++;
Rob Landley251161f2006-01-06 20:28:05 +0000129 }
Rob Landley251161f2006-01-06 20:28:05 +0000130 }
131}
132
Denis Vlasenko1d1bba42008-05-31 11:41:50 +0000133static void print_direc(char *format, unsigned fmt_length,
134 int field_width, int precision,
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000135 const char *argument)
Eric Andersencc8ed391999-10-05 16:24:54 +0000136{
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000137 long long llv;
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000138 double dv;
Denis Vlasenko1d1bba42008-05-31 11:41:50 +0000139 char saved;
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000140 char *have_prec, *have_width;
141
Denis Vlasenko6852eff2009-03-03 14:14:44 +0000142 saved = format[fmt_length];
143 format[fmt_length] = '\0';
144
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000145 have_prec = strstr(format, ".*");
146 have_width = strchr(format, '*');
147 if (have_width - 1 == have_prec)
148 have_width = NULL;
Eric Andersencc8ed391999-10-05 16:24:54 +0000149
Denis Vlasenkoa76669c2008-05-31 18:32:56 +0000150 switch (format[fmt_length - 1]) {
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000151 case 'c':
152 printf(format, *argument);
153 break;
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000154 case 'd':
155 case 'i':
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000156 llv = my_xstrtoll(argument);
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000157 print_long:
158 /* if (errno) return; - see comment at the top */
159 if (!have_width) {
160 if (!have_prec)
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000161 printf(format, llv);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000162 else
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000163 printf(format, precision, llv);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000164 } else {
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000165 if (!have_prec)
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000166 printf(format, field_width, llv);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000167 else
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000168 printf(format, field_width, precision, llv);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000169 }
170 break;
171 case 'o':
172 case 'u':
173 case 'x':
174 case 'X':
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000175 llv = my_xstrtoull(argument);
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000176 /* cheat: unsigned long and long have same width, so... */
177 goto print_long;
178 case 's':
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000179 /* Are char* and long long the same? */
180 if (sizeof(argument) == sizeof(llv)) {
181 llv = (long long)(ptrdiff_t)argument;
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000182 goto print_long;
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000183 } else {
184 /* Hope compiler will optimize it out by moving call
185 * instruction after the ifs... */
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000186 if (!have_width) {
187 if (!have_prec)
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000188 printf(format, argument, /*unused:*/ argument, argument);
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000189 else
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000190 printf(format, precision, argument, /*unused:*/ argument);
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000191 } else {
192 if (!have_prec)
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000193 printf(format, field_width, argument, /*unused:*/ argument);
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000194 else
195 printf(format, field_width, precision, argument);
196 }
197 break;
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000198 }
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000199 case 'f':
200 case 'e':
201 case 'E':
202 case 'g':
203 case 'G':
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000204 dv = my_xstrtod(argument);
205 /* if (errno) return; */
206 if (!have_width) {
207 if (!have_prec)
208 printf(format, dv);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000209 else
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000210 printf(format, precision, dv);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000211 } else {
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000212 if (!have_prec)
213 printf(format, field_width, dv);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000214 else
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000215 printf(format, field_width, precision, dv);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000216 }
217 break;
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000218 } /* switch */
Eric Andersencc8ed391999-10-05 16:24:54 +0000219
Denis Vlasenko1d1bba42008-05-31 11:41:50 +0000220 format[fmt_length] = saved;
Eric Andersencc8ed391999-10-05 16:24:54 +0000221}
222
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000223/* Handle params for "%*.*f". Negative numbers are ok (compat). */
224static int get_width_prec(const char *str)
225{
226 int v = bb_strtoi(str, NULL, 10);
227 if (errno) {
228 bb_error_msg("%s: invalid number", str);
229 v = 0;
230 }
231 return v;
232}
233
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000234/* Print the text in FORMAT, using ARGV for arguments to any '%' directives.
235 Return advanced ARGV. */
Denis Vlasenko1d1bba42008-05-31 11:41:50 +0000236static char **print_formatted(char *f, char **argv)
Eric Andersencc8ed391999-10-05 16:24:54 +0000237{
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000238 char *direc_start; /* Start of % directive. */
Denis Vlasenko1d1bba42008-05-31 11:41:50 +0000239 unsigned direc_length; /* Length of % directive. */
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000240 int field_width; /* Arg to first '*' */
241 int precision; /* Arg to second '*' */
Denis Vlasenkocd2663f2008-06-01 22:36:39 +0000242 char **saved_argv = argv;
Eric Andersencc8ed391999-10-05 16:24:54 +0000243
Denis Vlasenko1d1bba42008-05-31 11:41:50 +0000244 for (; *f; ++f) {
Erik Andersene49d5ec2000-02-08 19:58:47 +0000245 switch (*f) {
246 case '%':
247 direc_start = f++;
248 direc_length = 1;
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000249 field_width = precision = 0;
Erik Andersene49d5ec2000-02-08 19:58:47 +0000250 if (*f == '%') {
Denis Vlasenko4daad902007-09-27 10:20:47 +0000251 bb_putchar('%');
Erik Andersene49d5ec2000-02-08 19:58:47 +0000252 break;
253 }
254 if (*f == 'b') {
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000255 if (*argv) {
Erik Andersene49d5ec2000-02-08 19:58:47 +0000256 print_esc_string(*argv);
257 ++argv;
Erik Andersene49d5ec2000-02-08 19:58:47 +0000258 }
259 break;
260 }
261 if (strchr("-+ #", *f)) {
262 ++f;
263 ++direc_length;
264 }
265 if (*f == '*') {
266 ++f;
267 ++direc_length;
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000268 if (*argv)
269 field_width = get_width_prec(*argv++);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000270 } else {
Glenn L McGrath240a91d2004-09-15 02:05:23 +0000271 while (isdigit(*f)) {
Erik Andersene49d5ec2000-02-08 19:58:47 +0000272 ++f;
273 ++direc_length;
274 }
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000275 }
Erik Andersene49d5ec2000-02-08 19:58:47 +0000276 if (*f == '.') {
277 ++f;
278 ++direc_length;
279 if (*f == '*') {
280 ++f;
281 ++direc_length;
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000282 if (*argv)
283 precision = get_width_prec(*argv++);
284 } else {
Glenn L McGrath240a91d2004-09-15 02:05:23 +0000285 while (isdigit(*f)) {
Erik Andersene49d5ec2000-02-08 19:58:47 +0000286 ++f;
287 ++direc_length;
288 }
Denis Vlasenkoa48656b2008-07-18 11:10:51 +0000289 }
Erik Andersene49d5ec2000-02-08 19:58:47 +0000290 }
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000291
292 /* Remove "lLhz" size modifiers, repeatedly.
293 * bash does not like "%lld", but coreutils
294 * would happily take even "%Llllhhzhhzd"!
295 * We will be permissive like coreutils */
296 while ((*f | 0x20) == 'l' || *f == 'h' || *f == 'z') {
Denis Vlasenko0f293b92008-07-22 20:16:55 +0000297 overlapping_strcpy(f, f + 1);
Erik Andersene49d5ec2000-02-08 19:58:47 +0000298 }
Denis Vlasenkocb39a7c2009-01-04 02:58:58 +0000299 /* Add "ll" if integer modifier, then print */
300 {
301 static const char format_chars[] ALIGN1 = "diouxXfeEgGcs";
302 char *p = strchr(format_chars, *f);
303 /* needed - try "printf %" without it */
304 if (p == NULL) {
305 bb_error_msg("%s: invalid format", direc_start);
306 /* causes main() to exit with error */
307 return saved_argv - 1;
308 }
309 ++direc_length;
310 if (p - format_chars <= 5) {
311 /* it is one of "diouxX" */
312 p = xmalloc(direc_length + 3);
313 memcpy(p, direc_start, direc_length);
314 p[direc_length + 1] = p[direc_length - 1];
315 p[direc_length - 1] = 'l';
316 p[direc_length] = 'l';
317 //bb_error_msg("<%s>", p);
318 direc_length += 2;
319 direc_start = p;
320 } else {
321 p = NULL;
322 }
323 if (*argv) {
324 print_direc(direc_start, direc_length, field_width,
325 precision, *argv);
326 ++argv;
327 } else {
328 print_direc(direc_start, direc_length, field_width,
329 precision, "");
330 }
331 free(p);
Denis Vlasenko0f683f82008-07-17 09:17:51 +0000332 }
Erik Andersene49d5ec2000-02-08 19:58:47 +0000333 break;
Erik Andersene49d5ec2000-02-08 19:58:47 +0000334 case '\\':
Denis Vlasenkocd2663f2008-06-01 22:36:39 +0000335 if (*++f == 'c') {
336 return saved_argv; /* causes main() to exit */
337 }
Denis Vlasenko4daad902007-09-27 10:20:47 +0000338 bb_putchar(bb_process_escape_sequence((const char **)&f));
Glenn L McGrath240a91d2004-09-15 02:05:23 +0000339 f--;
Erik Andersene49d5ec2000-02-08 19:58:47 +0000340 break;
Erik Andersene49d5ec2000-02-08 19:58:47 +0000341 default:
Denis Vlasenko4daad902007-09-27 10:20:47 +0000342 bb_putchar(*f);
Erik Andersene49d5ec2000-02-08 19:58:47 +0000343 }
Eric Andersencc8ed391999-10-05 16:24:54 +0000344 }
Eric Andersencc8ed391999-10-05 16:24:54 +0000345
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000346 return argv;
Eric Andersencc8ed391999-10-05 16:24:54 +0000347}
348
Denis Vlasenkoa60f84e2008-07-05 09:18:54 +0000349int printf_main(int argc UNUSED_PARAM, char **argv)
Eric Andersencc8ed391999-10-05 16:24:54 +0000350{
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000351 char *format;
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000352 char **argv2;
Eric Andersencc8ed391999-10-05 16:24:54 +0000353
Denis Vlasenkocd2663f2008-06-01 22:36:39 +0000354 /* We must check that stdout is not closed.
Denis Vlasenko0f683f82008-07-17 09:17:51 +0000355 * The reason for this is highly non-obvious.
356 * printf_main is used from shell.
Denis Vlasenkocd2663f2008-06-01 22:36:39 +0000357 * Shell must correctly handle 'printf "%s" foo'
358 * if stdout is closed. With stdio, output gets shoveled into
359 * stdout buffer, and even fflush cannot clear it out. It seems that
360 * even if libc receives EBADF on write attempts, it feels determined
361 * to output data no matter what. So it will try later,
362 * and possibly will clobber future output. Not good. */
Denis Vlasenko6a0ad252008-07-25 13:34:05 +0000363// TODO: check fcntl() & O_ACCMODE == O_WRONLY or O_RDWR?
364 if (fcntl(1, F_GETFL) == -1)
365 return 1; /* match coreutils 6.10 (sans error msg to stderr) */
366 //if (dup2(1, 1) != 1) - old way
367 // return 1;
Denis Vlasenkocd2663f2008-06-01 22:36:39 +0000368
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000369 /* bash builtin errors out on "printf '-%s-\n' foo",
370 * coreutils-6.9 works. Both work with "printf -- '-%s-\n' foo".
371 * We will mimic coreutils. */
Denis Vlasenko0f683f82008-07-17 09:17:51 +0000372 if (argv[1] && argv[1][0] == '-' && argv[1][1] == '-' && !argv[1][2])
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000373 argv++;
Denis Vlasenko311c19a2008-12-10 11:51:45 +0000374 if (!argv[1]) {
375 if (ENABLE_ASH_BUILTIN_PRINTF
376 && applet_name[0] != 'p'
377 ) {
378 bb_error_msg("usage: printf FORMAT [ARGUMENT...]");
379 return 2; /* bash compat */
380 }
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000381 bb_show_usage();
Denis Vlasenko311c19a2008-12-10 11:51:45 +0000382 }
Eric Andersencc8ed391999-10-05 16:24:54 +0000383
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000384 format = argv[1];
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000385 argv2 = argv + 2;
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000386
387 do {
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000388 argv = argv2;
389 argv2 = print_formatted(format, argv);
Denis Vlasenko0f683f82008-07-17 09:17:51 +0000390 } while (argv2 > argv && *argv2);
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000391
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000392 /* coreutils compat (bash doesn't do this):
393 if (*argv)
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000394 fprintf(stderr, "excess args ignored");
Denis Vlasenkob6c48552008-05-18 14:28:40 +0000395 */
Denis Vlasenko339f5eb2007-03-09 16:43:01 +0000396
Denis Vlasenko0f683f82008-07-17 09:17:51 +0000397 return (argv2 < argv); /* if true, print_formatted errored out */
Eric Andersencc8ed391999-10-05 16:24:54 +0000398}