[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.3 and 1.4

version 1.3, 1997/01/17 07:13:06 version 1.4, 2000/12/22 22:53:10
Line 221 
Line 221 
                                 }                                  }
                                 case 'd':                                  case 'd':
                                 case 'i': {                                  case 'i': {
                                           long p;
                                         char *f = mklong(start, convch);                                          char *f = mklong(start, convch);
                                         long p = getlong();                                          if (!f) {
                                                   warnx("out of memory");
                                                   return (1);
                                           }
                                           p = getlong();
                                         PF(f, p);                                          PF(f, p);
                                         break;                                          break;
                                 }                                  }
Line 230 
Line 235 
                                 case 'u':                                  case 'u':
                                 case 'x':                                  case 'x':
                                 case 'X': {                                  case 'X': {
                                           unsigned long p;
                                         char *f = mklong(start, convch);                                          char *f = mklong(start, convch);
                                         unsigned long p = getulong();                                          if (!f) {
                                                   warnx("out of memory");
                                                   return (1);
                                           }
                                           p = getulong();
                                         PF(f, p);                                          PF(f, p);
                                         break;                                          break;
                                 }                                  }
Line 412 
Line 422 
         const char *str;          const char *str;
         char ch;          char ch;
 {  {
         static char copy[64];          static char *copy;
           static int copysize;
         int len;          int len;
   
         len = strlen(str) + 2;          len = strlen(str) + 2;
           if (copysize < len) {
                   char *newcopy;
                   copysize = len + 256;
   
                   newcopy = realloc(copy, copysize);
                   if (newcopy == NULL) {
                           copysize = 0;
                           free(copy);
                           copy = NULL;
                           return (NULL);
                   }
                   copy = newcopy;
           }
         (void) memmove(copy, str, len - 3);          (void) memmove(copy, str, len - 3);
         copy[len - 3] = 'l';          copy[len - 3] = 'l';
         copy[len - 2] = ch;          copy[len - 2] = ch;

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4