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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/bin/state.cc
          +++ new/usr/src/cmd/make/bin/state.cc
↓ open down ↓ 137 lines elided ↑ open up ↑
 138  138  
 139  139  
 140  140          if (!rewrite_statefile ||
 141  141              !command_changed ||
 142  142              !keep_state ||
 143  143              do_not_exec_rule ||
 144  144              (report_dependencies_level > 0)) {
 145  145                  return;
 146  146          }
 147  147          /* Lock the file for writing. */
 148      -        make_state_lockfile = getmem(strlen(make_state->string_mb) + strlen(NOCATGETS(".lock")) + 1);
      148 +        make_state_lockfile = getmem(strlen(make_state->string_mb) + strlen(".lock") + 1);
 149  149          (void) sprintf(make_state_lockfile,
 150      -                       NOCATGETS("%s.lock"),
      150 +                       "%s.lock",
 151  151                         make_state->string_mb);
 152  152          if (lock_err = file_lock(make_state->string_mb, 
 153  153                                   make_state_lockfile, 
 154  154                                   (int *) &make_state_locked, 0)) {
 155  155                  retmem_mb(make_state_lockfile);
 156  156                  make_state_lockfile = NULL;
 157  157                  
 158  158                  /*
 159  159                   * We need to make sure that we are not being
 160  160                   * called by the exit handler so we don't call
 161  161                   * it again.
 162  162                   */
 163  163                  
 164  164                  if (exiting) {
 165      -                        (void) sprintf(buffer, NOCATGETS("%s/.make.state.%d.XXXXXX"), tmpdir, getpid());
      165 +                        (void) sprintf(buffer, "%s/.make.state.%d.XXXXXX", tmpdir, getpid());
 166  166                          report_pwd = true;
 167      -                        warning(catgets(catd, 1, 60, "Writing to %s"), buffer);
      167 +                        warning(gettext("Writing to %s"), buffer);
 168  168                          int fdes = mkstemp(buffer);
 169  169                          if ((fdes < 0) || (fd = fdopen(fdes, "w")) == NULL) {
 170  170                                  fprintf(stderr,
 171      -                                        catgets(catd, 1, 61, "Could not open statefile `%s': %s"),
      171 +                                        gettext("Could not open statefile `%s': %s"),
 172  172                                          buffer,
 173  173                                          errmsg(errno));
 174  174                                  return;
 175  175                          }
 176  176                  } else {
 177  177                          report_pwd = true;
 178      -                        fatal(catgets(catd, 1, 62, "Can't lock .make.state"));
      178 +                        fatal(gettext("Can't lock .make.state"));
 179  179                  }
 180  180          }
 181  181  
 182  182          (void) sprintf(make_state_tempfile,
 183      -                       NOCATGETS("%s.tmp"),
      183 +                       "%s.tmp",
 184  184                         make_state->string_mb);
 185  185          /* Delete old temporary statefile (in case it exists) */
 186  186          (void) unlink(make_state_tempfile);
 187  187          if ((fd = fopen(make_state_tempfile, "w")) == NULL) {
 188  188                  lock_err = errno; /* Save it! unlink() can change errno */
 189  189                  (void) unlink(make_state_lockfile);
 190  190                  retmem_mb(make_state_lockfile);
 191  191                  make_state_lockfile = NULL;
 192  192                  make_state_locked = false;
 193      -                fatal(catgets(catd, 1, 59, "Could not open temporary statefile `%s': %s"),
      193 +                fatal(gettext("Could not open temporary statefile `%s': %s"),
 194  194                        make_state_tempfile,
 195  195                        errmsg(lock_err));
 196  196          }
 197  197          /*
 198  198           * Set a trap for failed writes. If a write fails, the routine
 199  199           * will try saving the .make.state file under another name in /tmp.
 200  200           */
 201  201          if (setjmp(long_jump)) {
 202  202                  (void) fclose(fd);
 203  203                  if (attempts++ > 5) {
 204  204                          if ((make_state_lockfile != NULL) &&
 205  205                              make_state_locked) {
 206  206                                  (void) unlink(make_state_lockfile);
 207  207                                  retmem_mb(make_state_lockfile);
 208  208                                  make_state_lockfile = NULL;
 209  209                                  make_state_locked = false;
 210  210                          }
 211      -                        fatal(catgets(catd, 1, 63, "Giving up on writing statefile"));
      211 +                        fatal(gettext("Giving up on writing statefile"));
 212  212                  }
 213  213                  sleep(10);
 214      -                (void) sprintf(buffer, NOCATGETS("%s/.make.state.%d.XXXXXX"), tmpdir, getpid());
      214 +                (void) sprintf(buffer, "%s/.make.state.%d.XXXXXX", tmpdir, getpid());
 215  215                  int fdes = mkstemp(buffer);
 216  216                  if ((fdes < 0) || (fd = fdopen(fdes, "w")) == NULL) {
 217      -                        fatal(catgets(catd, 1, 64, "Could not open statefile `%s': %s"),
      217 +                        fatal(gettext("Could not open statefile `%s': %s"),
 218  218                                buffer,
 219  219                                errmsg(errno));
 220  220                  }
 221      -                warning(catgets(catd, 1, 65, "Initial write of statefile failed. Trying again on %s"),
      221 +                warning(gettext("Initial write of statefile failed. Trying again on %s"),
 222  222                          buffer);
 223  223          }
 224  224  
 225  225          /* Write the version stamp. */
 226  226          XFWRITE(make_version->string_mb,
 227  227                  strlen(make_version->string_mb),
 228  228                  fd);
 229  229          XPUTC(colon_char, fd);
 230  230          XPUTC(tab_char, fd);
 231  231          XFWRITE(current_make_version->string_mb,
↓ open down ↓ 126 lines elided ↑ open up ↑
 358  358          }
 359  359          if (attempts == 0) {
 360  360                  if (unlink(make_state->string_mb) != 0 && errno != ENOENT) {
 361  361                          lock_err = errno; /* Save it! unlink() can change errno */
 362  362                          /* Delete temporary statefile */
 363  363                          (void) unlink(make_state_tempfile);
 364  364                          (void) unlink(make_state_lockfile);
 365  365                          retmem_mb(make_state_lockfile);
 366  366                          make_state_lockfile = NULL;
 367  367                          make_state_locked = false;
 368      -                        fatal(catgets(catd, 1, 356, "Could not delete old statefile `%s': %s"),
      368 +                        fatal(gettext("Could not delete old statefile `%s': %s"),
 369  369                                make_state->string_mb,
 370  370                                errmsg(lock_err));
 371  371                  }
 372  372                  if (rename(make_state_tempfile, make_state->string_mb) != 0) {
 373  373                          lock_err = errno; /* Save it! unlink() can change errno */
 374  374                          /* Delete temporary statefile */
 375  375                          (void) unlink(make_state_tempfile);
 376  376                          (void) unlink(make_state_lockfile);
 377  377                          retmem_mb(make_state_lockfile);
 378  378                          make_state_lockfile = NULL;
 379  379                          make_state_locked = false;
 380      -                        fatal(catgets(catd, 1, 357, "Could not rename `%s' to `%s': %s"),
      380 +                        fatal(gettext("Could not rename `%s' to `%s': %s"),
 381  381                                make_state_tempfile,
 382  382                                make_state->string_mb,
 383  383                                errmsg(lock_err));
 384  384                  }
 385  385          }
 386  386          if ((make_state_lockfile != NULL) && make_state_locked) {
 387  387                  (void) unlink(make_state_lockfile);
 388  388                  retmem_mb(make_state_lockfile);
 389  389                  make_state_lockfile = NULL;
 390  390                  make_state_locked = false;
↓ open down ↓ 54 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX