X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=common-src%2Ftoken.c;h=6489da3581e7d375601912a35d901c7bcc2ebb1b;hb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;hp=5dd8569a9a6206ed378de578317a72fd7c2b9680;hpb=d3b2175e084f88c8736ad7073eacbf4670147aec;p=debian%2Famanda diff --git a/common-src/token.c b/common-src/token.c index 5dd8569..6489da3 100644 --- a/common-src/token.c +++ b/common-src/token.c @@ -135,7 +135,7 @@ printf_arglist_function(char *squotef, char *, format) /* Format the token */ arglist_start(argp, format); - vsnprintf(linebuf, SIZEOF(linebuf), format, argp); + g_vsnprintf(linebuf, SIZEOF(linebuf), format, argp); arglist_end(argp); return quote(" ", linebuf); @@ -149,7 +149,7 @@ printf_arglist_function1(char *quotef, char *, sep, char *, format) /* Format the token */ arglist_start(argp, format); - vsnprintf(linebuf, SIZEOF(linebuf), format, argp); + g_vsnprintf(linebuf, SIZEOF(linebuf), format, argp); arglist_end(argp); return quote(sep, linebuf); @@ -415,8 +415,19 @@ main( char *sr; int i; + /* + * Configure program for internationalization: + * 1) Only set the message locale for now. + * 2) Set textdomain for all amanda related programs to "amanda" + * We don't want to be forced to support dozens of message catalogs + */ + setlocale(LC_MESSAGES, "C"); + textdomain("amanda"); + safe_fd(-1, 0); + setlocale(LC_ALL, "C"); + /* shut up compiler */ argc = argc; argv = argv; @@ -430,36 +441,38 @@ main( erroutput_type = ERR_INTERACTIVE; - printf("Testing split() with \" \" token separator\n"); + g_printf(_("Testing split() with \" \" token separator\n")); while(1) { - printf("Input string: "); + g_printf(_("Input string: ")); amfree(str); if ((str = agets(stdin)) == NULL) { - printf("\n"); + g_printf("\n"); break; } r = split(str, t, 20, " "); - printf("%d token%s:\n", r, (r == 1) ? "" : "s"); - for (i=0; i <= r; i++) printf("tok[%d] = \"%s\"\n", i, t[i]); + g_printf(plural(_("%d token:\n"), _("%d token:\n"), r), r); + for (i=0; i <= r; i++) + g_printf("tok[%d] = \"%s\"\n", i, t[i]); } amfree(str); - printf("\n"); + g_printf("\n"); - printf("Testing quote()\n"); + g_printf(_("Testing quote()\n")); while(1) { - printf("Input string: "); + g_printf(_("Input string: ")); amfree(str); if ((str = agets(stdin)) == NULL) { - printf("\n"); + g_printf("\n"); break; } sr = squote(str); - printf("Quoted = \"%s\"\n", sr); + g_printf(_("Quoted = \"%s\"\n"), sr); strncpy(str,sr,SIZEOF(str)-1); str[SIZEOF(str)-1] = '\0'; r = split(str, t, 20, " "); - if (r != 1) printf("split()=%d!\n", r); - printf("Unquoted = \"%s\"\n", t[1]); + if (r != 1) + g_printf("split()=%d!\n", r); + g_printf(_("Unquoted = \"%s\"\n"), t[1]); amfree(sr); } amfree(str);