int flags = 0;
int defaultNo = 0;
int separateOutput = 0;
+ int outputfd = 2;
+ FILE *output = stderr;
const char * result;
const char ** selections, ** next;
char * title = NULL;
exit(1);
}
+ output = fdopen (outputfd, "w");
+ if (output == NULL ) {
+ perror ("Cannot open output-fd\n");
+ exit (DLG_ERROR);
+ }
+
if (mode == MODE_NONE) usage();
if (!(text = poptGetArg(optCon))) usage();
case MODE_INPUTBOX:
rc = inputBox(text, height, width, optCon, flags, &result);
- if (!rc) fprintf(stderr, "%s", result);
+ if (rc == DLG_OKAY) fprintf(output, "%s", result);
break;
case MODE_MENU:
rc = listBox(text, height, width, optCon, flags, &result);
- if (!rc) fprintf(stderr, "%s", result);
+ if (rc == DLG_OKAY) fprintf(output, "%s", result);
break;
case MODE_RADIOLIST:
rc = checkList(text, height, width, optCon, 1, flags, &selections);
- if (!rc) {
- fprintf(stderr, "%s", selections[0]);
+ if (rc == DLG_OKAY) {
+ fprintf(output, "%s", selections[0]);
free(selections);
}
break;
if (!rc) {
for (next = selections; *next; next++) {
if (!separateOutput) {
- if (needSpace) putc(' ', stderr);
- fprintf(stderr, "\"%s\"", *next);
+ if (needSpace) putc(' ', output);
+ fprintf(output, "\"%s\"", *next);
needSpace = 1;
} else {
- fprintf(stderr, "%s\n", *next);
+ fprintf(output, "%s\n", *next);
}
}