From 7dc767ae78034345dc6ca0bf9a2e67c85438d24e Mon Sep 17 00:00:00 2001 From: Tamas TEVESZ Date: Thu, 1 Apr 2010 03:30:05 +0200 Subject: [PATCH] Convert to getopt, continued plus some assorted fixes: - sort headers, remove some unneeded ones - small bits of formatting and the like --- util/getstyle.c | 16 ++++++----- util/seticons.c | 6 ++-- util/wdread.c | 87 ++++++++++++++++++++++++++++++++++----------------------- util/wdwrite.c | 87 +++++++++++++++++++++++++++++++++------------------------ 4 files changed, 115 insertions(+), 81 deletions(-) diff --git a/util/getstyle.c b/util/getstyle.c index ab3a1be7..40659409 100644 --- a/util/getstyle.c +++ b/util/getstyle.c @@ -29,7 +29,6 @@ #include #include -#include #include #include #include @@ -286,12 +285,14 @@ void makeThemePack(WMPropList * style, char *themeName) if (t == NULL) continue; - if (strcasecmp(t, "tpixmap") == 0 - || strcasecmp(t, "spixmap") == 0 - || strcasecmp(t, "cpixmap") == 0 - || strcasecmp(t, "mpixmap") == 0 - || strcasecmp(t, "tdgradient") == 0 - || strcasecmp(t, "tvgradient") == 0 || strcasecmp(t, "thgradient") == 0) { + if (strcasecmp(t, "tpixmap") == 0 || + strcasecmp(t, "spixmap") == 0 || + strcasecmp(t, "cpixmap") == 0 || + strcasecmp(t, "mpixmap") == 0 || + strcasecmp(t, "tdgradient") == 0 || + strcasecmp(t, "tvgradient") == 0 || + strcasecmp(t, "thgradient") == 0) { + WMPropList *file; char *p; char *newPath; @@ -310,6 +311,7 @@ void makeThemePack(WMPropList * style, char *themeName) findCopyFile(themeDir, WMGetFromPLString(file)); } } else if (strcasecmp(t, "bitmap") == 0) { + WMPropList *file; char *p; char *newPath; diff --git a/util/seticons.c b/util/seticons.c index ffd38f4a..84ea7317 100644 --- a/util/seticons.c +++ b/util/seticons.c @@ -89,13 +89,13 @@ int main(int argc, char **argv) all_windows = WMReadPropListFromFile(path); if (!all_windows) { printf("%s: could not load WindowMaker configuration file \"%s\".\n", __progname, path); - exit(1); + return 1; } iconset = WMReadPropListFromFile(argv[0]); if (!iconset) { printf("%s: could not load icon set file \"%s\".\n", __progname, argv[0]); - exit(1); + return 1; } keylist = WMGetPLDictionaryKeys(iconset); @@ -122,5 +122,5 @@ int main(int argc, char **argv) WMWritePropListToFile(all_windows, path); - exit(0); + return 0; } diff --git a/util/wdread.c b/util/wdread.c index a72fb22e..b60fe076 100644 --- a/util/wdread.c +++ b/util/wdread.c @@ -23,66 +23,83 @@ #define PROG_VERSION "wdread (Window Maker) 0.2" +#ifdef __GLIBC__ +#define _GNU_SOURCE /* getopt_long */ +#endif + /* * WindowMaker defaults DB reader */ -#include "../src/wconfig.h" - +#include +#include +#include #include #include -#include #include #include -#include +#include "../src/wconfig.h" extern char *__progname; -void wAbort() -{ - exit(0); -} - -void print_help() +void print_help(int print_usage, int exitval) { - printf("Usage: %s [OPTIONS]