Print this page
make: translate using gettext, rather than the unmaintainable catgets
@@ -33,10 +33,11 @@
* Included files
*/
#include <mk/defs.h>
#include <mksh/macro.h> /* expand_value() */
#include <mksh/misc.h> /* retmem() */
+#include <libintl.h>
/*
* Defined macros
*/
@@ -137,11 +138,11 @@
if (target->has_target_prop) {
true_target = get_prop(target->prop,
target_prop)->body.target.target;
}
if (debug_level > 1) {
- (void) printf(NOCATGETS("%*sfind_suffix_rule(%s,%s,%s)\n"),
+ (void) printf("%*sfind_suffix_rule(%s,%s,%s)\n",
recursion_level,
"",
true_target->string_mb,
target_body->string_mb,
target_suffix->string_mb);
@@ -187,11 +188,11 @@
put_suffix[source_suffix->body.
suffix.suffix->hash.length] =
(int) nul_char;
if (debug_level > 1) {
WCSTOMBS(mbs_buffer, sourcename);
- (void) printf(catgets(catd, 1, 218, "%*sTrying %s\n"),
+ (void) printf(gettext("%*sTrying %s\n"),
recursion_level,
"",
mbs_buffer);
}
source = getname_fn(sourcename, FIND_LENGTH, false, &name_found);
@@ -237,17 +238,17 @@
p = np;
} else {break;}
}
/* copy everything including '/' */
strncpy(tmpbuf, source->string_mb, p - source->string_mb + 1);
- strcat(tmpbuf, NOCATGETS("s."));
+ strcat(tmpbuf, "s.");
strcat(tmpbuf, p+1);
retmem((wchar_t *) source->string_mb);
source->string_mb = tmpbuf;
} else {
- strcpy(tmpbuf, NOCATGETS("s."));
+ strcpy(tmpbuf, "s.");
strcat(tmpbuf, source->string_mb);
retmem((wchar_t *) source->string_mb);
source->string_mb = tmpbuf;
}
@@ -347,11 +348,11 @@
return build_failed;
}
if (debug_level > 1) {
WCSTOMBS(mbs_buffer, sourcename);
- (void) printf(catgets(catd, 1, 219, "%*sFound %s\n"),
+ (void) printf(gettext("%*sFound %s\n"),
recursion_level,
"",
mbs_buffer);
}
@@ -367,11 +368,11 @@
if (*command == NULL) {
*command = line;
}
if ((source->stat.time > (*command)->body.line.dependency_time) &&
(debug_level > 1)) {
- (void) printf(catgets(catd, 1, 220, "%*sDate(%s)=%s Date-dependencies(%s)=%s\n"),
+ (void) printf(gettext("%*sDate(%s)=%s Date-dependencies(%s)=%s\n"),
recursion_level,
"",
source->string_mb,
time_to_string(source->
stat.time),
@@ -398,11 +399,11 @@
if (build_unconditional || out_of_date) {
if(!rechecking) {
line->body.line.is_out_of_date = true;
}
if (debug_level > 0) {
- (void) printf(catgets(catd, 1, 221, "%*sBuilding %s using suffix rule for %s%s because it is out of date relative to %s\n"),
+ (void) printf(gettext("%*sBuilding %s using suffix rule for %s%s because it is out of date relative to %s\n"),
recursion_level,
"",
true_target->string_mb,
source_suffix->body.suffix.suffix->string_mb,
target_suffix->string_mb,
@@ -434,11 +435,11 @@
char tstr[256];
extern Boolean dollarless_flag;
extern Name dollarless_value;
if(tilde_rule) {
- MBSTOWCS(wcs_buffer, NOCATGETS(source->string_mb));
+ MBSTOWCS(wcs_buffer, source->string_mb);
dollarless_value = GETNAME(wcs_buffer,FIND_LENGTH);
}
else {
dollarless_flag = false;
}
@@ -504,21 +505,21 @@
Wstring targ_string(true_target);
Wstring suf_string;
if (dot_a == NULL) {
- MBSTOWCS(wcs_buffer, NOCATGETS(".a"));
+ MBSTOWCS(wcs_buffer, ".a");
dot_a = GETNAME(wcs_buffer, FIND_LENGTH);
}
target_end = targ_string.get_string() + true_target->hash.length;
/*
* We compare the tail of the target name with the suffixes
* from .SUFFIXES.
*/
if (debug_level > 1) {
- (void) printf(NOCATGETS("%*sfind_ar_suffix_rule(%s)\n"),
+ (void) printf("%*sfind_ar_suffix_rule(%s)\n",
recursion_level,
"",
true_target->string_mb);
}
/*
@@ -615,11 +616,11 @@
* We compare the tail of the target name with the
* suffixes from .SUFFIXES.
*/
target_end = targ_string.get_string() + true_target->hash.length;
if (debug_level > 1) {
- (void) printf(NOCATGETS("%*sfind_double_suffix_rule(%s)\n"),
+ (void) printf("%*sfind_double_suffix_rule(%s)\n",
recursion_level,
"",
true_target->string_mb);
}
/*
@@ -707,11 +708,11 @@
/* again later */
if ((suffixes == NULL) || !working_on_targets) {
return;
}
if (debug_level > 1) {
- (void) printf(NOCATGETS("%*sbuild_suffix_list(%s) "),
+ (void) printf("%*sbuild_suffix_list(%s) ",
recursion_level,
"",
target_suffix->string_mb);
}
/* Mark the target suffix saying we cashed its list */
@@ -820,11 +821,11 @@
if (target->has_long_member_name) {
true_target = get_prop(target->prop,
long_member_name_prop)->body.long_member_name.member_name;
}
if (debug_level > 1) {
- (void) printf(catgets(catd, 1, 222, "%*sLooking for %% rule for %s\n"),
+ (void) printf(gettext("%*sLooking for %% rule for %s\n"),
recursion_level,
"",
true_target->string_mb);
}
for (pat_rule = percent_list;
@@ -901,11 +902,11 @@
if (depe_to_check == empty_name) {
result = build_ok;
} else {
if (debug_level > 1) {
- (void) printf(catgets(catd, 1, 223, "%*sTrying %s\n"),
+ (void) printf(gettext("%*sTrying %s\n"),
recursion_level,
"",
depe_to_check->string_mb);
}
@@ -991,11 +992,11 @@
}
return result;
}
if (debug_level > 1) {
- (void) printf(catgets(catd, 1, 224, "%*sMatched %s:"),
+ (void) printf(gettext("%*sMatched %s:"),
recursion_level,
"",
target->string_mb);
for (pat_depe = pat_rule->dependencies;
@@ -1017,11 +1018,11 @@
if (depe_to_check != empty_name) {
(void) printf(" %s", depe_to_check->string_mb);
}
}
- (void) printf(catgets(catd, 1, 225, " from: %s:"),
+ (void) printf(gettext(" from: %s:"),
pat_rule->name->string_mb);
for (pat_depe = pat_rule->dependencies;
pat_depe != NULL;
pat_depe = pat_depe->next) {
@@ -1067,11 +1068,11 @@
return build_running;
}
if ((depe->name->stat.time > line->body.line.dependency_time) &&
(debug_level > 1)) {
- (void) printf(catgets(catd, 1, 226, "%*sDate(%s)=%s Date-dependencies(%s)=%s\n"),
+ (void) printf(gettext("%*sDate(%s)=%s Date-dependencies(%s)=%s\n"),
recursion_level,
"",
depe->name->string_mb,
time_to_string(depe->name->stat.time),
true_target->string_mb,
@@ -1093,11 +1094,11 @@
line->body.line.is_out_of_date = true;
}
add_target_to_chain(depe->name, &(line->body.line.query));
if (debug_level > 0) {
- (void) printf(catgets(catd, 1, 227, "%*sBuilding %s using pattern rule %s:"),
+ (void) printf(gettext("%*sBuilding %s using pattern rule %s:"),
recursion_level,
"",
true_target->string_mb,
pat_rule->name->string_mb);
@@ -1105,11 +1106,11 @@
pat_depe != NULL;
pat_depe = pat_depe->next) {
(void) printf(" %s", pat_depe->name->string_mb);
}
- (void) printf(catgets(catd, 1, 228, " because it is out of date relative to %s\n"),
+ (void) printf(gettext(" because it is out of date relative to %s\n"),
depe->name->string_mb);
}
}
}
} else {
@@ -1117,18 +1118,18 @@
(true_target->stat.time < line->body.line.dependency_time)) {
if(!rechecking) {
line->body.line.is_out_of_date = true;
}
if (debug_level > 0) {
- (void) printf(catgets(catd, 1, 229, "%*sBuilding %s using pattern rule %s: "),
+ (void) printf(gettext("%*sBuilding %s using pattern rule %s: "),
recursion_level,
"",
true_target->string_mb,
pat_rule->name->string_mb,
(target->stat.time > file_doesnt_exist) ?
- catgets(catd, 1, 230, "because it is out of date") :
- catgets(catd, 1, 236, "because it does not exist"));
+ gettext("because it is out of date") :
+ gettext("because it does not exist"));
}
}
}
/* enter explicit rule from percent rule */