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

Diff for /src/usr.bin/nm/nm.c between version 1.24 and 1.25

version 1.24, 2004/04/29 13:34:37 version 1.25, 2004/05/04 23:09:07
Line 115 
Line 115 
 int     process_file(int, const char *);  int     process_file(int, const char *);
 int     show_archive(int, const char *, FILE *);  int     show_archive(int, const char *, FILE *);
 int     show_file(int, int, const char *, FILE *fp, off_t, union hdr *);  int     show_file(int, int, const char *, FILE *fp, off_t, union hdr *);
 void    print_symbol(const char *, struct nlist *, int);  void    print_symbol(const char *, struct nlist *, int);
 int     elf_symload(const char *, FILE *, off_t, Elf_Ehdr *, Elf_Shdr *);  int     elf_symload(const char *, FILE *, off_t, Elf_Ehdr *, Elf_Shdr *);
   
 #define OPTSTRING_NM    "aABCegnoprsuvVw"  #define OPTSTRING_NM    "aABCegnoprsuvVw"
Line 249 
Line 249 
         int retval;          int retval;
         size_t bytes;          size_t bytes;
         char magic[SARMAG];          char magic[SARMAG];
   
         if (!(fp = fopen(fname, "r"))) {          if (!(fp = fopen(fname, "r"))) {
                 warn("cannot read %s", fname);                  warn("cannot read %s", fname);
                 return(1);                  return(1);
Line 257 
Line 257 
   
         if (!issize && count > 1)          if (!issize && count > 1)
                 (void)printf("\n%s:\n", fname);                  (void)printf("\n%s:\n", fname);
   
         /*          /*
          * first check whether this is an object file - read a object           * first check whether this is an object file - read a object
          * header, and skip back to the beginning           * header, and skip back to the beginning
Line 322 
Line 322 
          */           */
         if ((arh->ar_name[0] == '#') &&          if ((arh->ar_name[0] == '#') &&
             (arh->ar_name[1] == '1') &&              (arh->ar_name[1] == '1') &&
             (arh->ar_name[2] == '/') &&              (arh->ar_name[2] == '/') &&
             (isdigit(arh->ar_name[3]))) {              (isdigit(arh->ar_name[3]))) {
                 int len = atoi(&arh->ar_name[3]);                  int len = atoi(&arh->ar_name[3]);
   
Line 607 
Line 607 
                 rval |= show_file(2, non_object_warning, name, fp, foff, &exec_head);                  rval |= show_file(2, non_object_warning, name, fp, foff, &exec_head);
                 /*                  /*
                  * skip to next archive object - it starts at the next                   * skip to next archive object - it starts at the next
                  * even byte boundary                   * even byte boundary
                  */                   */
 #define even(x) (((x) + 1) & ~1)  #define even(x) (((x) + 1) & ~1)
 skip:           if (fseeko(fp, last_ar_off + even(mmbrlen), SEEK_SET)) {  skip:           if (fseeko(fp, last_ar_off + even(mmbrlen), SEEK_SET)) {
Line 959 
Line 959 
                         free(snames);                          free(snames);
                 return (1);                  return (1);
         }          }
   
         return (0);          return (0);
 }  }
   
 char *  char *
 symname(struct nlist *sym)  symname(struct nlist *sym)
 {  {
         if (demangle && sym->n_un.n_name[0] == '_')          if (demangle && sym->n_un.n_name[0] == '_')
                 return sym->n_un.n_name + 1;                  return sym->n_un.n_name + 1;
         else          else
                 return sym->n_un.n_name;                  return sym->n_un.n_name;
Line 988 
Line 988 
          */           */
         if (!print_only_undefined_symbols) {          if (!print_only_undefined_symbols) {
                 /* print symbol's value */                  /* print symbol's value */
                 if (SYMBOL_TYPE(sym->n_type) == N_UNDF ||                  if (SYMBOL_TYPE(sym->n_type) == N_UNDF ||
                     (show_extensions && SYMBOL_TYPE(sym->n_type) == N_INDR &&                      (show_extensions && SYMBOL_TYPE(sym->n_type) == N_INDR &&
                      sym->n_value == 0))                      sym->n_value == 0))
                         (void)printf("        ");                          (void)printf("        ");
                 else                  else
                         (void)printf("%08lx", sym->n_value);                          (void)printf("%08lx", sym->n_value);

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25