Print this page
Cstyle cleanup

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/nm/common/nm.c
          +++ new/usr/src/cmd/sgs/nm/common/nm.c
↓ open down ↓ 253 lines elided ↑ open up ↑
 254  254                                              "%s: -u or -g set, -e ignored\n"),
 255  255                                              prog_name);
 256  256                                  break;
 257  257                  case 'g':       if (!u_flag && !e_flag)
 258  258                                          g_flag = 1;
 259  259                                  else
 260  260                                          (void) fprintf(stderr, gettext(
 261  261                                              "%s: -u or -e set, -g ignored\n"),
 262  262                                              prog_name);
 263  263                                  break;
 264      -                case 'r':       if (R_flag) {
      264 +                case 'r':       if (R_flag) {
 265  265                                          R_flag = 0;
 266  266                                          (void) fprintf(stderr, gettext(
 267  267                                              "%s: -r set, -R ignored\n"),
 268  268                                              prog_name);
 269  269                                  }
 270  270                                  r_flag = 1;
 271  271                                  break;
 272  272                  case 's':       s_flag = 1;
 273  273                                  break;
 274  274                  case 'p':       if (P_flag == 1) {
↓ open down ↓ 385 lines elided ↑ open up ↑
 660  660   * set, if any.  Input is an opened ELF file, the section name,
 661  661   * the section header, the section descriptor, and the filename.
 662  662   * First get the symbol table with a call to elf_getdata.
 663  663   * Then translate the symbol table data in memory by calling
 664  664   * readsyms().  This avoids duplication of function calls
 665  665   * and improves sorting efficiency.  qsort is used when sorting
 666  666   * is requested.
 667  667   */
 668  668  static void
 669  669  print_symtab(Elf *elf_file, unsigned int shstrndx,
 670      -        Elf_Scn *p_sd, GElf_Shdr *shdr, char *filename)
      670 +    Elf_Scn *p_sd, GElf_Shdr *shdr, char *filename)
 671  671  {
 672  672  
 673  673          Elf_Data * sd;
 674  674          SYM     *sym_data;
 675  675          SYM     *s;
 676  676          GElf_Sxword     count = 0;
 677  677          const int ndigits_arr[] = {
 678  678                  10,             /* FMT_T_DEC */
 679  679                  8,              /* FMT_T_HEX */
 680  680                  11,             /* FMT_T_OCT */
↓ open down ↓ 94 lines elided ↑ open up ↑
 775  775          return (0);
 776  776  }
 777  777  
 778  778  /*
 779  779   * Translate symbol table data particularly for sorting.
 780  780   * Input is the symbol table data structure, number of symbols,
 781  781   * opened ELF file, and the string table link offset.
 782  782   */
 783  783  static SYM *
 784  784  readsyms(Elf_Data * data, GElf_Sxword num, Elf *elf,
 785      -        unsigned int link, unsigned int symscnndx)
      785 +    unsigned int link, unsigned int symscnndx)
 786  786  {
 787  787          SYM             *s, *buf;
 788  788          GElf_Sym        sym;
 789  789          Elf32_Word      *symshndx = 0;
 790  790          unsigned int    nosymshndx = 0;
 791  791          int             i;
 792  792  
 793  793          if ((buf = calloc(num, sizeof (SYM))) == NULL) {
 794  794                  (void) fprintf(stderr, gettext("%s: cannot allocate memory\n"),
 795  795                      prog_name);
↓ open down ↓ 212 lines elided ↑ open up ↑
1008 1008           *      (So basically, -f is no-op.)
1009 1009           */
1010 1010          return (1);
1011 1011  }
1012 1012  
1013 1013  #ifndef XPG4
1014 1014  /*
1015 1015   * -u flag specified
1016 1016   */
1017 1017  static void
1018      -print_with_uflag(
1019      -        SYM *sym_data,
1020      -        char *filename
1021      -)
     1018 +print_with_uflag(SYM *sym_data, char *filename)
1022 1019  {
1023 1020          if ((sym_data->shndx == SHN_UNDEF) && (strlen(sym_data->name))) {
1024 1021                  if (!r_flag) {
1025 1022                          if (R_flag) {
1026 1023                                  if (archive_name != (char *)0)
1027 1024                                          (void) printf("   %s:%s:%s\n",
1028 1025                                              archive_name, filename,
1029 1026                                              sym_data->name);
1030 1027                                  else
1031 1028                                          (void) printf("    %s:%s\n",
↓ open down ↓ 56 lines elided ↑ open up ↑
1088 1085                          (void) printf("%-2d", sym_data->type);
1089 1086                  else
1090 1087                          (void) printf("%-3d", sym_data->type);
1091 1088          }
1092 1089  }
1093 1090  
1094 1091  /*
1095 1092   * -p flag specified
1096 1093   */
1097 1094  static void
1098      -print_with_pflag(
1099      -        int ndigits,
1100      -        Elf *elf_file,
1101      -        unsigned int shstrndx,
1102      -        SYM *sym_data,
1103      -        char *filename
1104      -)
     1095 +print_with_pflag(int ndigits, Elf *elf_file, unsigned int shstrndx,
     1096 +    SYM *sym_data, char *filename)
1105 1097  {
1106 1098          const char * const fmt[] = {
1107      -                "%.*llu ",      /* FMT_T_DEC */
1108      -                "0x%.*llx ",    /* FMT_T_HEX */
1109      -                "0%.*llo "      /* FMT_T_OCT */
     1099 +            "%.*llu ",  /* FMT_T_DEC */
     1100 +            "0x%.*llx ",        /* FMT_T_HEX */
     1101 +            "0%.*llo "  /* FMT_T_OCT */
1110 1102          };
1111 1103  
1112 1104          if (is_sym_print(sym_data) != 1)
1113 1105                  return;
1114 1106          /*
1115 1107           * -A header
1116 1108           */
1117 1109          if (A_flag != 0)
1118 1110                  (void) printf("%s", A_header);
1119 1111  
↓ open down ↓ 22 lines elided ↑ open up ↑
1142 1134                          (void) printf("%s\n", sym_data->name);
1143 1135          }
1144 1136          else
1145 1137                  (void) printf("%s:%s\n", filename, sym_data->name);
1146 1138  }
1147 1139  
1148 1140  /*
1149 1141   * -P flag specified
1150 1142   */
1151 1143  static void
1152      -print_with_Pflag(
1153      -        int ndigits,
1154      -        Elf *elf_file,
1155      -        unsigned int shstrndx,
1156      -        SYM *sym_data
1157      -)
     1144 +print_with_Pflag(int ndigits, Elf *elf_file, unsigned int shstrndx,
     1145 +    SYM *sym_data)
1158 1146  {
1159 1147  #define SYM_LEN 10
1160 1148          char sym_name[SYM_LEN+1];
1161 1149          size_t len;
1162 1150          const char * const fmt[] = {
1163 1151                  "%*llu %*llu \n",       /* FMT_T_DEC */
1164 1152                  "%*llx %*llx \n",       /* FMT_T_HEX */
1165 1153                  "%*llo %*llo \n"        /* FMT_T_OCT */
1166 1154          };
1167 1155  
↓ open down ↓ 26 lines elided ↑ open up ↑
1194 1182           *      (hex/octal/decimal)
1195 1183           */
1196 1184          (void) printf(fmt[fmt_flag], ndigits, EC_ADDR(sym_data->value),
1197 1185              ndigits, EC_XWORD(sym_data->size));
1198 1186  }
1199 1187  
1200 1188  /*
1201 1189   * other flags specified
1202 1190   */
1203 1191  static void
1204      -print_with_otherflags(
1205      -        int ndigits,
1206      -        Elf *elf_file,
1207      -        unsigned int shstrndx,
1208      -        SYM *sym_data,
1209      -        char *filename
1210      -)
     1192 +print_with_otherflags(int ndigits, Elf *elf_file, unsigned int shstrndx,
     1193 +    SYM *sym_data, char *filename)
1211 1194  {
1212 1195          const char * const fmt_value_size[] = {
1213 1196                  "%*llu|%*lld|",         /* FMT_T_DEC */
1214 1197                  "0x%.*llx|0x%.*llx|",   /* FMT_T_HEX */
1215 1198                  "0%.*llo|0%.*llo|"      /* FMT_T_OCT */
1216 1199          };
1217 1200          const char * const fmt_int[] = {
1218 1201                  "%-5d",                 /* FMT_T_DEC */
1219 1202                  "%#-5x",                /* FMT_T_HEX */
1220 1203                  "%#-5o"                 /* FMT_T_OCT */
↓ open down ↓ 293 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX