+
+int GetLocalePrefs(void)
+{
+ StrBuf *Buf;
+ char buf[SIZ];
+ char dialog_result[PATH_MAX];
+ FILE *fp;
+ int i = 0;
+ int offs = 0;
+
+
+ Buf = NewStrBuf();
+
+ StrBufAppendBufPlain(Buf, HKEY("Select the locale webcit should use : \n"), 0);
+#ifdef HAVE_USELOCALE
+ StrBufAppendBufPlain(Buf, HKEY(" 0 Let the user select it at the login prompt (default)\n"), 0);
+ offs ++;
+#endif
+ for (i = 0; i < NUM_LANGS; i++) {
+ StrBufAppendPrintf(Buf, " %ld: %s\n", i + offs, AvailLang[i]);
+
+ }
+
+ switch (setup_type) {
+ case UI_TEXT:
+ title("WebCit setup");
+ printf("\n%s\n", ChrPtr(Buf));
+ printf("This is currently set to:\n%ld\n", 0L);
+ printf("Enter new value or press return to leave unchanged:\n");
+ fgets(buf, sizeof buf, stdin);
+ return atoi(buf);
+ break;
+
+ case UI_DIALOG:
+ CtdlMakeTempFileName(dialog_result, sizeof dialog_result);
+ sprintf(buf, "exec %s --inputbox '%s' 19 72 '%ld' 2>%s",
+ getenv("CTDL_DIALOG"),
+ ChrPtr(Buf),
+ 0L,
+ dialog_result);
+ system(buf);
+ fp = fopen(dialog_result, "r");
+ if (fp != NULL) {
+ char *str = &buf[0];
+ fgets(str, sizeof buf, fp);
+ if (str[strlen(str)-1] == 10) {
+ str[strlen(str)-1] = 0;
+ }
+ fclose(fp);
+ unlink(dialog_result);
+ return atoi(buf);
+ }
+ break;
+
+ }
+ return 0;
+}
+