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

*** 31,54 **** /* * Included files */ #include <alloca.h> /* alloca() */ - - #include <fcntl.h> #include <mk/defs.h> #include <mksh/i18n.h> /* get_char_semantics_value() */ #include <mksh/macro.h> /* getvar(), expand_value() */ #include <mksh/misc.h> /* getmem() */ #include <poll.h> ! ! #include <signal.h> ! ! # include <stropts.h> ! #include <sys/errno.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/utsname.h> /* uname() */ #include <sys/wait.h> --- 31,49 ---- /* * Included files */ #include <alloca.h> /* alloca() */ #include <fcntl.h> #include <mk/defs.h> #include <mksh/i18n.h> /* get_char_semantics_value() */ #include <mksh/macro.h> /* getvar(), expand_value() */ #include <mksh/misc.h> /* getmem() */ #include <poll.h> ! #include <libintl.h> #include <signal.h> ! #include <stropts.h> #include <sys/errno.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/utsname.h> /* uname() */ #include <sys/wait.h>
*** 141,151 **** case build_running: second_pass = 0; return build_running; case build_failed: if (!continue_after_error) { ! fatal(catgets(catd, 1, 13, "Target `%s' not remade because of errors"), target->string_mb); } build_failed_seen = true; second_pass = 0; return build_failed; --- 136,146 ---- case build_running: second_pass = 0; return build_running; case build_failed: if (!continue_after_error) { ! fatal(gettext("Target `%s' not remade because of errors"), target->string_mb); } build_failed_seen = true; second_pass = 0; return build_failed;
*** 167,182 **** second_pass = 1; goto try_again; } second_pass = 0; if (continue_after_error && !svr4) { ! warning(catgets(catd, 1, 14, "Don't know how to make target `%s'"), target->string_mb); build_failed_seen = true; return build_failed; } ! fatal(catgets(catd, 1, 15, "Don't know how to make target `%s'"), target->string_mb); break; } #ifdef lint return build_failed; #endif --- 162,177 ---- second_pass = 1; goto try_again; } second_pass = 0; if (continue_after_error && !svr4) { ! warning(gettext("Don't know how to make target `%s'"), target->string_mb); build_failed_seen = true; return build_failed; } ! fatal(gettext("Don't know how to make target `%s'"), target->string_mb); break; } #ifdef lint return build_failed; #endif
*** 437,455 **** *p++ = dependency->name; } } } if (debug_level > 1) { ! (void) printf(NOCATGETS("%*sdoname(%s)\n"), recursion_level, "", target->string_mb); } recursion_level++; /* Avoid infinite loops */ if (target->state == build_in_progress) { ! warning(catgets(catd, 1, 16, "Infinite loop: Target `%s' depends on itself"), target->string_mb); return build_ok; } target->state = build_in_progress; --- 432,450 ---- *p++ = dependency->name; } } } if (debug_level > 1) { ! (void) printf("%*sdoname(%s)\n", recursion_level, "", target->string_mb); } recursion_level++; /* Avoid infinite loops */ if (target->state == build_in_progress) { ! warning(gettext("Infinite loop: Target `%s' depends on itself"), target->string_mb); return build_ok; } target->state = build_in_progress;
*** 683,693 **** line->body.line.dependency_time); } if (build_unconditional || out_of_date) { line->body.line.is_out_of_date = true; if (debug_level > 0) { ! (void) printf(catgets(catd, 1, 17, "%*sBuilding %s using .DEFAULT because it is out of date\n"), recursion_level, "", true_target->string_mb); } } --- 678,688 ---- line->body.line.dependency_time); } if (build_unconditional || out_of_date) { line->body.line.is_out_of_date = true; if (debug_level > 0) { ! (void) printf(gettext("%*sBuilding %s using .DEFAULT because it is out of date\n"), recursion_level, "", true_target->string_mb); } }
*** 877,887 **** */ if ((result == build_ok) && check_auto_dependencies(target, auto_count, automatics)) { if (debug_level > 0) { ! (void) printf(catgets(catd, 1, 18, "%*sTarget `%s' acquired new dependencies from build, rechecking all dependencies\n"), recursion_level, "", true_target->string_mb); } rechecking_target = true; --- 872,882 ---- */ if ((result == build_ok) && check_auto_dependencies(target, auto_count, automatics)) { if (debug_level > 0) { ! (void) printf(gettext("%*sTarget `%s' acquired new dependencies from build, rechecking all dependencies\n"), recursion_level, "", true_target->string_mb); } rechecking_target = true;
*** 1030,1040 **** dependency->stale = true; rewrite_statefile = command_changed = true; if (debug_level > 0) { ! (void) printf(catgets(catd, 1, 19, "Target %s rebuilt because dependency %s does not exist\n"), true_target->string_mb, dependency->name->string_mb); } break; } --- 1025,1035 ---- dependency->stale = true; rewrite_statefile = command_changed = true; if (debug_level > 0) { ! (void) printf(gettext("Target %s rebuilt because dependency %s does not exist\n"), true_target->string_mb, dependency->name->string_mb); } break; }
*** 1060,1077 **** if(true_target->is_member || dependency->name->is_member) { line->body.line.dependency_time.tv_nsec = 0; } if (debug_level > 1) { ! (void) printf(catgets(catd, 1, 20, "%*sDate(%s)=%s \n"), recursion_level, "", dependency->name->string_mb, time_to_string(dependency->name-> stat.time)); if (dependency->name->stat.time > line->body.line.dependency_time) { ! (void) printf(catgets(catd, 1, 21, "%*sDate-dependencies(%s) set to %s\n"), recursion_level, "", true_target->string_mb, time_to_string(line->body.line. dependency_time)); --- 1055,1072 ---- if(true_target->is_member || dependency->name->is_member) { line->body.line.dependency_time.tv_nsec = 0; } if (debug_level > 1) { ! (void) printf(gettext("%*sDate(%s)=%s \n"), recursion_level, "", dependency->name->string_mb, time_to_string(dependency->name-> stat.time)); if (dependency->name->stat.time > line->body.line.dependency_time) { ! (void) printf(gettext("%*sDate-dependencies(%s) set to %s\n"), recursion_level, "", true_target->string_mb, time_to_string(line->body.line. dependency_time));
*** 1126,1142 **** } (*out_of_date_tail)->next = NULL; out_of_date_tail = &(*out_of_date_tail)->next; if (debug_level > 0) { if (dependency->name->stat.time == file_max_time) { ! (void) printf(catgets(catd, 1, 22, "%*sBuilding %s because %s does not exist\n"), recursion_level, "", true_target->string_mb, dependency->name->string_mb); } else { ! (void) printf(catgets(catd, 1, 23, "%*sBuilding %s because it is out of date relative to %s\n"), recursion_level, "", true_target->string_mb, dependency->name->string_mb); } --- 1121,1137 ---- } (*out_of_date_tail)->next = NULL; out_of_date_tail = &(*out_of_date_tail)->next; if (debug_level > 0) { if (dependency->name->stat.time == file_max_time) { ! (void) printf(gettext("%*sBuilding %s because %s does not exist\n"), recursion_level, "", true_target->string_mb, dependency->name->string_mb); } else { ! (void) printf(gettext("%*sBuilding %s because it is out of date relative to %s\n"), recursion_level, "", true_target->string_mb, dependency->name->string_mb); }
*** 1202,1212 **** * After scanning all the dependencies, we check the rule * if we found one. */ if (line->body.line.command_template != NULL) { if (line->body.line.command_template_redefined) { ! warning(catgets(catd, 1, 24, "Too many rules defined for target %s"), target->string_mb); } *command = line; /* Check if the target is out of date */ Boolean out_of_date; --- 1197,1207 ---- * After scanning all the dependencies, we check the rule * if we found one. */ if (line->body.line.command_template != NULL) { if (line->body.line.command_template_redefined) { ! warning(gettext("Too many rules defined for target %s"), target->string_mb); } *command = line; /* Check if the target is out of date */ Boolean out_of_date;
*** 1422,1432 **** // include "//" and "/./" //dependency->name = GETNAME(start, p - start); dependency->name = normalize_name(start, p - start); if ((debug_level > 0) && (first_member == NULL)) { ! (void) printf(catgets(catd, 1, 25, "%*sDynamic dependency `%s' for target `%s'\n"), recursion_level, "", dependency->name->string_mb, true_target->string_mb); } --- 1417,1427 ---- // include "//" and "/./" //dependency->name = GETNAME(start, p - start); dependency->name = normalize_name(start, p - start); if ((debug_level > 0) && (first_member == NULL)) { ! (void) printf(gettext("%*sDynamic dependency `%s' for target `%s'\n"), recursion_level, "", dependency->name->string_mb, true_target->string_mb); }
*** 1457,1467 **** GETNAME(string.buffer.start, FIND_LENGTH); if (string.free_after_use) { retmem(string.buffer.start); } if (debug_level > 0) { ! (void) printf(catgets(catd, 1, 26, "%*sDynamic dependency `%s' for target `%s'\n"), recursion_level, "", first_member->name-> string_mb, true_target->string_mb); --- 1452,1462 ---- GETNAME(string.buffer.start, FIND_LENGTH); if (string.free_after_use) { retmem(string.buffer.start); } if (debug_level > 0) { ! (void) printf(gettext("%*sDynamic dependency `%s' for target `%s'\n"), recursion_level, "", first_member->name-> string_mb, true_target->string_mb);
*** 1614,1624 **** */ if (!touch && line->body.line.sccs_command && (target->stat.time != file_doesnt_exist) && ((target->stat.mode & 0222) != 0)) { ! fatal(catgets(catd, 1, 27, "%s is writable so it cannot be sccs gotten"), target->string_mb); target->has_complained = remember_only = true; } /* * If KEEP_STATE is on, we make sure we have the timestamp for --- 1609,1619 ---- */ if (!touch && line->body.line.sccs_command && (target->stat.time != file_doesnt_exist) && ((target->stat.mode & 0222) != 0)) { ! fatal(gettext("%s is writable so it cannot be sccs gotten"), target->string_mb); target->has_complained = remember_only = true; } /* * If KEEP_STATE is on, we make sure we have the timestamp for
*** 1635,1645 **** tmp_file_path[0] = '\0'; } else { strcpy(tmp_file_path, temp_file_directory); } sprintf(mbs_buffer, ! NOCATGETS("%s/.make.dependency.%08x.%d.%d"), tmp_file_path, hostid, getpid(), file_number++); MBSTOWCS(wcs_buffer, mbs_buffer); --- 1630,1640 ---- tmp_file_path[0] = '\0'; } else { strcpy(tmp_file_path, temp_file_directory); } sprintf(mbs_buffer, ! "%s/.make.dependency.%08x.%d.%d", tmp_file_path, hostid, getpid(), file_number++); MBSTOWCS(wcs_buffer, mbs_buffer);
*** 1825,1840 **** } else { result = build_ok; } if (result == build_failed) { if (silent || rule->silent) { ! (void) printf(catgets(catd, 1, 242, "The following command caused the error:\n%s\n"), rule->command_line->string_mb); } if (!rule->ignore_error && !ignore_errors) { if (!continue_after_error) { ! fatal(catgets(catd, 1, 244, "Command failed for target `%s'"), target->string_mb); } /* * Make sure a failing command is not * saved in .make.state. --- 1820,1835 ---- } else { result = build_ok; } if (result == build_failed) { if (silent || rule->silent) { ! (void) printf(gettext("The following command caused the error:\n%s\n"), rule->command_line->string_mb); } if (!rule->ignore_error && !ignore_errors) { if (!continue_after_error) { ! fatal(gettext("Command failed for target `%s'"), target->string_mb); } /* * Make sure a failing command is not * saved in .make.state.
*** 2108,2118 **** (*equal == (int) plus_char))) { equal++; } switch (*equal) { case nul_char: ! fatal(catgets(catd, 1, 31, "= expected in rule `%s' for target `%s'"), line->string_mb, target->string_mb); case plus_char: append = true; equal++; --- 2103,2113 ---- (*equal == (int) plus_char))) { equal++; } switch (*equal) { case nul_char: ! fatal(gettext("= expected in rule `%s' for target `%s'"), line->string_mb, target->string_mb); case plus_char: append = true; equal++;
*** 2402,2423 **** !used->ignore_command_dependency && (vpath_translated != used->command_line)) { if (debug_level > 0) { if (used->command_line != NULL && *used->command_line->string_mb != '\0') { ! (void) printf(catgets(catd, 1, 32, "%*sBuilding %s because new command \n\t%s\n%*sdifferent from old\n\t%s\n"), recursion_level, "", target->string_mb, vpath_translated->string_mb, recursion_level, "", used-> command_line-> string_mb); } else { ! (void) printf(catgets(catd, 1, 33, "%*sBuilding %s because new command \n\t%s\n%*sdifferent from empty old command\n"), recursion_level, "", target->string_mb, vpath_translated->string_mb, recursion_level, --- 2397,2418 ---- !used->ignore_command_dependency && (vpath_translated != used->command_line)) { if (debug_level > 0) { if (used->command_line != NULL && *used->command_line->string_mb != '\0') { ! (void) printf(gettext("%*sBuilding %s because new command \n\t%s\n%*sdifferent from old\n\t%s\n"), recursion_level, "", target->string_mb, vpath_translated->string_mb, recursion_level, "", used-> command_line-> string_mb); } else { ! (void) printf(gettext("%*sBuilding %s because new command \n\t%s\n%*sdifferent from empty old command\n"), recursion_level, "", target->string_mb, vpath_translated->string_mb, recursion_level,
*** 2438,2448 **** if (used != NULL) { *insert = NULL; if (keep_state && !ignore_all_command_dependency) { if (debug_level > 0) { ! (void) printf(catgets(catd, 1, 34, "%*sBuilding %s because new command shorter than old\n"), recursion_level, "", target->string_mb); } command_changed = true; --- 2433,2443 ---- if (used != NULL) { *insert = NULL; if (keep_state && !ignore_all_command_dependency) { if (debug_level > 0) { ! (void) printf(gettext("%*sBuilding %s because new command shorter than old\n"), recursion_level, "", target->string_mb); } command_changed = true;
*** 2453,2463 **** /* command consistency */ if (new_command_longer && !ignore_all_command_dependency && keep_state) { if (debug_level > 0) { ! (void) printf(catgets(catd, 1, 35, "%*sBuilding %s because new command longer than old\n"), recursion_level, "", target->string_mb); } command_changed = true; --- 2448,2458 ---- /* command consistency */ if (new_command_longer && !ignore_all_command_dependency && keep_state) { if (debug_level > 0) { ! (void) printf(gettext("%*sBuilding %s because new command longer than old\n"), recursion_level, "", target->string_mb); } command_changed = true;
*** 2519,2529 **** * to dosys(). If KEEP_STATE is on, "make -t" * will save the proper command, not the * "touch" in .make.state. */ INIT_STRING_FROM_STACK(touch_string, buffer); ! MBSTOWCS(wcs_buffer, NOCATGETS("touch ")); append_string(wcs_buffer, &touch_string, FIND_LENGTH); touch_cmd = name; if (name->has_vpath_alias_prop) { touch_cmd = get_prop(name->prop, vpath_alias_prop)-> --- 2514,2524 ---- * to dosys(). If KEEP_STATE is on, "make -t" * will save the proper command, not the * "touch" in .make.state. */ INIT_STRING_FROM_STACK(touch_string, buffer); ! MBSTOWCS(wcs_buffer, "touch "); append_string(wcs_buffer, &touch_string, FIND_LENGTH); touch_cmd = name; if (name->has_vpath_alias_prop) { touch_cmd = get_prop(name->prop, vpath_alias_prop)->
*** 2684,2704 **** int sym_link_depth = 0; /* For sccs, we need to chase symlinks. */ while (target->stat.is_sym_link) { if (sym_link_depth++ > 90) { ! fatal(catgets(catd, 1, 95, "Can't read symbolic link `%s': Number of symbolic links encountered during path name traversal exceeds 90."), target->string_mb); } /* Read the value of the link. */ result = readlink_vroot(target->string_mb, link, sizeof(link), NULL, VROOT_DEFAULT); if (result == -1) { ! fatal(catgets(catd, 1, 36, "Can't read symbolic link `%s': %s"), target->string_mb, errmsg(errno)); } link[result] = 0; /* Use the value to build the proper filename. */ INIT_STRING_FROM_STACK(string, name); --- 2679,2699 ---- int sym_link_depth = 0; /* For sccs, we need to chase symlinks. */ while (target->stat.is_sym_link) { if (sym_link_depth++ > 90) { ! fatal(gettext("Can't read symbolic link `%s': Number of symbolic links encountered during path name traversal exceeds 90."), target->string_mb); } /* Read the value of the link. */ result = readlink_vroot(target->string_mb, link, sizeof(link), NULL, VROOT_DEFAULT); if (result == -1) { ! fatal(gettext("Can't read symbolic link `%s': %s"), target->string_mb, errmsg(errno)); } link[result] = 0; /* Use the value to build the proper filename. */ INIT_STRING_FROM_STACK(string, name);
*** 2766,2776 **** * And only if the plain file is out of date do we * request execution of the command. */ line->body.line.is_out_of_date = true; if (debug_level > 0) { ! (void) printf(catgets(catd, 1, 37, "%*sSccs getting %s because s. file is younger than source file\n"), recursion_level, "", target->string_mb); } } --- 2761,2771 ---- * And only if the plain file is out of date do we * request execution of the command. */ line->body.line.is_out_of_date = true; if (debug_level > 0) { ! (void) printf(gettext("%*sSccs getting %s because s. file is younger than source file\n"), recursion_level, "", target->string_mb); } }
*** 2828,2840 **** register int length = p - wcb; static Name usr_include; static Name usr_include_sys; if (usr_include == NULL) { ! MBSTOWCS(usr_include_buf, NOCATGETS("/usr/include")); usr_include = GETNAME(usr_include_buf, FIND_LENGTH); ! MBSTOWCS(usr_include_sys_buf, NOCATGETS("/usr/include/sys")); usr_include_sys = GETNAME(usr_include_sys_buf, FIND_LENGTH); } /* * If the filename contains a "/" we have to extract the path --- 2823,2835 ---- register int length = p - wcb; static Name usr_include; static Name usr_include_sys; if (usr_include == NULL) { ! MBSTOWCS(usr_include_buf, "/usr/include"); usr_include = GETNAME(usr_include_buf, FIND_LENGTH); ! MBSTOWCS(usr_include_sys_buf, "/usr/include/sys"); usr_include_sys = GETNAME(usr_include_sys_buf, FIND_LENGTH); } /* * If the filename contains a "/" we have to extract the path
*** 2963,2973 **** /* Save the old value */ old_locals[i].body.macro = maybe_append_prop(conditional->body.conditional.name, macro_prop)->body.macro; if (debug_level > 1) { ! (void) printf(catgets(catd, 1, 38, "%*sActivating conditional value: "), recursion_level, ""); } /* Set the conditional value. Macros are expanded when the */ /* macro is refd as usual */ --- 2958,2968 ---- /* Save the old value */ old_locals[i].body.macro = maybe_append_prop(conditional->body.conditional.name, macro_prop)->body.macro; if (debug_level > 1) { ! (void) printf(gettext("%*sActivating conditional value: "), recursion_level, ""); } /* Set the conditional value. Macros are expanded when the */ /* macro is refd as usual */
*** 3019,3029 **** reset_locals(target, old_locals, this_conditional, index+1); } else { /* Remove conditional target from chain */ if (conditional_targets == NULL || conditional_targets->name != target) { ! warning(catgets(catd, 1, 39, "Internal error: reset target not at head of condtional_targets chain")); } else { cond_chain = conditional_targets->next; retmem_mb((caddr_t) conditional_targets); conditional_targets = cond_chain; } --- 3014,3024 ---- reset_locals(target, old_locals, this_conditional, index+1); } else { /* Remove conditional target from chain */ if (conditional_targets == NULL || conditional_targets->name != target) { ! warning(gettext("Internal error: reset target not at head of condtional_targets chain")); } else { cond_chain = conditional_targets->next; retmem_mb((caddr_t) conditional_targets); conditional_targets = cond_chain; }
*** 3033,3051 **** if (conditional->body.conditional.name == virtual_root) { (void) SETVAR(virtual_root, getvar(virtual_root), false); } if (debug_level > 1) { if (old_locals[index].body.macro.value != NULL) { ! (void) printf(catgets(catd, 1, 40, "%*sdeactivating conditional value: %s= %s\n"), recursion_level, "", conditional->body.conditional.name-> string_mb, old_locals[index].body.macro.value-> string_mb); } else { ! (void) printf(catgets(catd, 1, 41, "%*sdeactivating conditional value: %s =\n"), recursion_level, "", conditional->body.conditional.name-> string_mb); } --- 3028,3046 ---- if (conditional->body.conditional.name == virtual_root) { (void) SETVAR(virtual_root, getvar(virtual_root), false); } if (debug_level > 1) { if (old_locals[index].body.macro.value != NULL) { ! (void) printf(gettext("%*sdeactivating conditional value: %s= %s\n"), recursion_level, "", conditional->body.conditional.name-> string_mb, old_locals[index].body.macro.value-> string_mb); } else { ! (void) printf(gettext("%*sdeactivating conditional value: %s =\n"), recursion_level, "", conditional->body.conditional.name-> string_mb); }