[BACK]Return to printf.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / printf

Diff for /src/usr.bin/printf/printf.c between version 1.19 and 1.20

version 1.19, 2013/11/20 20:46:47 version 1.20, 2014/04/18 11:35:51
Line 59 
Line 59 
 #define hextobin(c)     ((c) >= 'A' && (c) <= 'F' ? c - 'A' + 10 : (c) >= 'a' && (c) <= 'f' ? c - 'a' + 10 : c - '0')  #define hextobin(c)     ((c) >= 'A' && (c) <= 'F' ? c - 'A' + 10 : (c) >= 'a' && (c) <= 'f' ? c - 'a' + 10 : c - '0')
   
 #define PF(f, func) { \  #define PF(f, func) { \
         if (fieldwidth) \          if (havefieldwidth) \
                 if (precision) \                  if (haveprecision) \
                         (void)printf(f, fieldwidth, precision, func); \                          (void)printf(f, fieldwidth, precision, func); \
                 else \                  else \
                         (void)printf(f, fieldwidth, func); \                          (void)printf(f, fieldwidth, func); \
         else if (precision) \          else if (haveprecision) \
                 (void)printf(f, precision, func); \                  (void)printf(f, precision, func); \
         else \          else \
                 (void)printf(f, func); \                  (void)printf(f, func); \
Line 74 
Line 74 
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         char *fmt, *start;          char *fmt, *start;
           int havefieldwidth, haveprecision;
         int fieldwidth, precision;          int fieldwidth, precision;
         char convch, nextch;          char convch, nextch;
         char *format;          char *format;
Line 128 
Line 129 
                                         ;                                          ;
                                 if (*fmt == '*') {                                  if (*fmt == '*') {
                                         ++fmt;                                          ++fmt;
                                           havefieldwidth = 1;
                                         fieldwidth = getint();                                          fieldwidth = getint();
                                 } else                                  } else
                                         fieldwidth = 0;                                          havefieldwidth = 0;
   
                                 /* skip to field precision */                                  /* skip to field precision */
                                 for (; strchr(SKIP2, *fmt); ++fmt)                                  for (; strchr(SKIP2, *fmt); ++fmt)
                                         ;                                          ;
                                 precision = 0;                                  haveprecision = 0;
                                 if (*fmt == '.') {                                  if (*fmt == '.') {
                                         ++fmt;                                          ++fmt;
                                         if (*fmt == '*') {                                          if (*fmt == '*') {
                                                 ++fmt;                                                  ++fmt;
                                                   haveprecision = 1;
                                                 precision = getint();                                                  precision = getint();
                                         }                                          }
                                         for (; strchr(SKIP2, *fmt); ++fmt)                                          for (; strchr(SKIP2, *fmt); ++fmt)

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20