/* 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);
/* 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);
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;
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);