diff --git a/util/setstyle.c b/util/setstyle.c index 36224f58..5eb9b14e 100644 --- a/util/setstyle.c +++ b/util/setstyle.c @@ -22,12 +22,20 @@ #define PROG_VERSION "setstyle (Window Maker) 0.6" -#include -#include +#ifdef __GLIBC__ +#define _GNU_SOURCE /* getopt_long */ +#endif + #include -#include + +#include +#include +#include +#include #include +#include #include + #include #include "../src/wconfig.h" @@ -97,6 +105,12 @@ static Bool isFontOption(char *option) return False; } +/* + * finds elements in `texture' that reference external files, + * prepends `prefix' to these files. `prefix' is a path component + * that qualifies the external references to be absolute, possibly + * pending further expansion + */ void hackPathInTexture(WMPropList * texture, char *prefix) { WMPropList *type; @@ -107,12 +121,14 @@ void hackPathInTexture(WMPropList * texture, char *prefix) t = WMGetFromPLString(type); if (t == NULL) return; - if (strcasecmp(t, "tpixmap") == 0 - || strcasecmp(t, "spixmap") == 0 - || strcasecmp(t, "mpixmap") == 0 - || strcasecmp(t, "cpixmap") == 0 - || strcasecmp(t, "tvgradient") == 0 - || strcasecmp(t, "thgradient") == 0 || strcasecmp(t, "tdgradient") == 0) { + + if (strcasecmp(t, "tpixmap") == 0 || + strcasecmp(t, "spixmap") == 0 || + strcasecmp(t, "mpixmap") == 0 || + strcasecmp(t, "cpixmap") == 0 || + strcasecmp(t, "tvgradient") == 0 || + strcasecmp(t, "thgradient") == 0 || + strcasecmp(t, "tdgradient") == 0) { WMPropList *file; char buffer[4018]; @@ -122,6 +138,7 @@ void hackPathInTexture(WMPropList * texture, char *prefix) /* replace path with full path */ WMDeleteFromPLArray(texture, 1); WMInsertInPLArray(texture, 1, WMCreatePLString(buffer)); + } else if (strcasecmp(t, "bitmap") == 0) { WMPropList *file; char buffer[4018]; @@ -334,16 +351,19 @@ void hackStyle(WMPropList * style) } } -void print_help() +void print_help(int print_usage, int exitval) { printf("Usage: %s [OPTIONS] FILE\n", __progname); - puts("Reads style/theme configuration from FILE and updates Window Maker."); - puts(""); - puts(" --no-fonts ignore font related options"); - puts(" --no-cursors ignore cursor related options"); - puts(" --ignore