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

Diff for /src/usr.bin/hexdump/display.c between version 1.6 and 1.7

version 1.6, 2001/07/12 05:17:10 version 1.7, 2001/11/02 19:41:06
Line 46 
Line 46 
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
   #include <err.h>
 #include "hexdump.h"  #include "hexdump.h"
   
 enum _vflag vflag = FIRST;  enum _vflag vflag = FIRST;
Line 255 
Line 256 
                     length == -1 ? need : MIN(length, need), stdin);                      length == -1 ? need : MIN(length, need), stdin);
                 if (!n) {                  if (!n) {
                         if (ferror(stdin))                          if (ferror(stdin))
                                 (void)fprintf(stderr, "hexdump: %s: %s\n",                                  warn("%s", _argv[-1]);
                                     _argv[-1], strerror(errno));  
                         ateof = 1;                          ateof = 1;
                         continue;                          continue;
                 }                  }
Line 299 
Line 299 
         for (;;) {          for (;;) {
                 if (*_argv) {                  if (*_argv) {
                         if (!(freopen(*_argv, "r", stdin))) {                          if (!(freopen(*_argv, "r", stdin))) {
                                 (void)fprintf(stderr, "hexdump: %s: %s\n",                                  warn("%s", *_argv);
                                     *_argv, strerror(errno));  
                                 exitval = 1;                                  exitval = 1;
                                 ++_argv;                                  ++_argv;
                                 continue;                                  continue;
Line 329 
Line 328 
         struct stat sbuf;          struct stat sbuf;
   
         if (statok) {          if (statok) {
                 if (fstat(fileno(stdin), &sbuf)) {                  if (fstat(fileno(stdin), &sbuf))
                         (void)fprintf(stderr, "hexdump: %s: %s.\n",                          err(1, "%s", fname);
                             fname, strerror(errno));  
                         exit(1);  
                 }  
                 if (skip >= sbuf.st_size) {                  if (skip >= sbuf.st_size) {
                         skip -= sbuf.st_size;                          skip -= sbuf.st_size;
                         address += sbuf.st_size;                          address += sbuf.st_size;
                         return;                          return;
                 }                  }
         }          }
         if (fseek(stdin, skip, SEEK_SET)) {          if (fseek(stdin, skip, SEEK_SET))
                 (void)fprintf(stderr, "hexdump: %s: %s.\n",                  err(1, "%s", fname);
                     fname, strerror(errno));  
                 exit(1);  
         }  
         savaddress = address += skip;          savaddress = address += skip;
         skip = 0;          skip = 0;
 }  }
Line 356 
Line 349 
         char *p;          char *p;
   
         if (!(p = malloc((u_int)size)))          if (!(p = malloc((u_int)size)))
                 nomem();                  err(1, "malloc");
         bzero(p, size);          bzero(p, size);
         return(p);          return(p);
 }  
   
 void  
 nomem()  
 {  
         (void)fprintf(stderr, "hexdump: %s.\n", strerror(errno));  
         exit(1);  
 }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7