From f635c336c45c1c998ace05c37a83cab5d398bee9 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 10 Sep 2008 16:03:43 +0200 Subject: [PATCH] ipcmk: add NLS support Signed-off-by: Karel Zak --- po/POTFILES.in | 1 + sys-utils/ipcmk.c | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index b73d3a45..7187a887 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -95,6 +95,7 @@ sys-utils/ctrlaltdel.c sys-utils/cytune.c sys-utils/dmesg.c sys-utils/flock.c +sys-utils/ipcmk.c sys-utils/ipcrm.c sys-utils/ipcs.c sys-utils/ldattach.c diff --git a/sys-utils/ipcmk.c b/sys-utils/ipcmk.c index 98ad02d0..2e663bf0 100644 --- a/sys-utils/ipcmk.c +++ b/sys-utils/ipcmk.c @@ -33,6 +33,8 @@ #include #include +#include "nls.h" + static const char *progname; key_t createKey(void) @@ -79,13 +81,13 @@ int createSem(int nsems, int permission) void usage(int rc) { - printf("\nUsage: %s [options]\n\n", progname); - printf( + printf(_("\nUsage: %s [options]\n\n"), progname); + printf(_( " -M create shared memory segment of size \n" " -S create semaphore array with elements\n" " -Q create message queue\n" - " -p permission for the resource (default is 0644)\n"); - printf("\nFor more information see ipcmk(1).\n\n"); + " -p permission for the resource (default is 0644)\n")); + printf(_("\nFor more information see ipcmk(1).\n\n")); exit(rc); } @@ -102,6 +104,10 @@ int main(int argc, char **argv) if (!progname) progname = "ipcmk"; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + while((opt = getopt(argc, argv, "hM:QS:p:")) != -1) { switch(opt) { case 'M': @@ -133,25 +139,25 @@ int main(int argc, char **argv) if (doShm) { int shmid; if (-1 == (shmid = createShm(size, permission))) - err(EXIT_FAILURE, "create share memory failed"); + err(EXIT_FAILURE, _("create share memory failed")); else - printf("Shared memory id: %d\n", shmid); + printf(_("Shared memory id: %d\n"), shmid); } if (doMsg) { int msgid; if (-1 == (msgid = createMsg(permission))) - err(EXIT_FAILURE, "create message queue failed"); + err(EXIT_FAILURE, _("create message queue failed")); else - printf("Message queue id: %d\n", msgid); + printf(_("Message queue id: %d\n"), msgid); } if (doSem) { int semid; if (-1 == (semid = createSem(nsems, permission))) - err(EXIT_FAILURE, "create semaphore failed"); + err(EXIT_FAILURE, _("create semaphore failed")); else - printf("Semaphore id: %d\n", semid); + printf(_("Semaphore id: %d\n"), semid); } return EXIT_SUCCESS; -- 2.39.5