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

@@ -35,10 +35,11 @@
 #include <mk/defs.h>
 #include <mksh/dosys.h>         /* sh_command2string() */
 #include <mksh/macro.h>         /* expand_value() */
 #include <mksh/misc.h>          /* retmem() */
 #include <stdarg.h>             /* va_list, va_start(), va_end() */
+#include <libintl.h>
 
 /*
  * Defined macros
  */
 

@@ -669,11 +670,11 @@
         if (makefile_type == reading_makefile) {
                 if (target->colons == no_colon) {
                         target->colons = separator;
                 } else {
                         if (target->colons != separator) {
-                                fatal_reader(catgets(catd, 1, 92, ":/:: conflict for target `%s'"),
+                                fatal_reader(gettext(":/:: conflict for target `%s'"),
                                              target->string_mb);
                         }
                 }
                 if (target->colons == two_colon) {
                         if (depes->used == 0) {

@@ -803,17 +804,17 @@
                                 }
                         }
                 }
                 break;
         default:
-                fatal_reader(catgets(catd, 1, 93, "Internal error. Unknown makefile type %d"),
+                fatal_reader(gettext("Internal error. Unknown makefile type %d"),
                              makefile_type);
         }
         /* A target may only be involved in one target group */
         if (line->body.line.target_group != NULL) {
                 if (target_group != NULL) {
-                        fatal_reader(catgets(catd, 1, 94, "Too many target groups for target `%s'"),
+                        fatal_reader(gettext("Too many target groups for target `%s'"),
                                      target->string_mb);
                 }
         } else {
                 line->body.line.target_group = target_group;
         }

@@ -1076,11 +1077,11 @@
              p != NULL;
              insert = &p->next, p = *insert);
         *insert = result;
 
         if (trace_reader) {
-                (void) printf(NOCATGETS("Dynamic target %s:\n"), result->name->string_mb);
+                (void) printf("Dynamic target %s:\n", result->name->string_mb);
         }
         return( result);
 }
 
 

@@ -1131,11 +1132,11 @@
 
         switch (target->special_reader) {
 
         case svr4_special:
                 if (depes->used != 0) {
-                        fatal_reader(catgets(catd, 1, 98, "Illegal dependencies for target `%s'"),
+                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
                                      target->string_mb);
                 }
                 svr4  = true;
                 posix  = false;
                 keep_state = false;

@@ -1148,20 +1149,20 @@
 
         case posix_special:
                 if(svr4)
                   break;
                 if (depes->used != 0) {
-                        fatal_reader(catgets(catd, 1, 99, "Illegal dependencies for target `%s'"),
+                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
                                      target->string_mb);
                 }
                 posix  = true;
                         /* with posix on, use the posix get rule */
                 sccs_get_rule = sccs_get_posix_rule;
                         /* turn keep state off being SunPro make specific */
                 keep_state = false;
                 /* Use /usr/xpg4/bin/sh on Solaris */
-                MBSTOWCS(wcs_buffer, NOCATGETS("/usr/xpg4/bin/sh"));
+                MBSTOWCS(wcs_buffer, "/usr/xpg4/bin/sh");
                 (void) SETVAR(shell_name, GETNAME(wcs_buffer, FIND_LENGTH), false);
                 if (trace_reader) {
                         (void) printf("%s:\n", posix_name->string_mb);
                 }
                 break;

@@ -1170,11 +1171,11 @@
                 built_last_make_run_seen = true;
                 break;
 
         case default_special:
                 if (depes->used != 0) {
-                        warning(catgets(catd, 1, 100, "Illegal dependency list for target `%s'"),
+                        warning(gettext("Illegal dependency list for target `%s'"),
                                 target->string_mb);
                 }
                 default_rule = command;
                 if (trace_reader) {
                         (void) printf("%s:\n",

@@ -1184,11 +1185,11 @@
                 break;
 
 
         case ignore_special:
                 if ((depes->used != 0) &&(!posix)){
-                        fatal_reader(catgets(catd, 1, 101, "Illegal dependencies for target `%s'"),
+                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
                                      target->string_mb);
                 }
                 if (depes->used == 0)
                 {
                    ignore_errors_all = true;

@@ -1212,11 +1213,11 @@
                   break;
                         /* ignore keep state, being SunPro make specific */
                 if(posix)
                   break;
                 if (depes->used != 0) {
-                        fatal_reader(catgets(catd, 1, 102, "Illegal dependencies for target `%s'"),
+                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
                                      target->string_mb);
                 }
                 keep_state = true;
                 if (trace_reader) {
                         (void) printf("%s:\n",

@@ -1232,38 +1233,38 @@
                         /* it's not necessary to specify KEEP_STATE, if this 
                         ** is given, so set the keep_state.
                         */
                 keep_state = true;
                 if (depes->used != 0) {
-                   if((!make_state) ||(!strcmp(make_state->string_mb,NOCATGETS(".make.state")))) {
+                   if((!make_state) ||(!strcmp(make_state->string_mb,".make.state"))) {
                      make_state = depes->names[0];
                    }
                 }
                 break;
         case make_version_special:
                 if(svr4)
                   break;
                 if (depes->used != 1) {
-                        fatal_reader(catgets(catd, 1, 103, "Illegal dependency list for target `%s'"),
+                        fatal_reader(gettext("Illegal dependency list for target `%s'"),
                                      target->string_mb);
                 }
                 if (depes->names[0] != current_make_version) {
                         /*
                          * Special case the fact that version 1.0 and 1.1
                          * are identical.
                          */
                         if (!IS_EQUAL(depes->names[0]->string_mb,
-                                      NOCATGETS("VERSION-1.1")) ||
+                                      "VERSION-1.1") ||
                             !IS_EQUAL(current_make_version->string_mb,
-                                      NOCATGETS("VERSION-1.0"))) {
+                                      "VERSION-1.0")) {
                                 /*
                                  * Version mismatches should cause the
                                  * .make.state file to be skipped.
                                  * This is currently not true - it is read
                                  * anyway.
                                  */
-                                warning(catgets(catd, 1, 104, "Version mismatch between current version `%s' and `%s'"),
+                                warning(gettext("Version mismatch between current version `%s' and `%s'"),
                                         current_make_version->string_mb,
                                         depes->names[0]->string_mb);
                         }
                 }
                 break;

@@ -1363,11 +1364,11 @@
                 }
                 break;
 
         case sccs_get_special:
                 if (depes->used != 0) {
-                        fatal_reader(catgets(catd, 1, 105, "Illegal dependencies for target `%s'"),
+                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
                                      target->string_mb);
                 }
                 sccs_get_rule = command;
                 sccs_get_org_rule = command;
                 if (trace_reader) {

@@ -1376,11 +1377,11 @@
                 }
                 break;
 
         case sccs_get_posix_special:
                 if (depes->used != 0) {
-                        fatal_reader(catgets(catd, 1, 106, "Illegal dependencies for target `%s'"),
+                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
                                      target->string_mb);
                 }
                 sccs_get_posix_rule = command;
                 if (trace_reader) {
                         (void) printf("%s:\n", sccs_get_posix_name->string_mb);

@@ -1388,11 +1389,11 @@
                 }
                 break;
 
         case get_posix_special:
                 if (depes->used != 0) {
-                        fatal_reader(catgets(catd, 1, 107, "Illegal dependencies for target `%s'"),
+                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
                                      target->string_mb);
                 }
                 get_posix_rule = command;
                 if (trace_reader) {
                         (void) printf("%s:\n", get_posix_name->string_mb);

@@ -1403,11 +1404,11 @@
         case get_special:
                 if(!svr4) {
                   break;
                 }
                 if (depes->used != 0) {
-                        fatal_reader(catgets(catd, 1, 108, "Illegal dependencies for target `%s'"),
+                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
                                      target->string_mb);
                 }
                 get_rule = command;
                 sccs_get_rule = command;
                 if (trace_reader) {

@@ -1416,11 +1417,11 @@
                 }
                 break;
 
         case silent_special:
                 if ((depes->used != 0) && (!posix)){
-                        fatal_reader(catgets(catd, 1, 109, "Illegal dependencies for target `%s'"),
+                        fatal_reader(gettext("Illegal dependencies for target `%s'"),
                                      target->string_mb);
                 }
                 if (depes->used == 0)
                 {
                    silent_all = true;

@@ -1443,11 +1444,11 @@
                 read_suffixes_list(depes);
                 break;
 
         default:
 
-                fatal_reader(catgets(catd, 1, 110, "Internal error: Unknown special reader"));
+                fatal_reader(gettext("Internal error: Unknown special reader"));
         }
 }
 
 /*
  *      read_suffixes_list(depes)

@@ -1751,15 +1752,15 @@
         wchar_t * wcb = nms.get_string();
         string = wcb;
         if (string[0]=='F' &&
             string[1]=='C' &&
             string[2]=='\0') {
-                MBSTOWCS(wcs_buffer, NOCATGETS("F77"));
+                MBSTOWCS(wcs_buffer, "F77");
                 temp = GETNAME(wcs_buffer, FIND_LENGTH);
                 (void) SETVAR(temp, value, append);
 /*
-                fprintf(stderr, catgets(catd, 1, 111, "warning: FC is obsolete, use F77 instead\n"));
+                fprintf(stderr, gettext("warning: FC is obsolete, use F77 instead\n"));
  */
         }
 
         if (trace_reader) {
                 if (value == NULL) {

@@ -1797,12 +1798,12 @@
 
         static wchar_t  colon_sh[4];
         static wchar_t  colon_shell[7];
 
         if (colon_sh[0] == (int) nul_char) {
-                MBSTOWCS(colon_sh, NOCATGETS(":sh"));
-                MBSTOWCS(colon_shell, NOCATGETS(":shell"));
+                MBSTOWCS(colon_sh, ":sh");
+                MBSTOWCS(colon_shell, ":shell");
         }
         Wstring nms((*name));
         wchar_t * wcb = nms.get_string();
 
         colon = (wchar_t *) wsrchr(wcb, (int) colon_char);

@@ -1855,11 +1856,11 @@
         va_start(args, pattern);
         if (file_being_read != NULL) {
                 WCSTOMBS(mbs_buffer, file_being_read);
                 if (line_number != 0) {
                         (void) sprintf(message,
-                                       catgets(catd, 1, 112, "%s, line %d: %s"),
+                                       gettext("%s, line %d: %s"),
                                        mbs_buffer,
                                        line_number,
                                        pattern);
                 } else {
                         (void) sprintf(message,

@@ -1869,25 +1870,25 @@
                 }
                 pattern = message;
         }
 
         (void) fflush(stdout);
-        (void) fprintf(stderr, catgets(catd, 1, 238, "make: Fatal error in reader: "));
+        (void) fprintf(stderr, gettext("make: Fatal error in reader: "));
         (void) vfprintf(stderr, pattern, args);
         (void) fprintf(stderr, "\n");
         va_end(args);
 
         if (temp_file_name != NULL) {
                 (void) fprintf(stderr,
-                               catgets(catd, 1, 239, "make: Temp-file %s not removed\n"),
+                               gettext("make: Temp-file %s not removed\n"),
                                temp_file_name->string_mb);
                 temp_file_name = NULL;
         }
 
         if (report_pwd) {
                 (void) fprintf(stderr,
-                               catgets(catd, 1, 115, "Current working directory %s\n"),
+                               gettext("Current working directory %s\n"),
                                get_current_path());
         }
         (void) fflush(stderr);
         exit_status = 1;
         exit(1);