[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.14 and 1.15

version 1.14, 2008/09/08 17:04:20 version 1.15, 2009/07/17 17:39:30
Line 134 
Line 134 
         gargv = ++argv;          gargv = ++argv;
   
 #define SKIP1   "#-+ 0"  #define SKIP1   "#-+ 0"
 #define SKIP2   "*0123456789"  #define SKIP2   "0123456789"
         do {          do {
                 /*                  /*
                  * Basic algorithm is to scan the format string for conversion                   * Basic algorithm is to scan the format string for conversion
Line 163 
Line 163 
                                 }                                  }
   
                                 /* skip to field width */                                  /* skip to field width */
                                 for (; strchr(SKIP1, *fmt); ++fmt) ;                                  for (; strchr(SKIP1, *fmt); ++fmt)
                                 fieldwidth = *fmt == '*' ? getint() : 0;                                          ;
                                   if (*fmt == '*') {
                                           ++fmt;
                                           fieldwidth = getint();
                                   } else
                                           fieldwidth = 0;
   
                                 /* skip to possible '.', get following precision */                                  /* skip to field precision */
                                 for (; strchr(SKIP2, *fmt); ++fmt) ;                                  for (; strchr(SKIP2, *fmt); ++fmt)
                                 if (*fmt == '.')                                          ;
                                   precision = 0;
                                   if (*fmt == '.') {
                                         ++fmt;                                          ++fmt;
                                 precision = *fmt == '*' ? getint() : 0;                                          if (*fmt == '*') {
                                                   ++fmt;
                                                   precision = getint();
                                           }
                                           for (; strchr(SKIP2, *fmt); ++fmt)
                                                   ;
                                   }
   
                                 for (; strchr(SKIP2, *fmt); ++fmt) ;  
                                 if (!*fmt) {                                  if (!*fmt) {
                                         warnx ("missing format character");                                          warnx ("missing format character");
                                         return(1);                                          return(1);

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15