Print this page
make: translate using gettext, rather than the unmaintainable catgets
@@ -41,10 +41,11 @@
*/
#include <alloca.h> /* alloca() */
#include <ar.h>
#include <errno.h> /* errno */
#include <fcntl.h> /* open() */
+#include <libintl.h>
#include <mk/defs.h>
#include <mksh/misc.h> /* retmem_mb() */
struct ranlib {
union {
@@ -221,20 +222,20 @@
if (member->body.member.member == NULL) {
member->body.member.member = empty_name;
}
return target->stat.time = file_doesnt_exist;
} else {
- fatal(catgets(catd, 1, 1, "Can't access archive `%s': %s"),
+ fatal(gettext("Can't access archive `%s': %s"),
member->body.member.library->string_mb,
errmsg(errno));
}
}
if (target->stat.time == file_no_time) {
if (read_archive_dir(&ar, member->body.member.library,
&long_names_table)
== failed){
- fatal(catgets(catd, 1, 2, "Can't access archive `%s': %s"),
+ fatal(gettext("Can't access archive `%s': %s"),
member->body.member.library->string_mb,
errmsg(errno));
}
}
if (member->body.member.entry != NULL) {
@@ -314,11 +315,11 @@
/*
MBSTOWCS(wcs_buffer, "/ ");
if (IS_WEQUALN(arp->ar_port.ar_name, wcs_buffer, 16)) {
*/
if (IS_EQUALN(arp->ar_port.ar_name,
- NOCATGETS("/ "),
+ "/ ",
16)) {
if (sscanf(arp->ar_port.ar_size,
"%ld",
&arp->sym_size) != 1) {
return failed;
@@ -332,11 +333,11 @@
arp->first_ar_mem = arp->sym_begin +
arp->sym_size - sizeof buffer;
}
return succeeded;
}
- fatal(catgets(catd, 1, 3, "`%s' is not an archive"), filename);
+ fatal(gettext("`%s' is not an archive"), filename);
/* NOTREACHED */
return failed;
}
@@ -462,11 +463,11 @@
sizeof arp->ar_port.ar_fmag)) {
if (feof(arp->fd)) {
return succeeded;
}
fatal(
- catgets(catd, 1, 28, "Read error in archive `%s': invalid archive file member header at 0x%x"),
+ gettext("Read error in archive `%s': invalid archive file member header at 0x%x"),
library->string_mb,
ftell(arp->fd)
);
}
/* If it's a long name, retrieve it from long name table */
@@ -509,11 +510,11 @@
member->body.member.member =
GETNAME(member_string, FIND_LENGTH);
}
if (sscanf(arp->ar_port.ar_date, "%ld", &date) != 1) {
WCSTOMBS(mbs_buffer, name_string);
- fatal(catgets(catd, 1, 4, "Bad date field for member `%s' in archive `%s'"),
+ fatal(gettext("Bad date field for member `%s' in archive `%s'"),
mbs_buffer,
library->string_mb);
}
/*
* [tolik] Fix for dmake bug 1234018.
@@ -522,11 +523,11 @@
name->stat.time.tv_sec = date;
name->stat.time.tv_nsec = LONG_MAX;
}
if (sscanf(arp->ar_port.ar_size, "%ld", &ptr) != 1) {
WCSTOMBS(mbs_buffer, name_string);
- fatal(catgets(catd, 1, 5, "Bad size field for member `%s' in archive `%s'"),
+ fatal(gettext("Bad size field for member `%s' in archive `%s'"),
mbs_buffer,
library->string_mb);
}
ptr += (ptr & 1);
if (fseek(arp->fd, ptr, 1) != 0) {
@@ -536,11 +537,11 @@
break;
}
/* Only here if fread() [or IS_EQUALN()] failed and not at EOF */
read_error:
- fatal(catgets(catd, 1, 6, "Read error in archive `%s': %s"),
+ fatal(gettext("Read error in archive `%s': %s"),
library->string_mb,
errmsg(errno));
/* NOTREACHED */
}
@@ -569,11 +570,11 @@
if (fseek(arp->fd, arp->first_ar_mem, 0) != 0) {
return failed;
}
if ((ar_member_header =
(Ar_port *) alloca((int) sizeof(Ar_port))) == NULL){
- perror(catgets(catd, 1, 7, "memory allocation failure"));
+ perror(gettext("memory allocation failure"));
return failed;
}
int ret = read_member_header(ar_member_header, arp->fd, filename);
if (ret == failed) {
return failed;
@@ -581,11 +582,11 @@
/* There is no member header - empty archive */
return succeeded;
}
/* Do we have special member containing long names? */
if (IS_EQUALN(ar_member_header->ar_name,
- NOCATGETS("// "),
+ "// ",
16)){
if (sscanf(ar_member_header->ar_size,
"%ld",
&table_size) != 1) {
return failed;
@@ -629,11 +630,11 @@
int maxs;
int offset;
char buffer[4];
if (arp->sym_begin == 0L || arp->num_symbols == 0L) {
- fatal(catgets(catd, 1, 8, "Cannot find symbol `%s' in archive `%s'"),
+ fatal(gettext("Cannot find symbol `%s' in archive `%s'"),
member->body.member.entry->string_mb,
member->body.member.library->string_mb);
}
if (fseek(arp->fd, arp->sym_begin, 0) != 0) {
@@ -724,11 +725,11 @@
goto read_error;
}
if (sscanf(arp->ar_port.ar_date,
"%ld",
&date) != 1) {
- fatal(catgets(catd, 1, 9, "Bad date field for member `%s' in archive `%s'"),
+ fatal(gettext("Bad date field for member `%s' in archive `%s'"),
arp->ar_port.ar_name,
target->string_mb);
}
/* If it's a long name, retrieve it from long name table */
if (arp->ar_port.ar_name[0] == '/') {
@@ -759,22 +760,22 @@
offs++;
while(*syms!='\0') syms++;
syms++;
}
}
- fatal(catgets(catd, 1, 10, "Cannot find symbol `%s' in archive `%s'"),
+ fatal(gettext("Cannot find symbol `%s' in archive `%s'"),
member->body.member.entry->string_mb,
member->body.member.library->string_mb);
/*NOTREACHED*/
read_error:
if (ferror(arp->fd)) {
- fatal(catgets(catd, 1, 11, "Read error in archive `%s': %s"),
+ fatal(gettext("Read error in archive `%s': %s"),
member->body.member.library->string_mb,
errmsg(errno));
} else {
- fatal(catgets(catd, 1, 12, "Read error in archive `%s': Premature EOF"),
+ fatal(gettext("Read error in archive `%s': Premature EOF"),
member->body.member.library->string_mb);
}
}
/*
@@ -833,11 +834,11 @@
header->ar_fmag,
sizeof (header->ar_fmag)
)
) {
fatal(
- catgets(catd, 1, 28, "Read error in archive `%s': invalid archive file member header at 0x%x"),
+ gettext("Read error in archive `%s': invalid archive file member header at 0x%x"),
filename,
ftell(fd)
);
}
return succeeded;