2 #include <string.h> /* strlen & strcat */
3 #include <ctype.h> /* toupper */
5 #include <WINGs/WUtil.h>
9 /* Let's make lint happy */
10 #define lputs(x) (void)puts(x)
12 char *read_param(char *string
)
20 /* Command line parameters take precedence over all */
22 if (!strcmp(string
, "Icon1")) {
26 result
= DEFAULT_ICON1
;
28 if (!strcmp(string
, "Icon2")) {
32 result
= DEFAULT_ICON2
;
34 if (!strcmp(string
, "Icon3")) {
38 result
= DEFAULT_ICON3
;
40 if (!strcmp(string
, "Icon4")) {
44 result
= DEFAULT_ICON4
;
46 if (!strcmp(string
, "IconBoom")) {
50 result
= DEFAULT_ICON_BOOM
;
52 if (!strcmp(string
, "Sound"))
53 result
= DEFAULT_SOUND
;
54 if (!strcmp(string
, "Command"))
55 result
= DEFAULT_COMMAND
;
58 * Here we start the game with property lists.
59 * pl will be property list, read from DEFAULTS_FILE.
60 * tmp will be temporary key for this property list,
61 * constructed using ``string'', supplied to function.
62 * value will be property list, which contain the value
66 path
= wexpandpath(DEFAULTS_FILE
);
67 pl
= WMReadPropListFromFile(path
);
74 tmp
= WMCreatePLString(string
);
75 value
= WMGetFromPLDictionary(pl
, tmp
);
76 WMReleasePropList(tmp
);
79 * pl and value objects will exist as long as fookb is running
83 lputs("Cannot find in config file value for: ");
88 if (!WMIsPLString(value
)) {
91 lputs("in config file is not a string.");
95 result
= WMGetFromPLString(value
);
98 lputs("Something wrong with libWUtils :(");
99 lputs("Please report this error to fookb author.");