From acacf6d0b943d698f16a4f2b029ddcff12504802 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sat, 9 Sep 2017 21:24:23 -0400 Subject: [PATCH] fookb: Make WUtil required instead of optional. --- fookb/Makefile.am | 2 +- fookb/opts.c | 4 ---- fookb/params.c | 51 ----------------------------------------------- fookb/params.h | 5 +---- 4 files changed, 2 insertions(+), 60 deletions(-) diff --git a/fookb/Makefile.am b/fookb/Makefile.am index fcddd6a..0f0a075 100644 --- a/fookb/Makefile.am +++ b/fookb/Makefile.am @@ -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 \ diff --git a/fookb/opts.c b/fookb/opts.c index ec675e9..2143518 100644 --- a/fookb/opts.c +++ b/fookb/opts.c @@ -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); } diff --git a/fookb/params.c b/fookb/params.c index 9ce38ed..b974246 100644 --- a/fookb/params.c +++ b/fookb/params.c @@ -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 - } diff --git a/fookb/params.h b/fookb/params.h index b261f5f..5fdc73e 100644 --- a/fookb/params.h +++ b/fookb/params.h @@ -8,8 +8,7 @@ #ifndef PARAMS_H #define PARAMS_H -#ifdef HAVE_WINGS_WUTIL_H -#include +#include #ifdef WMAKER #define DEFAULTS_FILE "~/GNUstep/Defaults/FOOkb" @@ -17,8 +16,6 @@ #define DEFAULTS_FILE "~/.fookb" #endif /* WMAKER */ -#endif /* HAVE_WINGS_WUTIL_H */ - #include /* X Window standard header */ #include /* X resource manager stuff */