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

*** 27,41 **** #include <stdlib.h> #include <string.h> #include <sys/param.h> #include <sys/wait.h> #include <unistd.h> #include <vroot/report.h> #include <vroot/vroot.h> - #include <mksdmsi18n/mksdmsi18n.h> - #include <avo/intl.h> /* for NOCATGETS */ #include <mk/defs.h> /* for tmpdir */ static FILE *report_file; static FILE *command_output_fp; static char *target_being_reported_for; --- 27,40 ---- #include <stdlib.h> #include <string.h> #include <sys/param.h> #include <sys/wait.h> #include <unistd.h> + #include <libintl.h> #include <vroot/report.h> #include <vroot/vroot.h> #include <mk/defs.h> /* for tmpdir */ static FILE *report_file; static FILE *command_output_fp; static char *target_being_reported_for;
*** 108,133 **** fclose(command_output_fp); if ((command_output_fp = fopen(command_output_tmpfile, "r")) == NULL) { return; } sprintf(nse_depinfo_file, "%s/%s", search_dir, NSE_DEPINFO); ! sprintf(merge_file, NOCATGETS("%s/.tmp%s.%d"), search_dir, NSE_DEPINFO, getpid()); sprintf(lock_file, "%s/%s", search_dir, NSE_DEPINFO_LOCK); err = file_lock(nse_depinfo_file, lock_file, &file_locked, 0); if (err) { if (warning_ptr != (void (*) (char *, ...)) NULL) { ! (*warning_ptr)(catgets(libmksdmsi18n_catd, 1, 147, "Couldn't write to %s"), nse_depinfo_file); } unlink(command_output_tmpfile); return; } /* If .nse_depinfo file doesn't exist */ if ((nse_depinfo_fp = fopen(nse_depinfo_file, "r+")) == NULL) { if (is_path) { if ((nse_depinfo_fp = fopen(nse_depinfo_file, "w")) == NULL) { ! fprintf(stderr, catgets(libmksdmsi18n_catd, 1, 148, "Cannot open `%s' for writing\n"), nse_depinfo_file); unlink(command_output_tmpfile); unlink(lock_file); return; --- 107,132 ---- fclose(command_output_fp); if ((command_output_fp = fopen(command_output_tmpfile, "r")) == NULL) { return; } sprintf(nse_depinfo_file, "%s/%s", search_dir, NSE_DEPINFO); ! sprintf(merge_file, "%s/.tmp%s.%d", search_dir, NSE_DEPINFO, getpid()); sprintf(lock_file, "%s/%s", search_dir, NSE_DEPINFO_LOCK); err = file_lock(nse_depinfo_file, lock_file, &file_locked, 0); if (err) { if (warning_ptr != (void (*) (char *, ...)) NULL) { ! (*warning_ptr)(gettext("Couldn't write to %s"), nse_depinfo_file); } unlink(command_output_tmpfile); return; } /* If .nse_depinfo file doesn't exist */ if ((nse_depinfo_fp = fopen(nse_depinfo_file, "r+")) == NULL) { if (is_path) { if ((nse_depinfo_fp = fopen(nse_depinfo_file, "w")) == NULL) { ! fprintf(stderr, gettext("Cannot open `%s' for writing\n"), nse_depinfo_file); unlink(command_output_tmpfile); unlink(lock_file); return;
*** 144,154 **** } unlink(command_output_tmpfile); return; } if ((merge_fp = fopen(merge_file, "w")) == NULL) { ! fprintf(stderr, catgets(libmksdmsi18n_catd, 1, 149, "Cannot open %s for writing\n"), merge_file); if (file_locked) { unlink(lock_file); } unlink(command_output_tmpfile); return; --- 143,153 ---- } unlink(command_output_tmpfile); return; } if ((merge_fp = fopen(merge_file, "w")) == NULL) { ! fprintf(stderr, gettext("Cannot open %s for writing\n"), merge_file); if (file_locked) { unlink(lock_file); } unlink(command_output_tmpfile); return;
*** 206,221 **** report_dep(char *iflag, char *filename) { if (command_output_fp == NULL) { sprintf(command_output_tmpfile, ! NOCATGETS("%s/%s.%d.XXXXXX"), tmpdir, NSE_DEPINFO, getpid()); int fd = mkstemp(command_output_tmpfile); if ((fd < 0) || (command_output_fp = fdopen(fd, "w")) == NULL) { return; } ! if ((search_dir = getenv(NOCATGETS("NSE_DEP"))) == NULL) { return; } atexit(close_file); strcpy(sfile, filename); if (iflag == NULL || *iflag == '\0') { --- 205,220 ---- report_dep(char *iflag, char *filename) { if (command_output_fp == NULL) { sprintf(command_output_tmpfile, ! "%s/%s.%d.XXXXXX", tmpdir, NSE_DEPINFO, getpid()); int fd = mkstemp(command_output_tmpfile); if ((fd < 0) || (command_output_fp = fdopen(fd, "w")) == NULL) { return; } ! if ((search_dir = getenv("NSE_DEP")) == NULL) { return; } atexit(close_file); strcpy(sfile, filename); if (iflag == NULL || *iflag == '\0') {
*** 255,275 **** char *sdir; char *newiflag; char filename[MAXPATHLEN]; char *p, *ptr; ! if ((sdir = getenv(NOCATGETS("NSE_DEP"))) == NULL) { return; } if ((p= getenv(SUNPRO_DEPENDENCIES)) == NULL) { return; } ptr = strchr(p, ' '); if( ! ptr ) { return; } ! sprintf(filename, NOCATGETS("%s-CPP"), ptr+1); getcwd(curdir, sizeof(curdir)); if (strcmp(curdir, sdir) != 0 && strlen(iflag) > 2 && iflag[2] != '/') { /* Makefile must have had an "cd xx; cc ..." */ /* Modify the -I path to be relative to the cd */ --- 254,274 ---- char *sdir; char *newiflag; char filename[MAXPATHLEN]; char *p, *ptr; ! if ((sdir = getenv("NSE_DEP")) == NULL) { return; } if ((p= getenv(SUNPRO_DEPENDENCIES)) == NULL) { return; } ptr = strchr(p, ' '); if( ! ptr ) { return; } ! sprintf(filename, "%s-CPP", ptr+1); getcwd(curdir, sizeof(curdir)); if (strcmp(curdir, sdir) != 0 && strlen(iflag) > 2 && iflag[2] != '/') { /* Makefile must have had an "cd xx; cc ..." */ /* Modify the -I path to be relative to the cd */