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

Diff for /src/usr.bin/strip/Attic/strip.c between version 1.6 and 1.7

version 1.6, 1997/01/15 23:43:15 version 1.7, 1997/02/09 16:37:13
Line 55 
Line 55 
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
   #include <err.h>
   
 typedef struct exec EXEC;  typedef struct exec EXEC;
 typedef struct nlist NLIST;  typedef struct nlist NLIST;
   
 #define strx    n_un.n_strx  #define strx    n_un.n_strx
   
 void err __P((const char *fmt, ...));  
 int s_stab __P((const char *, int, EXEC *, struct stat *));  int s_stab __P((const char *, int, EXEC *, struct stat *));
 int s_sym __P((const char *, int, EXEC *, struct stat *));  int s_sym __P((const char *, int, EXEC *, struct stat *));
 void usage __P((void));  void usage __P((void));
Line 96 
Line 96 
         argv += optind;          argv += optind;
   
         errors = 0;          errors = 0;
 #define ERROR(x) errors |= 1; err("%s: %s", fn, strerror(x)); continue;  #define ERROR(x) errors |= 1; warn(fn); continue;
         while (fn = *argv++) {          while (fn = *argv++) {
                 if ((fd = open(fn, O_RDWR)) < 0) {                  if ((fd = open(fn, O_RDWR)) < 0) {
                         ERROR(errno);                          ERROR(errno);
Line 193 
Line 193 
   
         /* Truncate the file. */          /* Truncate the file. */
         if (ftruncate(fd, neweof - (char *)ep)) {          if (ftruncate(fd, neweof - (char *)ep)) {
                 err("%s: %s", fn, strerror(errno));                  warn(fn);
                 return 1;                  return 1;
         }          }
   
Line 217 
Line 217 
                 return 0;                  return 0;
   
         if (N_SYMOFF(*ep) >= sp->st_size) {          if (N_SYMOFF(*ep) >= sp->st_size) {
                 err("%s: bad symbol table", fn);                  warnx("%s: bad symbol table", fn);
                 return 1;                  return 1;
         }          }
   
Line 235 
Line 235 
          */           */
         strbase = (char *)ep + N_STROFF(*ep);          strbase = (char *)ep + N_STROFF(*ep);
         if ((nstrbase = malloc((u_int)*(u_long *)strbase)) == NULL) {          if ((nstrbase = malloc((u_int)*(u_long *)strbase)) == NULL) {
                 err("%s", strerror(ENOMEM));                  warnx("%s", strerror(ENOMEM));
                 return 1;                  return 1;
         }          }
         nstr = nstrbase + sizeof(u_long);          nstr = nstrbase + sizeof(u_long);
Line 279 
Line 279 
   
         /* Truncate to the current length. */          /* Truncate to the current length. */
         if (ftruncate(fd, (char *)nsym + len - (char *)ep)) {          if (ftruncate(fd, (char *)nsym + len - (char *)ep)) {
                 err("%s: %s", fn, strerror(errno));                  warn(fn);
                 return 1;                  return 1;
         }          }
   
Line 293 
Line 293 
         exit(1);          exit(1);
 }  }
   
 #if __STDC__  
 #include <stdarg.h>  
 #else  
 #include <varargs.h>  
 #endif  
   
 void  
 #if __STDC__  
 err(const char *fmt, ...)  
 #else  
 err(fmt, va_alist)  
         char *fmt;  
         va_dcl  
 #endif  
 {  
         va_list ap;  
 #if __STDC__  
         va_start(ap, fmt);  
 #else  
         va_start(ap);  
 #endif  
         (void)fprintf(stderr, "strip: ");  
         (void)vfprintf(stderr, fmt, ap);  
         va_end(ap);  
         (void)fprintf(stderr, "\n");  
 }  

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