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

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/lib/vroot/report.cc
          +++ new/usr/src/cmd/make/lib/vroot/report.cc
↓ open down ↓ 21 lines elided ↑ open up ↑
  22   22   * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  #include <stdio.h>
  27   27  #include <stdlib.h>
  28   28  #include <string.h>
  29   29  #include <sys/param.h>
  30   30  #include <sys/wait.h>
  31   31  #include <unistd.h>
       32 +#include <libintl.h>
  32   33  
  33   34  #include <vroot/report.h>
  34   35  #include <vroot/vroot.h>
  35      -#include <mksdmsi18n/mksdmsi18n.h>
  36      -#include <avo/intl.h>   /* for NOCATGETS */
  37   36  #include <mk/defs.h>    /* for tmpdir */
  38   37  
  39   38  static  FILE    *report_file;
  40   39  static  FILE    *command_output_fp;
  41   40  static  char    *target_being_reported_for;
  42   41  static  char    *search_dir;
  43   42  static  char    command_output_tmpfile[30];
  44   43  static  int     is_path = 0;
  45   44  static  char    sfile[MAXPATHLEN];
  46   45  extern "C" {
↓ open down ↓ 56 lines elided ↑ open up ↑
 103  102          int             len;
 104  103          int             changed = 0;
 105  104          int             file_locked;
 106  105  
 107  106          fprintf(command_output_fp, "\n");
 108  107          fclose(command_output_fp);
 109  108          if ((command_output_fp = fopen(command_output_tmpfile, "r")) == NULL) {
 110  109                  return;
 111  110          }
 112  111          sprintf(nse_depinfo_file, "%s/%s", search_dir, NSE_DEPINFO);
 113      -        sprintf(merge_file, NOCATGETS("%s/.tmp%s.%d"), search_dir, NSE_DEPINFO, getpid());
      112 +        sprintf(merge_file, "%s/.tmp%s.%d", search_dir, NSE_DEPINFO, getpid());
 114  113          sprintf(lock_file, "%s/%s", search_dir, NSE_DEPINFO_LOCK);
 115  114          err = file_lock(nse_depinfo_file, lock_file, &file_locked, 0);
 116  115          if (err) {
 117  116                  if (warning_ptr != (void (*) (char *, ...)) NULL) {
 118      -                        (*warning_ptr)(catgets(libmksdmsi18n_catd, 1, 147, "Couldn't write to %s"), nse_depinfo_file);
      117 +                        (*warning_ptr)(gettext("Couldn't write to %s"), nse_depinfo_file);
 119  118                        }
 120  119                  unlink(command_output_tmpfile);
 121  120                  return;
 122  121          }
 123  122          /* If .nse_depinfo file doesn't exist */
 124  123          if ((nse_depinfo_fp = fopen(nse_depinfo_file, "r+")) == NULL) {
 125  124                  if (is_path) {
 126  125                          if ((nse_depinfo_fp = 
 127  126                               fopen(nse_depinfo_file, "w")) == NULL) {
 128      -                                fprintf(stderr, catgets(libmksdmsi18n_catd, 1, 148, "Cannot open `%s' for writing\n"),
      127 +                                fprintf(stderr, gettext("Cannot open `%s' for writing\n"),
 129  128                                      nse_depinfo_file);
 130  129                                  unlink(command_output_tmpfile);
 131  130  
 132  131                                  unlink(lock_file);
 133  132                                  return;
 134  133                          }
 135  134                          while (fgets(line, MAXPATHLEN+2, command_output_fp) 
 136  135                                 != NULL) {
 137  136                                  fprintf(nse_depinfo_fp, "%s", line);
 138  137                          }
 139  138                          fclose(command_output_fp);
 140  139                  }
 141  140                  fclose(nse_depinfo_fp);
 142  141                  if (file_locked) {
 143  142                          unlink(lock_file);
 144  143                  }
 145  144                  unlink(command_output_tmpfile);
 146  145                  return;
 147  146          }
 148  147          if ((merge_fp = fopen(merge_file, "w")) == NULL) {
 149      -                fprintf(stderr, catgets(libmksdmsi18n_catd, 1, 149, "Cannot open %s for writing\n"), merge_file);
      148 +                fprintf(stderr, gettext("Cannot open %s for writing\n"), merge_file);
 150  149                  if (file_locked) {
 151  150                          unlink(lock_file);
 152  151                  }
 153  152                  unlink(command_output_tmpfile);
 154  153                  return;
 155  154          }
 156  155          len = strlen(sfile);
 157  156          while (fgets(line, MAXPATHLEN+2, nse_depinfo_fp) != NULL) {
 158  157                  if (strncmp(line, sfile, len) == 0 && line[len] == ':') {
 159  158                          while (fgets(buf, MAXPATHLEN+2, command_output_fp) 
↓ open down ↓ 41 lines elided ↑ open up ↑
 201  200  }
 202  201  
 203  202  } // extern "C"
 204  203  
 205  204  static void
 206  205  report_dep(char *iflag, char *filename)
 207  206  {
 208  207  
 209  208          if (command_output_fp == NULL) {
 210  209                  sprintf(command_output_tmpfile, 
 211      -                        NOCATGETS("%s/%s.%d.XXXXXX"), tmpdir, NSE_DEPINFO, getpid());
      210 +                        "%s/%s.%d.XXXXXX", tmpdir, NSE_DEPINFO, getpid());
 212  211                  int fd = mkstemp(command_output_tmpfile);
 213  212                  if ((fd < 0) || (command_output_fp = fdopen(fd, "w")) == NULL) {
 214  213                          return;
 215  214                  }
 216      -                if ((search_dir = getenv(NOCATGETS("NSE_DEP"))) == NULL) {
      215 +                if ((search_dir = getenv("NSE_DEP")) == NULL) {
 217  216                          return;
 218  217                  }
 219  218                  atexit(close_file);
 220  219                  strcpy(sfile, filename);
 221  220                  if (iflag == NULL || *iflag == '\0') {
 222  221                          return;
 223  222                  }
 224  223                  fprintf(command_output_fp, "%s:", sfile);
 225  224          }
 226  225          fprintf(command_output_fp, " ");
↓ open down ↓ 23 lines elided ↑ open up ↑
 250  249  
 251  250  void
 252  251  report_search_path(char *iflag)
 253  252  {
 254  253          char            curdir[MAXPATHLEN];
 255  254          char            *sdir;
 256  255          char            *newiflag;
 257  256          char            filename[MAXPATHLEN];
 258  257          char            *p, *ptr;
 259  258  
 260      -        if ((sdir = getenv(NOCATGETS("NSE_DEP"))) == NULL) {
      259 +        if ((sdir = getenv("NSE_DEP")) == NULL) {
 261  260                  return;
 262  261          }
 263  262          if ((p= getenv(SUNPRO_DEPENDENCIES)) == NULL) {
 264  263                  return;
 265  264          }
 266  265          ptr = strchr(p, ' ');
 267  266          if( ! ptr ) {
 268  267                  return;
 269  268          }
 270      -        sprintf(filename, NOCATGETS("%s-CPP"), ptr+1);
      269 +        sprintf(filename, "%s-CPP", ptr+1);
 271  270          getcwd(curdir, sizeof(curdir));
 272  271          if (strcmp(curdir, sdir) != 0 && strlen(iflag) > 2 && 
 273  272              iflag[2] != '/') {
 274  273                  /* Makefile must have had an "cd xx; cc ..." */
 275  274                  /* Modify the -I path to be relative to the cd */
 276  275                  newiflag = (char *)malloc(strlen(iflag) + strlen(curdir) + 2);
 277  276                  sprintf(newiflag, "-%c%s/%s", iflag[1], curdir, &iflag[2]);
 278  277                  report_dep(newiflag, filename);
 279  278          } else {
 280  279                  report_dep(iflag, filename);
↓ open down ↓ 54 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX