Print this page
make: translate using gettext, rather than the unmaintainable catgets
*** 143,155 ****
do_not_exec_rule ||
(report_dependencies_level > 0)) {
return;
}
/* Lock the file for writing. */
! make_state_lockfile = getmem(strlen(make_state->string_mb) + strlen(NOCATGETS(".lock")) + 1);
(void) sprintf(make_state_lockfile,
! NOCATGETS("%s.lock"),
make_state->string_mb);
if (lock_err = file_lock(make_state->string_mb,
make_state_lockfile,
(int *) &make_state_locked, 0)) {
retmem_mb(make_state_lockfile);
--- 143,155 ----
do_not_exec_rule ||
(report_dependencies_level > 0)) {
return;
}
/* Lock the file for writing. */
! make_state_lockfile = getmem(strlen(make_state->string_mb) + strlen(".lock") + 1);
(void) sprintf(make_state_lockfile,
! "%s.lock",
make_state->string_mb);
if (lock_err = file_lock(make_state->string_mb,
make_state_lockfile,
(int *) &make_state_locked, 0)) {
retmem_mb(make_state_lockfile);
*** 160,198 ****
* called by the exit handler so we don't call
* it again.
*/
if (exiting) {
! (void) sprintf(buffer, NOCATGETS("%s/.make.state.%d.XXXXXX"), tmpdir, getpid());
report_pwd = true;
! warning(catgets(catd, 1, 60, "Writing to %s"), buffer);
int fdes = mkstemp(buffer);
if ((fdes < 0) || (fd = fdopen(fdes, "w")) == NULL) {
fprintf(stderr,
! catgets(catd, 1, 61, "Could not open statefile `%s': %s"),
buffer,
errmsg(errno));
return;
}
} else {
report_pwd = true;
! fatal(catgets(catd, 1, 62, "Can't lock .make.state"));
}
}
(void) sprintf(make_state_tempfile,
! NOCATGETS("%s.tmp"),
make_state->string_mb);
/* Delete old temporary statefile (in case it exists) */
(void) unlink(make_state_tempfile);
if ((fd = fopen(make_state_tempfile, "w")) == NULL) {
lock_err = errno; /* Save it! unlink() can change errno */
(void) unlink(make_state_lockfile);
retmem_mb(make_state_lockfile);
make_state_lockfile = NULL;
make_state_locked = false;
! fatal(catgets(catd, 1, 59, "Could not open temporary statefile `%s': %s"),
make_state_tempfile,
errmsg(lock_err));
}
/*
* Set a trap for failed writes. If a write fails, the routine
--- 160,198 ----
* called by the exit handler so we don't call
* it again.
*/
if (exiting) {
! (void) sprintf(buffer, "%s/.make.state.%d.XXXXXX", tmpdir, getpid());
report_pwd = true;
! warning(gettext("Writing to %s"), buffer);
int fdes = mkstemp(buffer);
if ((fdes < 0) || (fd = fdopen(fdes, "w")) == NULL) {
fprintf(stderr,
! gettext("Could not open statefile `%s': %s"),
buffer,
errmsg(errno));
return;
}
} else {
report_pwd = true;
! fatal(gettext("Can't lock .make.state"));
}
}
(void) sprintf(make_state_tempfile,
! "%s.tmp",
make_state->string_mb);
/* Delete old temporary statefile (in case it exists) */
(void) unlink(make_state_tempfile);
if ((fd = fopen(make_state_tempfile, "w")) == NULL) {
lock_err = errno; /* Save it! unlink() can change errno */
(void) unlink(make_state_lockfile);
retmem_mb(make_state_lockfile);
make_state_lockfile = NULL;
make_state_locked = false;
! fatal(gettext("Could not open temporary statefile `%s': %s"),
make_state_tempfile,
errmsg(lock_err));
}
/*
* Set a trap for failed writes. If a write fails, the routine
*** 206,226 ****
(void) unlink(make_state_lockfile);
retmem_mb(make_state_lockfile);
make_state_lockfile = NULL;
make_state_locked = false;
}
! fatal(catgets(catd, 1, 63, "Giving up on writing statefile"));
}
sleep(10);
! (void) sprintf(buffer, NOCATGETS("%s/.make.state.%d.XXXXXX"), tmpdir, getpid());
int fdes = mkstemp(buffer);
if ((fdes < 0) || (fd = fdopen(fdes, "w")) == NULL) {
! fatal(catgets(catd, 1, 64, "Could not open statefile `%s': %s"),
buffer,
errmsg(errno));
}
! warning(catgets(catd, 1, 65, "Initial write of statefile failed. Trying again on %s"),
buffer);
}
/* Write the version stamp. */
XFWRITE(make_version->string_mb,
--- 206,226 ----
(void) unlink(make_state_lockfile);
retmem_mb(make_state_lockfile);
make_state_lockfile = NULL;
make_state_locked = false;
}
! fatal(gettext("Giving up on writing statefile"));
}
sleep(10);
! (void) sprintf(buffer, "%s/.make.state.%d.XXXXXX", tmpdir, getpid());
int fdes = mkstemp(buffer);
if ((fdes < 0) || (fd = fdopen(fdes, "w")) == NULL) {
! fatal(gettext("Could not open statefile `%s': %s"),
buffer,
errmsg(errno));
}
! warning(gettext("Initial write of statefile failed. Trying again on %s"),
buffer);
}
/* Write the version stamp. */
XFWRITE(make_version->string_mb,
*** 363,373 ****
(void) unlink(make_state_tempfile);
(void) unlink(make_state_lockfile);
retmem_mb(make_state_lockfile);
make_state_lockfile = NULL;
make_state_locked = false;
! fatal(catgets(catd, 1, 356, "Could not delete old statefile `%s': %s"),
make_state->string_mb,
errmsg(lock_err));
}
if (rename(make_state_tempfile, make_state->string_mb) != 0) {
lock_err = errno; /* Save it! unlink() can change errno */
--- 363,373 ----
(void) unlink(make_state_tempfile);
(void) unlink(make_state_lockfile);
retmem_mb(make_state_lockfile);
make_state_lockfile = NULL;
make_state_locked = false;
! fatal(gettext("Could not delete old statefile `%s': %s"),
make_state->string_mb,
errmsg(lock_err));
}
if (rename(make_state_tempfile, make_state->string_mb) != 0) {
lock_err = errno; /* Save it! unlink() can change errno */
*** 375,385 ****
(void) unlink(make_state_tempfile);
(void) unlink(make_state_lockfile);
retmem_mb(make_state_lockfile);
make_state_lockfile = NULL;
make_state_locked = false;
! fatal(catgets(catd, 1, 357, "Could not rename `%s' to `%s': %s"),
make_state_tempfile,
make_state->string_mb,
errmsg(lock_err));
}
}
--- 375,385 ----
(void) unlink(make_state_tempfile);
(void) unlink(make_state_lockfile);
retmem_mb(make_state_lockfile);
make_state_lockfile = NULL;
make_state_locked = false;
! fatal(gettext("Could not rename `%s' to `%s': %s"),
make_state_tempfile,
make_state->string_mb,
errmsg(lock_err));
}
}