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

@@ -36,13 +36,13 @@
 #include <mksh/dosys.h>         /* sh_command2string() */
 #include <mksh/i18n.h>          /* get_char_semantics_value() */
 #include <mksh/macro.h>
 #include <mksh/misc.h>          /* retmem() */
 #include <mksh/read.h>          /* get_next_block_fn() */
-#include <mksdmsi18n/mksdmsi18n.h>      /* libmksdmsi18n_init() */
 
 #include <widec.h>
+#include <libintl.h>
 
 /*
  * File table of contents
  */
 static void     add_macro_to_global_list(Name macro_to_add);

@@ -147,11 +147,11 @@
                 destination->text.end = destination->text.p;
                 return;
         }
 
         if (value->being_expanded) {
-                fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 113, "Loop detected when expanding macro value `%s'"),
+                fatal_reader_mksh(gettext("Loop detected when expanding macro value `%s'"),
                              value->string_mb);
         }
         value->being_expanded = true;
         /* Setup the structure we read from */
         Wstring vals(value);

@@ -212,11 +212,11 @@
                                 destination->text.end = destination->text.p;
                                 value->being_expanded = false;
                                 return;
                         }
                         if (source->error_converting) {
-                                fatal_reader_mksh(NOCATGETS("Internal error: Invalid byte sequence in expand_value()"));
+                                fatal_reader_mksh("Internal error: Invalid byte sequence in expand_value()");
                         }
                         block_start = source_p;
                         source_p--;
                         continue;
                 }

@@ -297,15 +297,15 @@
                 pattern_replace,
                 sh_replace
         }                       replacement = no_replace;
 
         if (make == NULL) {
-                MBSTOWCS(wcs_buffer, NOCATGETS("MAKE"));
+                MBSTOWCS(wcs_buffer, "MAKE");
                 make = GETNAME(wcs_buffer, FIND_LENGTH);
 
-                MBSTOWCS(colon_sh, NOCATGETS(":sh"));
-                MBSTOWCS(colon_shell, NOCATGETS(":shell"));
+                MBSTOWCS(colon_sh, ":sh");
+                MBSTOWCS(colon_shell, ":shell");
         }
 
         right_hand[0] = NULL;
 
         /* First copy the (macro-expanded) macro name into string. */

@@ -315,15 +315,15 @@
         switch (GET_CHAR()) {
         case nul_char:
                 GET_NEXT_BLOCK_NOCHK(source);
                 if (source == NULL) {
                         WCSTOMBS(mbs_buffer, current_string);
-                        fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 114, "'$' at end of string `%s'"),
+                        fatal_reader_mksh(gettext("'$' at end of string `%s'"),
                                      mbs_buffer);
                 }
                 if (source->error_converting) {
-                        fatal_reader_mksh(NOCATGETS("Internal error: Invalid byte sequence in expand_macro()"));
+                        fatal_reader_mksh("Internal error: Invalid byte sequence in expand_macro()");
                 }
                 goto recheck_first_char;
         case parenleft_char:
                 /* Multi char name. */
                 closer = (int) parenright_char;

@@ -331,11 +331,11 @@
         case braceleft_char:
                 /* Multi char name. */
                 closer = (int) braceright_char;
                 break;
         case newline_char:
-                fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 115, "'$' at end of line"));
+                fatal_reader_mksh(gettext("'$' at end of line"));
         default:
                 /* Single char macro name. Just suck it up */
                 append_char(*source_p, &string);
                 source->string.text.p = source_p + 1;
                 goto get_macro_value;

@@ -352,28 +352,28 @@
                                       source_p - block_start);
                         GET_NEXT_BLOCK_NOCHK(source);
                         if (source == NULL) {
                                 if (current_string != NULL) {
                                         WCSTOMBS(mbs_buffer, current_string);
-                                        fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 116, "Unmatched `%c' in string `%s'"),
+                                        fatal_reader_mksh(gettext("Unmatched `%c' in string `%s'"),
                                                      closer ==
                                                      (int) braceright_char ?
                                                      (int) braceleft_char :
                                                      (int) parenleft_char,
                                                      mbs_buffer);
                                 } else {
-                                        fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 117, "Premature EOF"));
+                                        fatal_reader_mksh(gettext("Premature EOF"));
                                 }
                         }
                         if (source->error_converting) {
-                                fatal_reader_mksh(NOCATGETS("Internal error: Invalid byte sequence in expand_macro()"));
+                                fatal_reader_mksh("Internal error: Invalid byte sequence in expand_macro()");
                         }
                         block_start = source_p;
                         source_p--;
                         continue;
                 case newline_char:
-                        fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 118, "Unmatched `%c' on line"),
+                        fatal_reader_mksh(gettext("Unmatched `%c' on line"),
                                      closer == (int) braceright_char ?
                                      (int) braceleft_char :
                                      (int) parenleft_char);
                 case backslash_char:
                         /* Quote dollar in macro value. */

@@ -452,11 +452,11 @@
                 case 'F':
                         extraction = file_extract;
                         break;
                 default:
                         WCSTOMBS(mbs_buffer, string.buffer.start);
-                        fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 119, "Illegal macro reference `%s'"),
+                        fatal_reader_mksh(gettext("Illegal macro reference `%s'"),
                                      mbs_buffer);
                 }
                 /* Internalize the macro name using the first char only. */
                 name = GETNAME(string.buffer.start, 1);
                 (void) wscpy(string.buffer.start, string.buffer.start + 2);

@@ -479,11 +479,11 @@
                            ((percent = (wchar_t *) wschr(colon + 1,
                                                          (int) percent_char)) == NULL)) {
                         while (colon != NULL) {
                                 if ((eq = (wchar_t *) wschr(colon + 1,
                                                             (int) equal_char)) == NULL) {
-                                        fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 120, "= missing from replacement macro reference"));
+                                        fatal_reader_mksh(gettext("= missing from replacement macro reference"));
                                 }
                                 left_tail_len = eq - colon - 1;
                                 if(left_tail) {
                                         retmem(left_tail);
                                 }

@@ -514,18 +514,18 @@
                                 }
                         }
                 } else {
                         if ((eq = (wchar_t *) wschr(colon + 1,
                                                     (int) equal_char)) == NULL) {
-                                fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 121, "= missing from replacement macro reference"));
+                                fatal_reader_mksh(gettext("= missing from replacement macro reference"));
                         }
                         if ((percent = (wchar_t *) wschr(colon + 1,
                                                          (int) percent_char)) == NULL) {
-                                fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 122, "%% missing from replacement macro reference"));
+                                fatal_reader_mksh(gettext("%% missing from replacement macro reference"));
                         }
                         if (eq < percent) {
-                                fatal_reader_mksh(catgets(libmksdmsi18n_catd, 1, 123, "%% missing from replacement macro reference"));
+                                fatal_reader_mksh(gettext("%% missing from replacement macro reference"));
                         }
 
                         if (percent > (colon + 1)) {
                                 tmp_len = percent - colon;
                                 if(left_head) {

@@ -572,11 +572,11 @@
                                                       eq,
                                                       percent - eq);
                                         right_hand[i][percent-eq] =
                                           (int) nul_char;
                                         if (i++ >= VSIZEOF(right_hand)) {
-                                                fatal_mksh(catgets(libmksdmsi18n_catd, 1, 124, "Too many %% in pattern"));
+                                                fatal_mksh(gettext("Too many %% in pattern"));
                                         }
                                         eq = percent + 1;
                                         if (eq[0] == (int) nul_char) {
                                                 MBSTOWCS(wcs_buffer, "");
                                                 right_hand[i] = (wchar_t *) wsdup(wcs_buffer);

@@ -631,11 +631,11 @@
                  * Add this conditional macro to the beginning of the
                  * global list.
                  */
                 add_macro_to_global_list(name);
                 if (makefile_type == reading_makefile) {
-                        warning_mksh(catgets(libmksdmsi18n_catd, 1, 164, "Conditional macro `%s' referenced in file `%ws', line %d"),
+                        warning_mksh(gettext("Conditional macro `%s' referenced in file `%ws', line %d"),
                                         name->string_mb, file_being_read, line_number);
                 }
         }
         /* Macro name read and parsed. Expand the value. */
         if ((macro == NULL) || (macro->body.macro.value == NULL)) {

@@ -810,11 +810,11 @@
         } else {
                 /*
                  * This is for the case when the macro name did not
                  * specify transforms.
                  */
-                if (!strncmp(name->string_mb, NOCATGETS("GET"), 3)) {
+                if (!strncmp(name->string_mb, "GET", 3)) {
                         dollarget_seen = true;
                 }
                 dollarless_flag = false;
                 if (!strncmp(name->string_mb, "<", 1) &&
                     dollarget_seen) {

@@ -903,28 +903,28 @@
         wchar_t         wc_buf[STRING_BUFFER_LENGTH];
         char            mb_buf[STRING_BUFFER_LENGTH];
         FILE            *pipe;
         Name            value;
         int             set_host, set_target;
-        const char      *mach_command = NOCATGETS("/bin/mach");
+        const char      *mach_command = "/bin/mach";
 
         set_host = (get_prop(host_arch->prop, macro_prop) == NULL);
         set_target = (get_prop(target_arch->prop, macro_prop) == NULL);
 
         if (set_host || set_target) {
                 INIT_STRING_FROM_STACK(result_string, wc_buf);
                 append_char((int) hyphen_char, &result_string);
 
                 if ((pipe = popen(mach_command, "r")) == NULL) {
-                        fatal_mksh(catgets(libmksdmsi18n_catd, 1, 185, "Execute of %s failed"), mach_command);
+                        fatal_mksh(gettext("Execute of %s failed"), mach_command);
                 }
                 while (fgets(mb_buf, sizeof(mb_buf), pipe) != NULL) {
                         MBSTOWCS(wcs_buffer, mb_buf);
                         append_string(wcs_buffer, &result_string, wslen(wcs_buffer));
                 }
                 if (pclose(pipe) != 0) {
-                        fatal_mksh(catgets(libmksdmsi18n_catd, 1, 186, "Execute of %s failed"), mach_command);
+                        fatal_mksh(gettext("Execute of %s failed"), mach_command);
                 }
 
                 value = GETNAME(result_string.buffer.start, wslen(result_string.buffer.start));
 
                 if (set_host) {

@@ -958,28 +958,28 @@
         wchar_t         wc_buf[STRING_BUFFER_LENGTH];
         char            mb_buf[STRING_BUFFER_LENGTH];
         FILE            *pipe;
         Name            value;
         int             set_host, set_target;
-        const char      *arch_command = NOCATGETS("/bin/arch");
+        const char      *arch_command = "/bin/arch";
 
         set_host = (get_prop(host_mach->prop, macro_prop) == NULL);
         set_target = (get_prop(target_mach->prop, macro_prop) == NULL);
 
         if (set_host || set_target) {
                 INIT_STRING_FROM_STACK(result_string, wc_buf);
                 append_char((int) hyphen_char, &result_string);
 
                 if ((pipe = popen(arch_command, "r")) == NULL) {
-                        fatal_mksh(catgets(libmksdmsi18n_catd, 1, 183, "Execute of %s failed"), arch_command);
+                        fatal_mksh(gettext("Execute of %s failed"), arch_command);
                 }
                 while (fgets(mb_buf, sizeof(mb_buf), pipe) != NULL) {
                         MBSTOWCS(wcs_buffer, mb_buf);
                         append_string(wcs_buffer, &result_string, wslen(wcs_buffer));
                 }
                 if (pclose(pipe) != 0) {
-                        fatal_mksh(catgets(libmksdmsi18n_catd, 1, 184, "Execute of %s failed"), arch_command);
+                        fatal_mksh(gettext("Execute of %s failed"), arch_command);
                 }
 
                 value = GETNAME(result_string.buffer.start, wslen(result_string.buffer.start));
 
                 if (set_host) {

@@ -1249,11 +1249,11 @@
                         }
                         Property env_prop = maybe_append_prop(name, env_mem_prop);
                         /*
                          * We use a permanent buffer to reset SUNPRO_DEPENDENCIES value.
                          */
-                        if (!strncmp(name->string_mb, NOCATGETS("SUNPRO_DEPENDENCIES"), 19)) {
+                        if (!strncmp(name->string_mb, "SUNPRO_DEPENDENCIES", 19)) {
                                 if (length >= sunpro_dependencies_buf_size) {
                                         sunpro_dependencies_buf_size=length*2;
                                         if (sunpro_dependencies_buf_size < 4096)
                                                 sunpro_dependencies_buf_size = 4096; // Default minimum size
                                         if (sunpro_dependencies_buf)

@@ -1300,11 +1300,11 @@
                 length = 32 +
                   wslen(wcb_ha) +
                     wslen(wcb_ta) +
                       wslen(wcb_vr);
                 old_vr = wcb_vr;
-                MBSTOWCS(wcs_buffer, NOCATGETS("/usr/arch/"));
+                MBSTOWCS(wcs_buffer, "/usr/arch/");
                 if (IS_WEQUALN(old_vr,
                                wcs_buffer,
                                wslen(wcs_buffer))) {
                         old_vr = (wchar_t *) wschr(old_vr, (int) colon_char) + 1;
                 }

@@ -1313,11 +1313,11 @@
                 } else {
                         new_value = ALLOC_WC(length);
                         new_value_allocated = true;
                         WCSTOMBS(mbs_buffer, old_vr);
                         (void) wsprintf(new_value,
-                                        NOCATGETS("/usr/arch/%s/%s:%s"),
+                                        "/usr/arch/%s/%s:%s",
                                         ha->string_mb + 1,
                                         ta->string_mb + 1,
                                         mbs_buffer);
                 }
                 if (new_value[0] != 0) {