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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/bin/implicit.cc
          +++ new/usr/src/cmd/make/bin/implicit.cc
↓ open down ↓ 27 lines elided ↑ open up ↑
  28   28   *
  29   29   *      Handle suffix and percent rules
  30   30   */
  31   31  
  32   32  /*
  33   33   * Included files
  34   34   */
  35   35  #include <mk/defs.h>
  36   36  #include <mksh/macro.h>         /* expand_value() */
  37   37  #include <mksh/misc.h>          /* retmem() */
       38 +#include <libintl.h>
  38   39  
  39   40  /*
  40   41   * Defined macros
  41   42   */
  42   43  
  43   44  /*
  44   45   * typedefs & structs
  45   46   */
  46   47  
  47   48  /*
↓ open down ↓ 84 lines elided ↑ open up ↑
 132  133  
 133  134          /*
 134  135           * If the target is a constructed one for a "::" target,
 135  136           * we need to consider that.
 136  137           */
 137  138          if (target->has_target_prop) {
 138  139                  true_target = get_prop(target->prop,
 139  140                                         target_prop)->body.target.target;
 140  141          }
 141  142          if (debug_level > 1) {
 142      -                (void) printf(NOCATGETS("%*sfind_suffix_rule(%s,%s,%s)\n"),
      143 +                (void) printf("%*sfind_suffix_rule(%s,%s,%s)\n",
 143  144                                recursion_level,
 144  145                                "",
 145  146                                true_target->string_mb,
 146  147                                target_body->string_mb,
 147  148                                target_suffix->string_mb);
 148  149          }
 149  150          if (command != NULL) {
 150  151                  if ((true_target->suffix_scan_done == true) && (*command == NULL)) {
 151  152                          return build_ok;
 152  153                  }
↓ open down ↓ 29 lines elided ↑ open up ↑
 182  183                          (void) mbstowcs(put_suffix,
 183  184                                        source_suffix->body.
 184  185                                        suffix.suffix->string_mb,
 185  186                                        (int) source_suffix->body.
 186  187                                        suffix.suffix->hash.length);
 187  188                          put_suffix[source_suffix->body.
 188  189                                     suffix.suffix->hash.length] =
 189  190                            (int) nul_char;
 190  191                          if (debug_level > 1) {
 191  192                                  WCSTOMBS(mbs_buffer, sourcename);
 192      -                                (void) printf(catgets(catd, 1, 218, "%*sTrying %s\n"),
      193 +                                (void) printf(gettext("%*sTrying %s\n"),
 193  194                                                recursion_level,
 194  195                                                "",
 195  196                                                mbs_buffer);
 196  197                          }
 197  198                          source = getname_fn(sourcename, FIND_LENGTH, false, &name_found);
 198  199                          /*
 199  200                           * If the source file is not registered as
 200  201                           * a file, this source suffix did not match.
 201  202                           */
 202  203                          if(vpath_defined && !posix && !svr4) {
↓ open down ↓ 29 lines elided ↑ open up ↑
 232  233                                  source->string_mb[source->hash.length - 1] = '\0';
 233  234                                  if(p = (char *) memchr((char *)source->string_mb,'/',source->hash.length)) 
 234  235                                  {
 235  236                                    while(1) {    
 236  237                                      if(np = (char *) memchr((char *)p+1,'/',source->hash.length - (p - source->string_mb))) {
 237  238                                        p = np;
 238  239                                      } else {break;}
 239  240                                    }
 240  241                                    /* copy everything including '/' */
 241  242                                    strncpy(tmpbuf, source->string_mb, p - source->string_mb + 1);
 242      -                                  strcat(tmpbuf, NOCATGETS("s."));
      243 +                                  strcat(tmpbuf, "s.");
 243  244                                    strcat(tmpbuf, p+1);
 244  245                                    retmem((wchar_t *) source->string_mb); 
 245  246                                    source->string_mb = tmpbuf;
 246  247                                  
 247  248                                  } else {
 248      -                                  strcpy(tmpbuf, NOCATGETS("s."));
      249 +                                  strcpy(tmpbuf, "s.");
 249  250                                    strcat(tmpbuf, source->string_mb);
 250  251                                    retmem((wchar_t *) source->string_mb); 
 251  252                                    source->string_mb = tmpbuf;
 252  253                                  
 253  254                                  }
 254  255                                  source->hash.length = strlen(source->string_mb);
 255  256                                  if(exists(source) == file_doesnt_exist)
 256  257                                    continue;
 257  258                                  tilde_rule = true;
 258  259                                  we_are_in_tilde = true;
↓ open down ↓ 83 lines elided ↑ open up ↑
 342  343                                          store_name(source);
 343  344                                  }
 344  345                                  if (sourcename != static_string_buf_3M) {
 345  346                                          retmem(sourcename);
 346  347                                  }
 347  348                                  return build_failed;
 348  349                          }
 349  350                          
 350  351                          if (debug_level > 1) {
 351  352                                  WCSTOMBS(mbs_buffer, sourcename);
 352      -                                (void) printf(catgets(catd, 1, 219, "%*sFound %s\n"),
      353 +                                (void) printf(gettext("%*sFound %s\n"),
 353  354                                                recursion_level,
 354  355                                                "",
 355  356                                                mbs_buffer);
 356  357                          }
 357  358                          
 358  359                          if (source->depends_on_conditional) {
 359  360                                  target->depends_on_conditional = true;
 360  361                          }
 361  362  /*
 362  363   * Since it is possible that the same target is built several times during
 363  364   * the make run, we have to patch the target with all information we found
 364  365   * here. Thus, the target will have an explicit rule the next time around.
 365  366   */
 366  367                          line = maybe_append_prop(target, line_prop);
 367  368                          if (*command == NULL) {
 368  369                                  *command = line;
 369  370                          }
 370  371                          if ((source->stat.time > (*command)->body.line.dependency_time) &&
 371  372                              (debug_level > 1)) {
 372      -                                (void) printf(catgets(catd, 1, 220, "%*sDate(%s)=%s Date-dependencies(%s)=%s\n"),
      373 +                                (void) printf(gettext("%*sDate(%s)=%s Date-dependencies(%s)=%s\n"),
 373  374                                                recursion_level,
 374  375                                                "",
 375  376                                                source->string_mb,
 376  377                                                time_to_string(source->
 377  378                                                               stat.time),
 378  379                                                true_target->string_mb,
 379  380                                                time_to_string((*command)->
 380  381                                                               body.line.
 381  382                                                               dependency_time));
 382  383                          }
↓ open down ↓ 10 lines elided ↑ open up ↑
 393  394                                                                          (*command)->body.line.dependency_time);
 394  395                          } else {
 395  396                                  out_of_date = (Boolean) OUT_OF_DATE(target->stat.time,
 396  397                                                                      (*command)->body.line.dependency_time);
 397  398                          }
 398  399                          if (build_unconditional || out_of_date) {
 399  400                                  if(!rechecking) {
 400  401                                          line->body.line.is_out_of_date = true;
 401  402                                  }
 402  403                                  if (debug_level > 0) {
 403      -                                        (void) printf(catgets(catd, 1, 221, "%*sBuilding %s using suffix rule for %s%s because it is out of date relative to %s\n"),
      404 +                                        (void) printf(gettext("%*sBuilding %s using suffix rule for %s%s because it is out of date relative to %s\n"),
 404  405                                                        recursion_level,
 405  406                                                        "",
 406  407                                                        true_target->string_mb,
 407  408                                                        source_suffix->body.suffix.suffix->string_mb,
 408  409                                                        target_suffix->string_mb,
 409  410                                                        source->string_mb);
 410  411                                  }
 411  412                          }
 412  413                          /*
 413  414                           * Add the implicit rule as the target's explicit
↓ open down ↓ 15 lines elided ↑ open up ↑
 429  430                           * $* and $< bound properly.
 430  431                           */
 431  432                          line->body.line.star = target_body;
 432  433                          if(svr4|posix) {
 433  434                            char * p;
 434  435                            char tstr[256];
 435  436                            extern Boolean dollarless_flag;
 436  437                            extern Name dollarless_value;
 437  438  
 438  439                            if(tilde_rule) {
 439      -                              MBSTOWCS(wcs_buffer, NOCATGETS(source->string_mb));
      440 +                              MBSTOWCS(wcs_buffer, source->string_mb);
 440  441                                dollarless_value = GETNAME(wcs_buffer,FIND_LENGTH);
 441  442                            }
 442  443                            else {
 443  444                                     dollarless_flag = false;
 444  445                            }
 445  446                          }
 446  447                          line->body.line.less = source;
 447  448                          line->body.line.percent = NULL;
 448  449                          add_target_to_chain(source, &(line->body.line.query));
 449  450                          if (sourcename != static_string_buf_3M) {
↓ open down ↓ 49 lines elided ↑ open up ↑
 499  500          register Dependency     suffix;
 500  501          register int            suffix_length;
 501  502          Property                line;
 502  503          Name                    body;
 503  504          static Name             dot_a;
 504  505  
 505  506          Wstring                 targ_string(true_target);
 506  507          Wstring                 suf_string;
 507  508  
 508  509          if (dot_a == NULL) {
 509      -                MBSTOWCS(wcs_buffer, NOCATGETS(".a"));
      510 +                MBSTOWCS(wcs_buffer, ".a");
 510  511                  dot_a = GETNAME(wcs_buffer, FIND_LENGTH);
 511  512          }
 512  513          target_end = targ_string.get_string() + true_target->hash.length;
 513  514  
 514  515          /*
 515  516           * We compare the tail of the target name with the suffixes
 516  517           * from .SUFFIXES.
 517  518           */
 518  519          if (debug_level > 1) {
 519      -                (void) printf(NOCATGETS("%*sfind_ar_suffix_rule(%s)\n"),
      520 +                (void) printf("%*sfind_ar_suffix_rule(%s)\n",
 520  521                                recursion_level,
 521  522                                "",
 522  523                                true_target->string_mb);
 523  524          }
 524  525          /*
 525  526           * Scan the .SUFFIXES list to see if the target matches any of
 526  527           * those suffixes.
 527  528           */
 528  529          for (suffix = suffixes; suffix != NULL; suffix = suffix->next) {
 529  530                  /* Compare one suffix. */
↓ open down ↓ 80 lines elided ↑ open up ↑
 610  611                                         target_prop)->body.target.target;
 611  612          }
 612  613          targ_string.init(true_target);
 613  614  
 614  615          /*
 615  616           * We compare the tail of the target name with the
 616  617           * suffixes from .SUFFIXES.
 617  618           */
 618  619          target_end = targ_string.get_string() + true_target->hash.length;
 619  620          if (debug_level > 1) {
 620      -                (void) printf(NOCATGETS("%*sfind_double_suffix_rule(%s)\n"),
      621 +                (void) printf("%*sfind_double_suffix_rule(%s)\n",
 621  622                                recursion_level,
 622  623                                "",
 623  624                                true_target->string_mb);
 624  625          }
 625  626          /*
 626  627           * Scan the .SUFFIXES list to see if the target matches
 627  628           * any of those suffixes.
 628  629           */
 629  630          for (suffix = suffixes; suffix != NULL; suffix = suffix->next) {
 630  631                  target->suffix_scan_done = false;
↓ open down ↓ 71 lines elided ↑ open up ↑
 702  703          register Property       line;
 703  704          register Property       suffix;
 704  705          Name                    rule;
 705  706  
 706  707          /* If this is before default.mk has been read we just return to try */
 707  708          /* again later */
 708  709          if ((suffixes == NULL) || !working_on_targets) {
 709  710                  return;
 710  711          }
 711  712          if (debug_level > 1) {
 712      -                (void) printf(NOCATGETS("%*sbuild_suffix_list(%s) "),
      713 +                (void) printf("%*sbuild_suffix_list(%s) ",
 713  714                                recursion_level,
 714  715                                "",
 715  716                                target_suffix->string_mb);
 716  717          }
 717  718          /* Mark the target suffix saying we cashed its list */
 718  719          target_suffix->has_read_suffixes = true;
 719  720          /* Scan the .SUFFIXES list */
 720  721          for (source_suffix = suffixes;
 721  722               source_suffix != NULL;
 722  723               source_suffix = source_suffix->next) {
↓ open down ↓ 92 lines elided ↑ open up ↑
 815  816          /* If the target is constructed for a "::" target we consider that */
 816  817          if (target->has_target_prop) {
 817  818                  true_target = get_prop(target->prop,
 818  819                                         target_prop)->body.target.target;
 819  820          }
 820  821          if (target->has_long_member_name) {
 821  822                  true_target = get_prop(target->prop,
 822  823                                         long_member_name_prop)->body.long_member_name.member_name;
 823  824          }
 824  825          if (debug_level > 1) {
 825      -                (void) printf(catgets(catd, 1, 222, "%*sLooking for %% rule for %s\n"),
      826 +                (void) printf(gettext("%*sLooking for %% rule for %s\n"),
 826  827                                recursion_level,
 827  828                                "",
 828  829                                true_target->string_mb);
 829  830          }
 830  831          for (pat_rule = percent_list;
 831  832               pat_rule != NULL;
 832  833               pat_rule = pat_rule->next) {
 833  834                  /* Avoid infinite recursion when expanding patterns */
 834  835                  if (pat_rule->being_expanded == true) {
 835  836                          continue;
↓ open down ↓ 60 lines elided ↑ open up ↑
 896  897                                          }
 897  898                                          if (less == NULL) {
 898  899                                                  less = depe_to_check;
 899  900                                          }
 900  901                                  }
 901  902  
 902  903                                  if (depe_to_check == empty_name) {
 903  904                                                  result = build_ok;
 904  905                                  } else {
 905  906                                          if (debug_level > 1) {
 906      -                                                (void) printf(catgets(catd, 1, 223, "%*sTrying %s\n"),
      907 +                                                (void) printf(gettext("%*sTrying %s\n"),
 907  908                                                                recursion_level,
 908  909                                                                "",
 909  910                                                                depe_to_check->string_mb);
 910  911                                          }
 911  912  
 912  913                                          pat_rule->being_expanded = true;
 913  914  
 914  915                                          /* suppress message output */
 915  916                                          int save_debug_level = debug_level;
 916  917                                          debug_level = 0;
↓ open down ↓ 69 lines elided ↑ open up ↑
 986  987          /* if we are performing only check whether dependency could be built with existing rules,
 987  988             return success */
 988  989          if (command == NULL) {
 989  990                  if(pat_rule != NULL) {
 990  991                          pat_rule->being_expanded = false;
 991  992                  }
 992  993                  return result;
 993  994          }
 994  995  
 995  996          if (debug_level > 1) {
 996      -                (void) printf(catgets(catd, 1, 224, "%*sMatched %s:"),
      997 +                (void) printf(gettext("%*sMatched %s:"),
 997  998                                        recursion_level,
 998  999                                        "",
 999 1000                                        target->string_mb);
1000 1001  
1001 1002                  for (pat_depe = pat_rule->dependencies;
1002 1003                       pat_depe != NULL;
1003 1004                       pat_depe = pat_depe->next) {
1004 1005                          if (pat_depe->name->percent) {
1005 1006                                  INIT_STRING_FROM_STACK(string, string_buf);
1006 1007                                  construct_string_from_pattern(pat_depe, &percent, &string);
↓ open down ↓ 5 lines elided ↑ open up ↑
1012 1013                                          expand_value(depe_to_check, &string, false);
1013 1014                                          depe_to_check = GETNAME(string.buffer.start, FIND_LENGTH);
1014 1015                                  }
1015 1016                          }
1016 1017  
1017 1018                          if (depe_to_check != empty_name) {
1018 1019                                  (void) printf(" %s", depe_to_check->string_mb);
1019 1020                          }
1020 1021                  }
1021 1022  
1022      -                (void) printf(catgets(catd, 1, 225, " from: %s:"),
     1023 +                (void) printf(gettext(" from: %s:"),
1023 1024                                pat_rule->name->string_mb);
1024 1025  
1025 1026                  for (pat_depe = pat_rule->dependencies;
1026 1027                       pat_depe != NULL;
1027 1028                       pat_depe = pat_depe->next) {
1028 1029                          (void) printf(" %s", pat_depe->name->string_mb);
1029 1030                  }
1030 1031  
1031 1032                  (void) printf("\n");
1032 1033          }
↓ open down ↓ 29 lines elided ↑ open up ↑
1062 1063                                  pat_rule->being_expanded = false;
1063 1064                                  return build_failed;
1064 1065                          }
1065 1066                          if (result == build_running) {
1066 1067                                  pat_rule->being_expanded = false;
1067 1068                                  return build_running;
1068 1069                          }
1069 1070  
1070 1071                          if ((depe->name->stat.time > line->body.line.dependency_time) &&
1071 1072                              (debug_level > 1)) {
1072      -                                (void) printf(catgets(catd, 1, 226, "%*sDate(%s)=%s Date-dependencies(%s)=%s\n"),
     1073 +                                (void) printf(gettext("%*sDate(%s)=%s Date-dependencies(%s)=%s\n"),
1073 1074                                                recursion_level,
1074 1075                                                "",
1075 1076                                                depe->name->string_mb,
1076 1077                                                time_to_string(depe->name->stat.time),
1077 1078                                                true_target->string_mb,
1078 1079                                                time_to_string(line->body.line.dependency_time));
1079 1080                          }
1080 1081  
1081 1082                          line->body.line.dependency_time =
1082 1083                            MAX(line->body.line.dependency_time, depe->name->stat.time);
↓ open down ↓ 5 lines elided ↑ open up ↑
1088 1089                          } else {
1089 1090                                  out_of_date = (Boolean) OUT_OF_DATE(target->stat.time, depe->name->stat.time);
1090 1091                          }
1091 1092                          if (build_unconditional || out_of_date) {
1092 1093                                  if(!rechecking) {
1093 1094                                          line->body.line.is_out_of_date = true;
1094 1095                                  }
1095 1096                                  add_target_to_chain(depe->name, &(line->body.line.query));
1096 1097  
1097 1098                                  if (debug_level > 0) {
1098      -                                        (void) printf(catgets(catd, 1, 227, "%*sBuilding %s using pattern rule %s:"),
     1099 +                                        (void) printf(gettext("%*sBuilding %s using pattern rule %s:"),
1099 1100                                                        recursion_level,
1100 1101                                                        "",
1101 1102                                                        true_target->string_mb,
1102 1103                                                        pat_rule->name->string_mb);
1103 1104  
1104 1105                                          for (pat_depe = pat_rule->dependencies;
1105 1106                                               pat_depe != NULL;
1106 1107                                               pat_depe = pat_depe->next) {
1107 1108                                                  (void) printf(" %s", pat_depe->name->string_mb);
1108 1109                                          }
1109 1110  
1110      -                                        (void) printf(catgets(catd, 1, 228, " because it is out of date relative to %s\n"), 
     1111 +                                        (void) printf(gettext(" because it is out of date relative to %s\n"), 
1111 1112                                                        depe->name->string_mb);
1112 1113                                  }       
1113 1114                          }
1114 1115                  }
1115 1116          } else {
1116 1117                  if ((true_target->stat.time <= file_doesnt_exist) ||
1117 1118                      (true_target->stat.time < line->body.line.dependency_time)) {
1118 1119                          if(!rechecking) {
1119 1120                                  line->body.line.is_out_of_date = true;
1120 1121                          }
1121 1122                          if (debug_level > 0) {
1122      -                                (void) printf(catgets(catd, 1, 229, "%*sBuilding %s using pattern rule %s: "),
     1123 +                                (void) printf(gettext("%*sBuilding %s using pattern rule %s: "),
1123 1124                                                recursion_level,
1124 1125                                                "",
1125 1126                                                true_target->string_mb,
1126 1127                                                pat_rule->name->string_mb,
1127 1128                                                (target->stat.time > file_doesnt_exist) ?
1128      -                                              catgets(catd, 1, 230, "because it is out of date") :
1129      -                                              catgets(catd, 1, 236, "because it does not exist"));
     1129 +                                              gettext("because it is out of date") :
     1130 +                                              gettext("because it does not exist"));
1130 1131                          }
1131 1132                  }
1132 1133          }
1133 1134  
1134 1135          /* enter explicit rule from percent rule */     
1135 1136          Name lmn_target = true_target;
1136 1137          if (true_target->has_long_member_name) {
1137 1138                  lmn_target = get_prop(true_target->prop, long_member_name_prop)->body.long_member_name.member_name;
1138 1139          }
1139 1140          line->body.line.sccs_command = false;
↓ open down ↓ 324 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX