Print this page
make: translate using gettext, rather than the unmaintainable catgets
*** 41,50 ****
--- 41,51 ----
*/
#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,240 ****
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"),
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"),
member->body.member.library->string_mb,
errmsg(errno));
}
}
if (member->body.member.entry != NULL) {
--- 222,241 ----
if (member->body.member.member == NULL) {
member->body.member.member = empty_name;
}
return target->stat.time = file_doesnt_exist;
} else {
! 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(gettext("Can't access archive `%s': %s"),
member->body.member.library->string_mb,
errmsg(errno));
}
}
if (member->body.member.entry != NULL) {
*** 314,324 ****
/*
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;
--- 315,325 ----
/*
MBSTOWCS(wcs_buffer, "/ ");
if (IS_WEQUALN(arp->ar_port.ar_name, wcs_buffer, 16)) {
*/
if (IS_EQUALN(arp->ar_port.ar_name,
! "/ ",
16)) {
if (sscanf(arp->ar_port.ar_size,
"%ld",
&arp->sym_size) != 1) {
return failed;
*** 332,342 ****
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);
/* NOTREACHED */
return failed;
}
--- 333,343 ----
arp->first_ar_mem = arp->sym_begin +
arp->sym_size - sizeof buffer;
}
return succeeded;
}
! fatal(gettext("`%s' is not an archive"), filename);
/* NOTREACHED */
return failed;
}
*** 462,472 ****
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"),
library->string_mb,
ftell(arp->fd)
);
}
/* If it's a long name, retrieve it from long name table */
--- 463,473 ----
sizeof arp->ar_port.ar_fmag)) {
if (feof(arp->fd)) {
return succeeded;
}
fatal(
! 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,519 ****
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'"),
mbs_buffer,
library->string_mb);
}
/*
* [tolik] Fix for dmake bug 1234018.
--- 510,520 ----
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(gettext("Bad date field for member `%s' in archive `%s'"),
mbs_buffer,
library->string_mb);
}
/*
* [tolik] Fix for dmake bug 1234018.
*** 522,532 ****
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'"),
mbs_buffer,
library->string_mb);
}
ptr += (ptr & 1);
if (fseek(arp->fd, ptr, 1) != 0) {
--- 523,533 ----
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(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,546 ****
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"),
library->string_mb,
errmsg(errno));
/* NOTREACHED */
}
--- 537,547 ----
break;
}
/* Only here if fread() [or IS_EQUALN()] failed and not at EOF */
read_error:
! fatal(gettext("Read error in archive `%s': %s"),
library->string_mb,
errmsg(errno));
/* NOTREACHED */
}
*** 569,579 ****
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"));
return failed;
}
int ret = read_member_header(ar_member_header, arp->fd, filename);
if (ret == failed) {
return failed;
--- 570,580 ----
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(gettext("memory allocation failure"));
return failed;
}
int ret = read_member_header(ar_member_header, arp->fd, filename);
if (ret == failed) {
return failed;
*** 581,591 ****
/* 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;
--- 582,592 ----
/* 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,
! "// ",
16)){
if (sscanf(ar_member_header->ar_size,
"%ld",
&table_size) != 1) {
return failed;
*** 629,639 ****
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'"),
member->body.member.entry->string_mb,
member->body.member.library->string_mb);
}
if (fseek(arp->fd, arp->sym_begin, 0) != 0) {
--- 630,640 ----
int maxs;
int offset;
char buffer[4];
if (arp->sym_begin == 0L || arp->num_symbols == 0L) {
! 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,734 ****
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'"),
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] == '/') {
--- 725,735 ----
goto read_error;
}
if (sscanf(arp->ar_port.ar_date,
"%ld",
&date) != 1) {
! 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,780 ****
offs++;
while(*syms!='\0') syms++;
syms++;
}
}
! fatal(catgets(catd, 1, 10, "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"),
member->body.member.library->string_mb,
errmsg(errno));
} else {
! fatal(catgets(catd, 1, 12, "Read error in archive `%s': Premature EOF"),
member->body.member.library->string_mb);
}
}
/*
--- 760,781 ----
offs++;
while(*syms!='\0') syms++;
syms++;
}
}
! 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(gettext("Read error in archive `%s': %s"),
member->body.member.library->string_mb,
errmsg(errno));
} else {
! fatal(gettext("Read error in archive `%s': Premature EOF"),
member->body.member.library->string_mb);
}
}
/*
*** 833,843 ****
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"),
filename,
ftell(fd)
);
}
return succeeded;
--- 834,844 ----
header->ar_fmag,
sizeof (header->ar_fmag)
)
) {
fatal(
! gettext("Read error in archive `%s': invalid archive file member header at 0x%x"),
filename,
ftell(fd)
);
}
return succeeded;