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

Diff for /src/usr.bin/awk/run.c between version 1.54 and 1.55

version 1.54, 2020/06/10 21:03:56 version 1.55, 2020/06/10 21:04:40
Line 859 
Line 859 
                 for (t = fmt; (*t++ = *s) != '\0'; s++) {                  for (t = fmt; (*t++ = *s) != '\0'; s++) {
                         if (!adjbuf(&fmt, &fmtsz, MAXNUMSIZE+1+t-fmt, recsize, &t, "format3"))                          if (!adjbuf(&fmt, &fmtsz, MAXNUMSIZE+1+t-fmt, recsize, &t, "format3"))
                                 FATAL("format item %.30s... ran format() out of memory", os);                                  FATAL("format item %.30s... ran format() out of memory", os);
                         if (isalpha((uschar)*s) && *s != 'l' && *s != 'h' && *s != 'L')                          /* Ignore size specifiers */
                                 break;  /* the ansi panoply */                          if (strchr("hjLlqtz", *s) != NULL) {    /* the ansi panoply */
                                   t--;
                                   continue;
                           }
                           if (isalpha((uschar)*s))
                                   break;
                         if (*s == '$') {                          if (*s == '$') {
                                 FATAL("'$' not permitted in awk formats");                                  FATAL("'$' not permitted in awk formats");
                         }                          }
Line 893 
Line 898 
                 case 'f': case 'e': case 'g': case 'E': case 'G':                  case 'f': case 'e': case 'g': case 'E': case 'G':
                         flag = 'f';                          flag = 'f';
                         break;                          break;
                 case 'd': case 'i':                  case 'd': case 'i': case 'o': case 'x': case 'X': case 'u':
                         flag = 'd';                          flag = (*s == 'd' || *s == 'i') ? 'd' : 'u';
                         if(*(s-1) == 'l') break;  
                         *(t-1) = 'j';                          *(t-1) = 'j';
                         *t = 'd';  
                         *++t = '\0';  
                         break;  
                 case 'o': case 'x': case 'X': case 'u':  
                         flag = *(s-1) == 'l' ? 'd' : 'u';  
                         *(t-1) = 'l';  
                         *t = *s;                          *t = *s;
                         *++t = '\0';                          *++t = '\0';
                         break;                          break;
Line 939 
Line 937 
                 case 'a':                  case 'a':
                 case 'A':                  case 'A':
                 case 'f':       snprintf(p, BUFSZ(p), fmt, getfval(x)); break;                  case 'f':       snprintf(p, BUFSZ(p), fmt, getfval(x)); break;
                 case 'd':       snprintf(p, BUFSZ(p), fmt, (long) getfval(x)); break;                  case 'd':       snprintf(p, BUFSZ(p), fmt, (intmax_t) getfval(x)); break;
                 case 'u':       snprintf(p, BUFSZ(p), fmt, (int) getfval(x)); break;                  case 'u':       snprintf(p, BUFSZ(p), fmt, (uintmax_t) getfval(x)); break;
                 case 's':                  case 's':
                         t = getsval(x);                          t = getsval(x);
                         n = strlen(t);                          n = strlen(t);

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.55