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

*** 21,43 **** /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #include <avo/intl.h> /* for NOCATGETS */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/errno.h> #include <sys/param.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <vroot/vroot.h> - #include <mksdmsi18n/mksdmsi18n.h> #include <signal.h> #include <errno.h> /* errno */ extern char *sys_errlist[]; extern int sys_nerr; static void file_lock_error(char *msg, char *file, char *str, int arg1, int arg2); --- 21,42 ---- /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/errno.h> #include <sys/param.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <vroot/vroot.h> #include <signal.h> #include <errno.h> /* errno */ + #include <libintl.h> extern char *sys_errlist[]; extern int sys_nerr; static void file_lock_error(char *msg, char *file, char *str, int arg1, int arg2);
*** 107,117 **** return 0; /* success */ } UNBLOCK_INTERUPTS; if (errno != EEXIST) { ! file_lock_error(msg, name, (char *)NOCATGETS("symlink(%s, %s)"), (int) name, (int) lockname); fprintf(stderr, "%s", msg); return errno; } --- 106,116 ---- return 0; /* success */ } UNBLOCK_INTERUPTS; if (errno != EEXIST) { ! file_lock_error(msg, name, (char *)"symlink(%s, %s)", (int) name, (int) lockname); fprintf(stderr, "%s", msg); return errno; }
*** 129,145 **** if ((counter > 5) && (!printed_warning)) { /* Print waiting message after 5 secs */ (void) getcwd(msg, MAXPATHLEN); fprintf(stderr, ! catgets(libmksdmsi18n_catd, 1, 162, "file_lock: file %s is already locked.\n"), name); fprintf(stderr, ! catgets(libmksdmsi18n_catd, 1, 163, "file_lock: will periodically check the lockfile %s for two minutes.\n"), lockname); fprintf(stderr, ! catgets(libmksdmsi18n_catd, 1, 144, "Current working directory %s\n"), msg); printed_warning = 1; } --- 128,144 ---- if ((counter > 5) && (!printed_warning)) { /* Print waiting message after 5 secs */ (void) getcwd(msg, MAXPATHLEN); fprintf(stderr, ! gettext("file_lock: file %s is already locked.\n"), name); fprintf(stderr, ! gettext("file_lock: will periodically check the lockfile %s for two minutes.\n"), lockname); fprintf(stderr, ! gettext("Current working directory %s\n"), msg); printed_warning = 1; }
*** 160,176 **** static void file_lock_error(char *msg, char *file, char *str, int arg1, int arg2) { int len; ! sprintf(msg, catgets(libmksdmsi18n_catd, 1, 145, "Could not lock file `%s'; "), file); len = strlen(msg); sprintf(&msg[len], str, arg1, arg2); ! strcat(msg, catgets(libmksdmsi18n_catd, 1, 146, " failed - ")); if (errno < sys_nerr) { strcat(msg, strerror(errno)); } else { len = strlen(msg); ! sprintf(&msg[len], NOCATGETS("errno %d"), errno); } } --- 159,175 ---- static void file_lock_error(char *msg, char *file, char *str, int arg1, int arg2) { int len; ! sprintf(msg, gettext("Could not lock file `%s'; "), file); len = strlen(msg); sprintf(&msg[len], str, arg1, arg2); ! strcat(msg, gettext(" failed - ")); if (errno < sys_nerr) { strcat(msg, strerror(errno)); } else { len = strlen(msg); ! sprintf(&msg[len], "errno %d", errno); } }