fookb: Port to libdockapp.
[dockapps.git] / fookb / opts.c
blob2143518c67bffaa59cb76324eeed39aa6b2c9312
1 /*
2 * File: opts.c
4 * (c) 1998-2004 Alexey Vyskubov <alexey@mawhrin.net>
5 */
7 #include <stdio.h>
9 #include <string.h>
10 #include <stdlib.h>
12 #include <X11/Xlib.h> /* X Window standard header */
13 #include <X11/Xresource.h> /* X resource manager stuff */
15 #include "fookb.h"
16 #include "opts.h"
18 static int tblentr = 6; /* There are 6 recognized
19 options */
20 static XrmOptionDescRec tbl[] = {
21 {"-icon1", ".icon1",
22 XrmoptionSepArg,
23 (XPointer) NULL},
24 {"-icon2", ".icon2",
25 XrmoptionSepArg,
26 (XPointer) NULL},
27 {"-icon3", ".icon3",
28 XrmoptionSepArg,
29 (XPointer) NULL},
30 {"-icon4", ".icon4",
31 XrmoptionSepArg,
32 (XPointer) NULL},
33 {"-iconboom", ".iconBoom",
34 XrmoptionSepArg,
35 (XPointer) NULL},
36 {"-display", ".display",
37 XrmoptionSepArg,
38 (XPointer) NULL}
41 void ParseOptions(int *argc, register char *argv[])
43 XrmValue value;
44 char *str_type[20];
45 mydispname[0] = '\0';
47 XrmParseCommand(&cmdlineDB, tbl, tblentr, "fookb", argc, argv);
49 #ifdef DEBUG
50 puts("Hereiam");
51 #endif
53 if (1 != *argc) {
54 puts("Fookb v 3.0");
55 puts("\tUsage: fookb [options]");
56 puts("Possible options:");
57 puts("-icon1 xpm_file\t\tIcon to show for the 1st Xkb group");
58 puts("-icon2 xpm_file\t\tIcon to show for the 2nd Xkb group");
59 puts("-icon3 xpm_file\t\tIcon to show for the 3rd Xkb group");
60 puts("-icon4 xpm_file\t\tIcon to show for the 4th Xkb group");
61 puts("-iconboom xpm_file\tIcon to show when Xkb system goes crazy");
62 puts("-display X_display\tX display to use (normally not needed)");
63 puts("");
64 puts("Command line parameters takes precedence over X resources or configuration file!");
65 printf("Configuration file location: ");
66 #ifdef WMAKER
67 puts("~/GNUstep/Defaults/FOOkb");
68 #else
69 puts("~/.fookb");
70 #endif
71 exit(0);
74 /* We should get display now -- we need it for access to other
75 databases */
76 if (XrmGetResource(cmdlineDB, "fookb.display", "Fookb.Display",
77 str_type, &value) == True) {
78 (void) strncpy(mydispname, value.addr, (size_t)value.size);
79 #ifdef DEBUG
80 puts(mydispname);
81 #endif
86 void MoreOptions(Display *dpy)
89 XrmDatabase servDB, appDB;
91 appDB = XrmGetFileDatabase
92 ("/usr/X11R6/lib/X11/app-defaults/Fookb");
93 (void) XrmMergeDatabases(appDB, &finalDB); /* Fookb defaults file
94 added into final
95 database */
97 /* Let's look: does xrdb load server defautls? (As a property of
98 root window.) */
99 if (XResourceManagerString(dpy) != NULL) {
100 servDB = XrmGetStringDatabase(XResourceManagerString(dpy));
101 XrmMergeDatabases(servDB, &finalDB);