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 \
|
dist_pkgdata_DATA = 1.xpm 2.xpm 3.xpm 4.xpm rus.xpm lat.xpm boom.xpm \
|
||||||
En.xpm Ru.xpm beep_spring.au
|
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)
|
LIBS += $(Xlib_LIBS) $(libXpm_LIBS) $(WUtil_LIBS)
|
||||||
|
|
||||||
EXTRA_DIST = copyright fookb.cf KNOWN_BUGS LICENSE README.russian.koi8-r \
|
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("-iconboom xpm_file\tIcon to show when Xkb system goes crazy");
|
||||||
puts("-display X_display\tX display to use (normally not needed)");
|
puts("-display X_display\tX display to use (normally not needed)");
|
||||||
puts("");
|
puts("");
|
||||||
#ifdef HAVE_WINGS_WUTIL_H
|
|
||||||
puts("Command line parameters takes precedence over X resources or configuration file!");
|
puts("Command line parameters takes precedence over X resources or configuration file!");
|
||||||
printf("Configuration file location: ");
|
printf("Configuration file location: ");
|
||||||
#ifdef WMAKER
|
#ifdef WMAKER
|
||||||
puts("~/GNUstep/Defaults/FOOkb");
|
puts("~/GNUstep/Defaults/FOOkb");
|
||||||
#else
|
#else
|
||||||
puts("~/.fookb");
|
puts("~/.fookb");
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
puts("Command line paramaters takes precedence over X resources!");
|
|
||||||
#endif
|
#endif
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,41 +12,19 @@ char *read_param(char *string)
|
||||||
{
|
{
|
||||||
XrmValue xvalue;
|
XrmValue xvalue;
|
||||||
|
|
||||||
#ifdef HAVE_WINGS_WUTIL_H
|
|
||||||
WMPropList *pl;
|
WMPropList *pl;
|
||||||
WMPropList *value;
|
WMPropList *value;
|
||||||
WMPropList *tmp;
|
WMPropList *tmp;
|
||||||
char *path;
|
char *path;
|
||||||
#endif
|
|
||||||
|
|
||||||
char *newstring;
|
char *newstring;
|
||||||
char *newString;
|
char *newString;
|
||||||
char *result;
|
char *result;
|
||||||
char *str_type[20];
|
|
||||||
|
|
||||||
/* Let's make lint happy */
|
/* Let's make lint happy */
|
||||||
xvalue.size = 0;
|
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);
|
||||||
newString = wstrconcat("Fookb.", string);
|
newString = wstrconcat("Fookb.", string);
|
||||||
#endif
|
|
||||||
newstring[6] = tolower((unsigned char)newstring[6]);
|
newstring[6] = tolower((unsigned char)newstring[6]);
|
||||||
newString[6] = toupper((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);
|
strncpy(result, xvalue.addr, (size_t)xvalue.size);
|
||||||
result[(int) xvalue.size + 1] = '\0';
|
result[(int) xvalue.size + 1] = '\0';
|
||||||
|
|
||||||
#ifdef HAVE_WINGS_WUTIL_H
|
|
||||||
wfree(newstring);
|
wfree(newstring);
|
||||||
wfree(newString);
|
wfree(newString);
|
||||||
#else
|
|
||||||
free(newstring);
|
|
||||||
free(newString);
|
|
||||||
#endif
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_WINGS_WUTIL_H
|
|
||||||
|
|
||||||
wfree(newstring);
|
wfree(newstring);
|
||||||
wfree(newString);
|
wfree(newString);
|
||||||
|
|
||||||
|
@ -130,26 +101,4 @@ char *read_param(char *string)
|
||||||
|
|
||||||
return result;
|
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
|
#ifndef PARAMS_H
|
||||||
#define PARAMS_H
|
#define PARAMS_H
|
||||||
|
|
||||||
#ifdef HAVE_WINGS_WUTIL_H
|
|
||||||
#include <WINGs/WUtil.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
#ifdef WMAKER
|
#ifdef WMAKER
|
||||||
|
@ -17,8 +16,6 @@
|
||||||
#define DEFAULTS_FILE "~/.fookb"
|
#define DEFAULTS_FILE "~/.fookb"
|
||||||
#endif /* WMAKER */
|
#endif /* WMAKER */
|
||||||
|
|
||||||
#endif /* HAVE_WINGS_WUTIL_H */
|
|
||||||
|
|
||||||
#include <X11/Xlib.h> /* X Window standard header */
|
#include <X11/Xlib.h> /* X Window standard header */
|
||||||
#include <X11/Xresource.h> /* X resource manager stuff */
|
#include <X11/Xresource.h> /* X resource manager stuff */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue