fookb: Make WUtil required instead of optional.
This commit is contained in:
parent
9a66c7d460
commit
acacf6d0b9
|
@ -5,7 +5,7 @@ dist_man_MANS = fookb.1x
|
|||
dist_pkgdata_DATA = 1.xpm 2.xpm 3.xpm 4.xpm rus.xpm lat.xpm boom.xpm \
|
||||
En.xpm Ru.xpm beep_spring.au
|
||||
|
||||
AM_CFLAGS = $(Xlib_CFLAGS) $(libXpm_CFLAGS) $(WUtil_CFLAGS) -DHAVE_WINGS_WUTIL_H
|
||||
AM_CFLAGS = $(Xlib_CFLAGS) $(libXpm_CFLAGS) $(WUtil_CFLAGS)
|
||||
LIBS += $(Xlib_LIBS) $(libXpm_LIBS) $(WUtil_LIBS)
|
||||
|
||||
EXTRA_DIST = copyright fookb.cf KNOWN_BUGS LICENSE README.russian.koi8-r \
|
||||
|
|
|
@ -61,16 +61,12 @@ void ParseOptions(int *argc, register char *argv[])
|
|||
puts("-iconboom xpm_file\tIcon to show when Xkb system goes crazy");
|
||||
puts("-display X_display\tX display to use (normally not needed)");
|
||||
puts("");
|
||||
#ifdef HAVE_WINGS_WUTIL_H
|
||||
puts("Command line parameters takes precedence over X resources or configuration file!");
|
||||
printf("Configuration file location: ");
|
||||
#ifdef WMAKER
|
||||
puts("~/GNUstep/Defaults/FOOkb");
|
||||
#else
|
||||
puts("~/.fookb");
|
||||
#endif
|
||||
#else
|
||||
puts("Command line paramaters takes precedence over X resources!");
|
||||
#endif
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -12,41 +12,19 @@ char *read_param(char *string)
|
|||
{
|
||||
XrmValue xvalue;
|
||||
|
||||
#ifdef HAVE_WINGS_WUTIL_H
|
||||
WMPropList *pl;
|
||||
WMPropList *value;
|
||||
WMPropList *tmp;
|
||||
char *path;
|
||||
#endif
|
||||
|
||||
char *newstring;
|
||||
char *newString;
|
||||
char *result;
|
||||
char *str_type[20];
|
||||
|
||||
/* Let's make lint happy */
|
||||
xvalue.size = 0;
|
||||
|
||||
#ifndef HAVE_WINGS_WUTIL_H
|
||||
newstring = (char *) malloc(7 + strlen(string));
|
||||
newString = (char *) malloc(7 + strlen(string));
|
||||
/* 7 is strlen("fookb.") + 1 */
|
||||
|
||||
if ((NULL == newstring) || (NULL == newString)) {
|
||||
lputs("Not enough memory");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
strcpy(newstring, "fookb.");
|
||||
strcpy(newString, "Fookb.");
|
||||
|
||||
strcat(newstring, string);
|
||||
strcat(newString, string);
|
||||
#else
|
||||
/* libWUtil contains handy function */
|
||||
newstring = wstrconcat("fookb.", string);
|
||||
newString = wstrconcat("Fookb.", string);
|
||||
#endif
|
||||
newstring[6] = tolower((unsigned char)newstring[6]);
|
||||
newString[6] = toupper((unsigned char)newString[6]);
|
||||
|
||||
|
@ -65,18 +43,11 @@ char *read_param(char *string)
|
|||
strncpy(result, xvalue.addr, (size_t)xvalue.size);
|
||||
result[(int) xvalue.size + 1] = '\0';
|
||||
|
||||
#ifdef HAVE_WINGS_WUTIL_H
|
||||
wfree(newstring);
|
||||
wfree(newString);
|
||||
#else
|
||||
free(newstring);
|
||||
free(newString);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WINGS_WUTIL_H
|
||||
|
||||
wfree(newstring);
|
||||
wfree(newString);
|
||||
|
||||
|
@ -130,26 +101,4 @@ char *read_param(char *string)
|
|||
|
||||
return result;
|
||||
|
||||
#else /* HAVE_WINGS_WUTIL_H */
|
||||
|
||||
if (XrmGetResource(finalDB, newstring, newString, str_type,
|
||||
&xvalue) == True) {
|
||||
result = (char *) malloc(xvalue.size + 1);
|
||||
if (NULL == result) {
|
||||
lputs("Not enough memory");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
strncpy(result, xvalue.addr, (size_t)xvalue.size);
|
||||
result[(int) xvalue.size + 1] = '\0';
|
||||
free(newstring);
|
||||
free(newString);
|
||||
return result;
|
||||
} else {
|
||||
(void)printf("Fatal error: cannot find configuration parameter %s\n",
|
||||
newstring);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#ifndef PARAMS_H
|
||||
#define PARAMS_H
|
||||
|
||||
#ifdef HAVE_WINGS_WUTIL_H
|
||||
#include <WINGs/WUtil.h>
|
||||
|
||||
#ifdef WMAKER
|
||||
|
@ -17,8 +16,6 @@
|
|||
#define DEFAULTS_FILE "~/.fookb"
|
||||
#endif /* WMAKER */
|
||||
|
||||
#endif /* HAVE_WINGS_WUTIL_H */
|
||||
|
||||
#include <X11/Xlib.h> /* X Window standard header */
|
||||
#include <X11/Xresource.h> /* X resource manager stuff */
|
||||
|
||||
|
|
Loading…
Reference in a new issue