Print this page
make: translate using gettext, rather than the unmaintainable catgets

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/bin/read2.cc
          +++ new/usr/src/cmd/make/bin/read2.cc
↓ open down ↓ 29 lines elided ↑ open up ↑
  30   30   */
  31   31  
  32   32  /*
  33   33   * Included files
  34   34   */
  35   35  #include <mk/defs.h>
  36   36  #include <mksh/dosys.h>         /* sh_command2string() */
  37   37  #include <mksh/macro.h>         /* expand_value() */
  38   38  #include <mksh/misc.h>          /* retmem() */
  39   39  #include <stdarg.h>             /* va_list, va_start(), va_end() */
       40 +#include <libintl.h>
  40   41  
  41   42  /*
  42   43   * Defined macros
  43   44   */
  44   45  
  45   46  /*
  46   47   * typedefs & structs
  47   48   */
  48   49  
  49   50  /*
↓ open down ↓ 614 lines elided ↑ open up ↑
 664  665  */
 665  666                  if (target->hash.length != 0)
 666  667                          default_target_to_build = target;
 667  668          }
 668  669          /* Check if the line is ":" or "::" */
 669  670          if (makefile_type == reading_makefile) {
 670  671                  if (target->colons == no_colon) {
 671  672                          target->colons = separator;
 672  673                  } else {
 673  674                          if (target->colons != separator) {
 674      -                                fatal_reader(catgets(catd, 1, 92, ":/:: conflict for target `%s'"),
      675 +                                fatal_reader(gettext(":/:: conflict for target `%s'"),
 675  676                                               target->string_mb);
 676  677                          }
 677  678                  }
 678  679                  if (target->colons == two_colon) {
 679  680                          if (depes->used == 0) {
 680  681                                  /* If this is a "::" type line with no */
 681  682                                  /* dependencies we add one "FRC" type */
 682  683                                  /* dependency for free */
 683  684                                  depes->used = 1; /* Force :: targets with no
 684  685                                                    * depes to always run */
↓ open down ↓ 113 lines elided ↑ open up ↑
 798  799                          for (dp = line->body.line.dependencies;
 799  800                               dp != NULL;
 800  801                               dp = dp->next) {
 801  802                                  if (dp->automatic) {
 802  803                                          dp->stale = true;
 803  804                                  }
 804  805                          }
 805  806                  }
 806  807                  break;
 807  808          default:
 808      -                fatal_reader(catgets(catd, 1, 93, "Internal error. Unknown makefile type %d"),
      809 +                fatal_reader(gettext("Internal error. Unknown makefile type %d"),
 809  810                               makefile_type);
 810  811          }
 811  812          /* A target may only be involved in one target group */
 812  813          if (line->body.line.target_group != NULL) {
 813  814                  if (target_group != NULL) {
 814      -                        fatal_reader(catgets(catd, 1, 94, "Too many target groups for target `%s'"),
      815 +                        fatal_reader(gettext("Too many target groups for target `%s'"),
 815  816                                       target->string_mb);
 816  817                  }
 817  818          } else {
 818  819                  line->body.line.target_group = target_group;
 819  820          }
 820  821  
 821  822          if (trace_reader) {
 822  823                  (void) printf("%s:\t", target->string_mb);
 823  824          }
 824  825          /* Enter the dependencies */
↓ open down ↓ 246 lines elided ↑ open up ↑
1071 1072          result->name = target;
1072 1073  
1073 1074  
1074 1075          /* Find the end of the dyntarget list and append the new pattern */
1075 1076          for (insert = &dyntarget_list, p = *insert;
1076 1077               p != NULL;
1077 1078               insert = &p->next, p = *insert);
1078 1079          *insert = result;
1079 1080  
1080 1081          if (trace_reader) {
1081      -                (void) printf(NOCATGETS("Dynamic target %s:\n"), result->name->string_mb);
     1082 +                (void) printf("Dynamic target %s:\n", result->name->string_mb);
1082 1083          }
1083 1084          return( result);
1084 1085  }
1085 1086  
1086 1087  
1087 1088  /*
1088 1089   *      special_reader(target, depes, command)
1089 1090   *
1090 1091   *      Read the pseudo targets make knows about
1091 1092   *      This handles the special targets that should not be entered as regular
↓ open down ↓ 34 lines elided ↑ open up ↑
1126 1127   */
1127 1128  void
1128 1129  special_reader(Name target, register Name_vector depes, Cmd_line command)
1129 1130  {
1130 1131          register int            n;
1131 1132  
1132 1133          switch (target->special_reader) {
1133 1134  
1134 1135          case svr4_special:
1135 1136                  if (depes->used != 0) {
1136      -                        fatal_reader(catgets(catd, 1, 98, "Illegal dependencies for target `%s'"),
     1137 +                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
1137 1138                                       target->string_mb);
1138 1139                  }
1139 1140                  svr4  = true;
1140 1141                  posix  = false;
1141 1142                  keep_state = false;
1142 1143                  all_parallel = false;
1143 1144                  only_parallel = false;
1144 1145                  if (trace_reader) {
1145 1146                          (void) printf("%s:\n", svr4_name->string_mb);
1146 1147                  }
1147 1148                  break;
1148 1149  
1149 1150          case posix_special:
1150 1151                  if(svr4)
1151 1152                    break;
1152 1153                  if (depes->used != 0) {
1153      -                        fatal_reader(catgets(catd, 1, 99, "Illegal dependencies for target `%s'"),
     1154 +                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
1154 1155                                       target->string_mb);
1155 1156                  }
1156 1157                  posix  = true;
1157 1158                          /* with posix on, use the posix get rule */
1158 1159                  sccs_get_rule = sccs_get_posix_rule;
1159 1160                          /* turn keep state off being SunPro make specific */
1160 1161                  keep_state = false;
1161 1162                  /* Use /usr/xpg4/bin/sh on Solaris */
1162      -                MBSTOWCS(wcs_buffer, NOCATGETS("/usr/xpg4/bin/sh"));
     1163 +                MBSTOWCS(wcs_buffer, "/usr/xpg4/bin/sh");
1163 1164                  (void) SETVAR(shell_name, GETNAME(wcs_buffer, FIND_LENGTH), false);
1164 1165                  if (trace_reader) {
1165 1166                          (void) printf("%s:\n", posix_name->string_mb);
1166 1167                  }
1167 1168                  break;
1168 1169  
1169 1170          case built_last_make_run_special:
1170 1171                  built_last_make_run_seen = true;
1171 1172                  break;
1172 1173  
1173 1174          case default_special:
1174 1175                  if (depes->used != 0) {
1175      -                        warning(catgets(catd, 1, 100, "Illegal dependency list for target `%s'"),
     1176 +                        warning(gettext("Illegal dependency list for target `%s'"),
1176 1177                                  target->string_mb);
1177 1178                  }
1178 1179                  default_rule = command;
1179 1180                  if (trace_reader) {
1180 1181                          (void) printf("%s:\n",
1181 1182                                        default_rule_name->string_mb);
1182 1183                          print_rule(command);
1183 1184                  }
1184 1185                  break;
1185 1186  
1186 1187  
1187 1188          case ignore_special:
1188 1189                  if ((depes->used != 0) &&(!posix)){
1189      -                        fatal_reader(catgets(catd, 1, 101, "Illegal dependencies for target `%s'"),
     1190 +                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
1190 1191                                       target->string_mb);
1191 1192                  }
1192 1193                  if (depes->used == 0)
1193 1194                  {
1194 1195                     ignore_errors_all = true;
1195 1196                  }
1196 1197                  if(svr4) {
1197 1198                    ignore_errors_all = true;
1198 1199                    break;
1199 1200                  }
↓ open down ↓ 7 lines elided ↑ open up ↑
1207 1208                  }
1208 1209                  break;
1209 1210  
1210 1211          case keep_state_special:
1211 1212                  if(svr4)
1212 1213                    break;
1213 1214                          /* ignore keep state, being SunPro make specific */
1214 1215                  if(posix)
1215 1216                    break;
1216 1217                  if (depes->used != 0) {
1217      -                        fatal_reader(catgets(catd, 1, 102, "Illegal dependencies for target `%s'"),
     1218 +                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
1218 1219                                       target->string_mb);
1219 1220                  }
1220 1221                  keep_state = true;
1221 1222                  if (trace_reader) {
1222 1223                          (void) printf("%s:\n",
1223 1224                                        dot_keep_state->string_mb);
1224 1225                  }
1225 1226                  break;
1226 1227  
1227 1228          case keep_state_file_special:
1228 1229                  if(svr4)
1229 1230                    break;
1230 1231                  if(posix)
1231 1232                    break;
1232 1233                          /* it's not necessary to specify KEEP_STATE, if this 
1233 1234                          ** is given, so set the keep_state.
1234 1235                          */
1235 1236                  keep_state = true;
1236 1237                  if (depes->used != 0) {
1237      -                   if((!make_state) ||(!strcmp(make_state->string_mb,NOCATGETS(".make.state")))) {
     1238 +                   if((!make_state) ||(!strcmp(make_state->string_mb,".make.state"))) {
1238 1239                       make_state = depes->names[0];
1239 1240                     }
1240 1241                  }
1241 1242                  break;
1242 1243          case make_version_special:
1243 1244                  if(svr4)
1244 1245                    break;
1245 1246                  if (depes->used != 1) {
1246      -                        fatal_reader(catgets(catd, 1, 103, "Illegal dependency list for target `%s'"),
     1247 +                        fatal_reader(gettext("Illegal dependency list for target `%s'"),
1247 1248                                       target->string_mb);
1248 1249                  }
1249 1250                  if (depes->names[0] != current_make_version) {
1250 1251                          /*
1251 1252                           * Special case the fact that version 1.0 and 1.1
1252 1253                           * are identical.
1253 1254                           */
1254 1255                          if (!IS_EQUAL(depes->names[0]->string_mb,
1255      -                                      NOCATGETS("VERSION-1.1")) ||
     1256 +                                      "VERSION-1.1") ||
1256 1257                              !IS_EQUAL(current_make_version->string_mb,
1257      -                                      NOCATGETS("VERSION-1.0"))) {
     1258 +                                      "VERSION-1.0")) {
1258 1259                                  /*
1259 1260                                   * Version mismatches should cause the
1260 1261                                   * .make.state file to be skipped.
1261 1262                                   * This is currently not true - it is read
1262 1263                                   * anyway.
1263 1264                                   */
1264      -                                warning(catgets(catd, 1, 104, "Version mismatch between current version `%s' and `%s'"),
     1265 +                                warning(gettext("Version mismatch between current version `%s' and `%s'"),
1265 1266                                          current_make_version->string_mb,
1266 1267                                          depes->names[0]->string_mb);
1267 1268                          }
1268 1269                  }
1269 1270                  break;
1270 1271  
1271 1272          case no_parallel_special:
1272 1273                  if(svr4)
1273 1274                    break;
1274 1275                  /* Set the no_parallel bit for all the targets on */
↓ open down ↓ 83 lines elided ↑ open up ↑
1358 1359                                                        precious->string_mb,
1359 1360                                                        depes->names[n]->string_mb);
1360 1361                                  }
1361 1362                                  depes->names[n]->stat.is_precious = true;
1362 1363                          }
1363 1364                  }
1364 1365                  break;
1365 1366  
1366 1367          case sccs_get_special:
1367 1368                  if (depes->used != 0) {
1368      -                        fatal_reader(catgets(catd, 1, 105, "Illegal dependencies for target `%s'"),
     1369 +                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
1369 1370                                       target->string_mb);
1370 1371                  }
1371 1372                  sccs_get_rule = command;
1372 1373                  sccs_get_org_rule = command;
1373 1374                  if (trace_reader) {
1374 1375                          (void) printf("%s:\n", sccs_get_name->string_mb);
1375 1376                          print_rule(command);
1376 1377                  }
1377 1378                  break;
1378 1379  
1379 1380          case sccs_get_posix_special:
1380 1381                  if (depes->used != 0) {
1381      -                        fatal_reader(catgets(catd, 1, 106, "Illegal dependencies for target `%s'"),
     1382 +                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
1382 1383                                       target->string_mb);
1383 1384                  }
1384 1385                  sccs_get_posix_rule = command;
1385 1386                  if (trace_reader) {
1386 1387                          (void) printf("%s:\n", sccs_get_posix_name->string_mb);
1387 1388                          print_rule(command);
1388 1389                  }
1389 1390                  break;
1390 1391  
1391 1392          case get_posix_special:
1392 1393                  if (depes->used != 0) {
1393      -                        fatal_reader(catgets(catd, 1, 107, "Illegal dependencies for target `%s'"),
     1394 +                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
1394 1395                                       target->string_mb);
1395 1396                  }
1396 1397                  get_posix_rule = command;
1397 1398                  if (trace_reader) {
1398 1399                          (void) printf("%s:\n", get_posix_name->string_mb);
1399 1400                          print_rule(command);
1400 1401                  }
1401 1402                  break;
1402 1403  
1403 1404          case get_special:
1404 1405                  if(!svr4) {
1405 1406                    break;
1406 1407                  }
1407 1408                  if (depes->used != 0) {
1408      -                        fatal_reader(catgets(catd, 1, 108, "Illegal dependencies for target `%s'"),
     1409 +                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
1409 1410                                       target->string_mb);
1410 1411                  }
1411 1412                  get_rule = command;
1412 1413                  sccs_get_rule = command;
1413 1414                  if (trace_reader) {
1414 1415                          (void) printf("%s:\n", get_name->string_mb);
1415 1416                          print_rule(command);
1416 1417                  }
1417 1418                  break;
1418 1419  
1419 1420          case silent_special:
1420 1421                  if ((depes->used != 0) && (!posix)){
1421      -                        fatal_reader(catgets(catd, 1, 109, "Illegal dependencies for target `%s'"),
     1422 +                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
1422 1423                                       target->string_mb);
1423 1424                  }
1424 1425                  if (depes->used == 0)
1425 1426                  {
1426 1427                     silent_all = true;
1427 1428                  }
1428 1429                  if(svr4) {
1429 1430                    silent_all = true;
1430 1431                    break;
1431 1432                  }
↓ open down ↓ 6 lines elided ↑ open up ↑
1438 1439                          (void) printf("%s:\n", silent_name->string_mb);
1439 1440                  }
1440 1441                  break;
1441 1442  
1442 1443          case suffixes_special:
1443 1444                  read_suffixes_list(depes);
1444 1445                  break;
1445 1446  
1446 1447          default:
1447 1448  
1448      -                fatal_reader(catgets(catd, 1, 110, "Internal error: Unknown special reader"));
     1449 +                fatal_reader(gettext("Internal error: Unknown special reader"));
1449 1450          }
1450 1451  }
1451 1452  
1452 1453  /*
1453 1454   *      read_suffixes_list(depes)
1454 1455   *
1455 1456   *      Read the special list .SUFFIXES. If it is empty the old list is
1456 1457   *      cleared. Else the new one is appended. Suffixes with ~ are extracted
1457 1458   *      and marked.
1458 1459   *
↓ open down ↓ 287 lines elided ↑ open up ↑
1746 1747          }
1747 1748          (void) SETVAR(name, value, append);
1748 1749  
1749 1750          /* if we're setting FC, we want to set F77 to the same value. */
1750 1751          Wstring nms(name);
1751 1752          wchar_t * wcb = nms.get_string();
1752 1753          string = wcb;
1753 1754          if (string[0]=='F' &&
1754 1755              string[1]=='C' &&
1755 1756              string[2]=='\0') {
1756      -                MBSTOWCS(wcs_buffer, NOCATGETS("F77"));
     1757 +                MBSTOWCS(wcs_buffer, "F77");
1757 1758                  temp = GETNAME(wcs_buffer, FIND_LENGTH);
1758 1759                  (void) SETVAR(temp, value, append);
1759 1760  /*
1760      -                fprintf(stderr, catgets(catd, 1, 111, "warning: FC is obsolete, use F77 instead\n"));
     1761 +                fprintf(stderr, gettext("warning: FC is obsolete, use F77 instead\n"));
1761 1762   */
1762 1763          }
1763 1764  
1764 1765          if (trace_reader) {
1765 1766                  if (value == NULL) {
1766 1767                          (void) printf("%s %c=\n",
1767 1768                                        name->string_mb,
1768 1769                                        append ?
1769 1770                                        (int) plus_char : (int) space_char);
1770 1771                  } else {
↓ open down ↓ 21 lines elided ↑ open up ↑
1792 1793          wchar_t         *colon;
1793 1794          String_rec      command;
1794 1795          String_rec      destination;
1795 1796          wchar_t         buffer[1000];
1796 1797          wchar_t         buffer1[1000];
1797 1798  
1798 1799          static wchar_t  colon_sh[4];
1799 1800          static wchar_t  colon_shell[7];
1800 1801  
1801 1802          if (colon_sh[0] == (int) nul_char) {
1802      -                MBSTOWCS(colon_sh, NOCATGETS(":sh"));
1803      -                MBSTOWCS(colon_shell, NOCATGETS(":shell"));
     1803 +                MBSTOWCS(colon_sh, ":sh");
     1804 +                MBSTOWCS(colon_shell, ":shell");
1804 1805          }
1805 1806          Wstring nms((*name));
1806 1807          wchar_t * wcb = nms.get_string();
1807 1808  
1808 1809          colon = (wchar_t *) wsrchr(wcb, (int) colon_char);
1809 1810          if ((colon != NULL) && (IS_WEQUAL(colon, colon_sh) || IS_WEQUAL(colon, colon_shell))) {
1810 1811                  INIT_STRING_FROM_STACK(destination, buffer);
1811 1812  
1812 1813                  if(*value == NULL) {
1813 1814                          buffer[0] = 0;
↓ open down ↓ 36 lines elided ↑ open up ↑
1850 1851  fatal_reader(char * pattern, ...)
1851 1852  {
1852 1853          va_list args;
1853 1854          char    message[1000];
1854 1855  
1855 1856          va_start(args, pattern);
1856 1857          if (file_being_read != NULL) {
1857 1858                  WCSTOMBS(mbs_buffer, file_being_read);
1858 1859                  if (line_number != 0) {
1859 1860                          (void) sprintf(message,
1860      -                                       catgets(catd, 1, 112, "%s, line %d: %s"),
     1861 +                                       gettext("%s, line %d: %s"),
1861 1862                                         mbs_buffer,
1862 1863                                         line_number,
1863 1864                                         pattern);
1864 1865                  } else {
1865 1866                          (void) sprintf(message,
1866 1867                                         "%s: %s",
1867 1868                                         mbs_buffer,
1868 1869                                         pattern);
1869 1870                  }
1870 1871                  pattern = message;
1871 1872          }
1872 1873  
1873 1874          (void) fflush(stdout);
1874      -        (void) fprintf(stderr, catgets(catd, 1, 238, "make: Fatal error in reader: "));
     1875 +        (void) fprintf(stderr, gettext("make: Fatal error in reader: "));
1875 1876          (void) vfprintf(stderr, pattern, args);
1876 1877          (void) fprintf(stderr, "\n");
1877 1878          va_end(args);
1878 1879  
1879 1880          if (temp_file_name != NULL) {
1880 1881                  (void) fprintf(stderr,
1881      -                               catgets(catd, 1, 239, "make: Temp-file %s not removed\n"),
     1882 +                               gettext("make: Temp-file %s not removed\n"),
1882 1883                                 temp_file_name->string_mb);
1883 1884                  temp_file_name = NULL;
1884 1885          }
1885 1886  
1886 1887          if (report_pwd) {
1887 1888                  (void) fprintf(stderr,
1888      -                               catgets(catd, 1, 115, "Current working directory %s\n"),
     1889 +                               gettext("Current working directory %s\n"),
1889 1890                                 get_current_path());
1890 1891          }
1891 1892          (void) fflush(stderr);
1892 1893          exit_status = 1;
1893 1894          exit(1);
1894 1895  }
1895 1896  
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX