comparison src/doprnt.c @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 8b0bdfdf0cf0
children 54cc21c15cbb
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
44 int argnum; /* which argument does this spec want? This is one-based: 44 int argnum; /* which argument does this spec want? This is one-based:
45 The first argument given is numbered 1, the second 45 The first argument given is numbered 1, the second
46 is 2, etc. This is to handle %##$x-type specs. */ 46 is 2, etc. This is to handle %##$x-type specs. */
47 int minwidth; 47 int minwidth;
48 int precision; 48 int precision;
49 unsigned int minus_flag:1; 49 int minus_flag:1;
50 unsigned int plus_flag:1; 50 int plus_flag:1;
51 unsigned int space_flag:1; 51 int space_flag:1;
52 unsigned int number_flag:1; 52 int number_flag:1;
53 unsigned int zero_flag:1; 53 int zero_flag:1;
54 unsigned int h_flag:1; 54 int h_flag:1;
55 unsigned int l_flag:1; 55 int l_flag:1;
56 char converter; /* converter character or 0 for dummy marker 56 char converter; /* converter character or 0 for dummy marker
57 indicating literal text at the end of the 57 indicating literal text at the end of the
58 specification */ 58 specification */
59 Bytecount text_before; /* position of the first character of the 59 Bytecount text_before; /* position of the first character of the
60 block of literal text before this spec */ 60 block of literal text before this spec */
443 Bytecount string_len; 443 Bytecount string_len;
444 444
445 if (!largs) 445 if (!largs)
446 { 446 {
447 string = Dynarr_at (args, spec->argnum - 1).bp; 447 string = Dynarr_at (args, spec->argnum - 1).bp;
448 /* error() can be called with null string arguments.
449 E.g., in fileio.c, the return value of strerror()
450 is never checked. We'll print (null), like some
451 printf implementations do. Would it be better (and safe)
452 to signal an error instead? Or should we just use the
453 empty string? -dkindred@cs.cmu.edu 8/1997
454 */
455 if (!string)
456 string = (Bufbyte *) "(null)";
457 string_len = strlen ((char *) string); 448 string_len = strlen ((char *) string);
458 } 449 }
459 else 450 else
460 { 451 {
461 Lisp_Object obj = largs[spec->argnum - 1]; 452 Lisp_Object obj = largs[spec->argnum - 1];
494 arg = Dynarr_at (args, spec->argnum - 1); 485 arg = Dynarr_at (args, spec->argnum - 1);
495 } 486 }
496 else 487 else
497 { 488 {
498 Lisp_Object obj = largs[spec->argnum - 1]; 489 Lisp_Object obj = largs[spec->argnum - 1];
490 if (CHARP (obj))
491 CHECK_INT_COERCE_CHAR (obj);
499 if (!INT_OR_FLOATP (obj)) 492 if (!INT_OR_FLOATP (obj))
500 { 493 {
501 error ("format specifier %%%c doesn't match argument type", 494 error ("format specifier %%%c doesn't match argument type",
502 ch); 495 ch);
503 } 496 }