- Fixed userdefaults in WINGs not to synchronize on exit a domain that is
[wmaker-crm.git] / WINGs / Tests / wmquery.c
blobbd127589599aff6f3ebba8d73eeaef450a368042
2 /*
3 * Author: Len Trigg <trigg@cs.waikato.ac.nz>
4 */
7 #include <WINGs/WINGs.h>
9 #include <unistd.h>
10 #include <stdio.h>
11 #include <stdlib.h>
13 #include "logo.xpm"
18 void
19 wAbort()
21 exit(1);
24 char *ProgName;
26 void usage(void)
28 fprintf(stderr,
29 "usage:\n"
30 "\t%s [-options]\n"
31 "\n"
32 "options:\n"
33 " -i <str>\tInitial entry contents (default none)\n"
34 " -p <str>\tPrompt message (default none)\n"
35 " -t <str>\tQuery window title (default none)\n"
36 "\n"
37 "information:\n"
38 "\t%s pops up a WindowMaker style input panel.\n"
39 "\n"
40 "version:\n"
41 "\t%s\n"
42 ,ProgName,ProgName,__DATE__
44 exit(0);
47 int main(int argc, char **argv)
49 Display *dpy = XOpenDisplay("");
50 WMScreen *scr;
51 WMPixmap *pixmap;
52 char *title = NULL;
53 char *prompt = NULL;
54 char *initial = NULL;
55 char *result = NULL;
56 int ch;
57 extern char *optarg;
58 extern int optind;
60 WMInitializeApplication("WMQuery", &argc, argv);
62 ProgName = argv[0];
64 if (!dpy) {
65 puts("could not open display");
66 exit(1);
69 while((ch = getopt(argc, argv, "i:hp:t:")) != -1)
70 switch(ch)
72 case 'i':
73 initial = optarg;
74 break;
75 case 'p':
76 prompt = optarg;
77 break;
78 case 't':
79 title = optarg;
80 break;
81 default:
82 usage();
85 for(; optind <argc; optind++)
86 usage();
89 scr = WMCreateSimpleApplicationScreen(dpy);
91 pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
93 WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
95 if ((result = WMRunInputPanel(scr, NULL, title, prompt, initial, "OK", "Cancel")) != NULL)
96 printf("%s\n", result);
97 else
98 printf("\n");
99 return 0;