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

*** 35,44 **** --- 35,45 ---- #include <sys/socket.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/utsname.h> #include <rpc/rpc.h> /* host2netname(), netname2host() */ + #include <libintl.h> /* * Defined macros */
*** 96,115 **** wchar_t *ms; int pmake_max_jobs = 0; struct utsname uts_info; ! MBSTOWCS(wcs_buffer, NOCATGETS("MAKE_MACHINES")); MAKE_MACHINES = GETNAME(wcs_buffer, FIND_LENGTH); /* Did the user specify a .make.machines file on the command line? */ default_make_machines = false; if (make_machines_name == NULL) { /* Try reading the default .make.machines file, in $(HOME). */ ! homedir = getenv(NOCATGETS("HOME")); if ((homedir != NULL) && (strlen(homedir) < (sizeof(mb_make_machines_path) - 16))) { sprintf(mb_make_machines_path, ! NOCATGETS("%s/.make.machines"), homedir); MBSTOWCS(make_machines_path, mb_make_machines_path); make_machines_name = GETNAME(make_machines_path, FIND_LENGTH); default_make_machines = true; } if (make_machines_name == NULL) { --- 97,116 ---- wchar_t *ms; int pmake_max_jobs = 0; struct utsname uts_info; ! MBSTOWCS(wcs_buffer, "MAKE_MACHINES"); MAKE_MACHINES = GETNAME(wcs_buffer, FIND_LENGTH); /* Did the user specify a .make.machines file on the command line? */ default_make_machines = false; if (make_machines_name == NULL) { /* Try reading the default .make.machines file, in $(HOME). */ ! homedir = getenv("HOME"); if ((homedir != NULL) && (strlen(homedir) < (sizeof(mb_make_machines_path) - 16))) { sprintf(mb_make_machines_path, ! "%s/.make.machines", homedir); MBSTOWCS(make_machines_path, mb_make_machines_path); make_machines_name = GETNAME(make_machines_path, FIND_LENGTH); default_make_machines = true; } if (make_machines_name == NULL) {
*** 125,135 **** */ /* Open the .make.machines file. */ if ((make_machines_file = fopen(make_machines_name->string_mb, "r")) == NULL) { if (!default_make_machines) { /* Error opening .make.machines file. */ ! fatal(catgets(catd, 1, 314, "Open of %s failed: %s"), make_machines_name->string_mb, errmsg(errno)); } else { /* * No $(HOME)/.make.machines file. --- 126,136 ---- */ /* Open the .make.machines file. */ if ((make_machines_file = fopen(make_machines_name->string_mb, "r")) == NULL) { if (!default_make_machines) { /* Error opening .make.machines file. */ ! fatal(gettext("Open of %s failed: %s"), make_machines_name->string_mb, errmsg(errno)); } else { /* * No $(HOME)/.make.machines file.
*** 138,148 **** return(0); } /* Stat the .make.machines file to get the size of the file. */ } else if (fstat(fileno(make_machines_file), &make_machines_buf) < 0) { /* Error stat'ing .make.machines file. */ ! fatal(catgets(catd, 1, 315, "Stat of %s failed: %s"), make_machines_name->string_mb, errmsg(errno)); } else { /* Allocate memory for "MAKE_MACHINES=<contents of .m.m>" */ make_machines_list_mb = --- 139,149 ---- return(0); } /* Stat the .make.machines file to get the size of the file. */ } else if (fstat(fileno(make_machines_file), &make_machines_buf) < 0) { /* Error stat'ing .make.machines file. */ ! fatal(gettext("Stat of %s failed: %s"), make_machines_name->string_mb, errmsg(errno)); } else { /* Allocate memory for "MAKE_MACHINES=<contents of .m.m>" */ make_machines_list_mb =
*** 159,169 **** make_machines_file) != make_machines_buf.st_size) { /* * Error reading .make.machines file. * Return 0 for PMake max jobs. */ ! warning(catgets(catd, 1, 316, "Unable to read %s"), make_machines_name->string_mb); (void) fclose(make_machines_file); retmem_mb((caddr_t) make_machines_list_mb); return(0); } else { --- 160,170 ---- make_machines_file) != make_machines_buf.st_size) { /* * Error reading .make.machines file. * Return 0 for PMake max jobs. */ ! warning(gettext("Unable to read %s"), make_machines_name->string_mb); (void) fclose(make_machines_file); retmem_mb((caddr_t) make_machines_list_mb); return(0); } else {
*** 172,182 **** *(make_machines_list_mb + strlen(MAKE_MACHINES->string_mb) + 1 + make_machines_buf.st_size) = (int) nul_char; if (putenv(make_machines_list_mb) != 0) { ! warning(catgets(catd, 1, 317, "Couldn't put contents of %s in environment"), make_machines_name->string_mb); } else { make_machines_list_mb += strlen(MAKE_MACHINES->string_mb) + 1; make_machines_list = ALLOC_WC(strlen(make_machines_list_mb) + 1); (void) mbstowcs(make_machines_list, --- 173,183 ---- *(make_machines_list_mb + strlen(MAKE_MACHINES->string_mb) + 1 + make_machines_buf.st_size) = (int) nul_char; if (putenv(make_machines_list_mb) != 0) { ! warning(gettext("Couldn't put contents of %s in environment"), make_machines_name->string_mb); } else { make_machines_list_mb += strlen(MAKE_MACHINES->string_mb) + 1; make_machines_list = ALLOC_WC(strlen(make_machines_list_mb) + 1); (void) mbstowcs(make_machines_list,
*** 236,246 **** * 1) hostname is longer than MAX_HOSTNAMELEN, or * 2) hostname is unknown */ if ((wslen(mp) > MAX_HOSTNAMELEN) || ((hp = gethostbyname(mbs_buffer)) == NULL)) { ! warning(catgets(catd, 1, 318, "Ignoring unknown host %s"), mbs_buffer); SKIPTOEND(ms); /* Increment ptr if not end of file. */ if (*ms) { ms++; --- 237,247 ---- * 1) hostname is longer than MAX_HOSTNAMELEN, or * 2) hostname is unknown */ if ((wslen(mp) > MAX_HOSTNAMELEN) || ((hp = gethostbyname(mbs_buffer)) == NULL)) { ! warning(gettext("Ignoring unknown host %s"), mbs_buffer); SKIPTOEND(ms); /* Increment ptr if not end of file. */ if (*ms) { ms++;
*** 272,293 **** continue; } /* If we get here, local_host is in .make.machines. */ if (c != '\n') { /* Now look for keyword 'max'. */ ! MBSTOWCS(wcs_buffer, NOCATGETS("max")); SKIPSPACE(ms); while ((*ms != '\n') && (*ms)) { if (*ms == '#') { pskip_comment(&ms); } else if (IS_WEQUALN(ms, wcs_buffer, 3)) { /* Skip "max". */ ms += 3; pmake_max_jobs = get_max(&ms, mp); SKIPSPACE(ms); } else { ! warning(catgets(catd, 1, 322, "unknown option for host %s"), mbs_buffer); SKIPTOEND(ms); break; } } } --- 273,294 ---- continue; } /* If we get here, local_host is in .make.machines. */ if (c != '\n') { /* Now look for keyword 'max'. */ ! MBSTOWCS(wcs_buffer, "max"); SKIPSPACE(ms); while ((*ms != '\n') && (*ms)) { if (*ms == '#') { pskip_comment(&ms); } else if (IS_WEQUALN(ms, wcs_buffer, 3)) { /* Skip "max". */ ms += 3; pmake_max_jobs = get_max(&ms, mp); SKIPSPACE(ms); } else { ! warning(gettext("unknown option for host %s"), mbs_buffer); SKIPTOEND(ms); break; } } }
*** 391,401 **** WCSTOMBS(mbs_buffer, hostname); /* Look for `='. */ SKIPSPACE(ms); if ((!*ms) || (*ms == '\n') || (*ms != '=')) { SKIPTOEND(ms); ! warning(catgets(catd, 1, 319, "expected `=' after max, ignoring rest of line for host %s"), mbs_buffer); *ms_address = ms; return((int) limit); } else { ms++; --- 392,402 ---- WCSTOMBS(mbs_buffer, hostname); /* Look for `='. */ SKIPSPACE(ms); if ((!*ms) || (*ms == '\n') || (*ms != '=')) { SKIPTOEND(ms); ! warning(gettext("expected `=' after max, ignoring rest of line for host %s"), mbs_buffer); *ms_address = ms; return((int) limit); } else { ms++;
*** 403,417 **** if ((*ms != '\n') && (*ms != '\0')) { /* We've found, hopefully, a valid "max" value. */ limit = (int) wcstol(ms, &ms, 10); if (limit < 1) { limit = PMAKE_DEF_MAX_JOBS; ! warning(catgets(catd, 1, 320, "max value cannot be less than or equal to zero for host %s"), mbs_buffer); } } else { /* No "max" value after "max=". */ ! warning(catgets(catd, 1, 321, "no max value specified for host %s"), mbs_buffer); } *ms_address = ms; return(limit); } } --- 404,418 ---- if ((*ms != '\n') && (*ms != '\0')) { /* We've found, hopefully, a valid "max" value. */ limit = (int) wcstol(ms, &ms, 10); if (limit < 1) { limit = PMAKE_DEF_MAX_JOBS; ! warning(gettext("max value cannot be less than or equal to zero for host %s"), mbs_buffer); } } else { /* No "max" value after "max=". */ ! warning(gettext("no max value specified for host %s"), mbs_buffer); } *ms_address = ms; return(limit); } }