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

Diff for /src/usr.bin/strings/Attic/strings.c between version 1.11 and 1.12

version 1.11, 2003/06/10 22:20:52 version 1.12, 2003/10/02 05:10:03
Line 54 
Line 54 
 #include <string.h>  #include <string.h>
 #include <locale.h>  #include <locale.h>
 #include <unistd.h>  #include <unistd.h>
   #include <err.h>
   
 #define FORMAT_DEC "%07ld "  #define FORMAT_DEC "%07ld "
 #define FORMAT_OCT "%07lo "  #define FORMAT_OCT "%07lo "
Line 154 
Line 155 
   
         if (minlen == -1)          if (minlen == -1)
                 minlen = DEF_LEN;                  minlen = DEF_LEN;
         else if (minlen < 1) {          else if (minlen < 1)
                 (void)fprintf(stderr, "strings: length less than 1\n");                  errx(1, "length less than 1");
                 exit (1);          if (maxlen != -1 && maxlen < minlen)
         }                  errx(1, "max length less than min");
         if (maxlen != -1 && maxlen < minlen) {  
                 (void)fprintf(stderr, "strings: max length less than min\n");  
                 exit (1);  
         }  
         bfrlen = maxlen == -1 ? minlen : maxlen;          bfrlen = maxlen == -1 ? minlen : maxlen;
         bfr = malloc(bfrlen + 1);          bfr = malloc(bfrlen + 1);
         if (!bfr) {          if (!bfr)
                 (void)fprintf(stderr, "strings: %s\n", strerror(errno));                  err(1, "malloc");
                 exit(1);  
         }  
         bfr[bfrlen] = '\0';          bfr[bfrlen] = '\0';
         file = "stdin";          file = "stdin";
         do {          do {
                 if (*argv) {                  if (*argv) {
                         file = *argv++;                          file = *argv++;
                         if (!freopen(file, "r", stdin)) {                          if (!freopen(file, "r", stdin)) {
                                 (void)fprintf(stderr,                                  warn("%s", file);
                                     "strings: %s: %s\n", file, strerror(errno));  
                                 exitcode = 1;                                  exitcode = 1;
                                 goto nextfile;                                  goto nextfile;
                         }                          }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12