1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +00:00

implement sample config printing support

This patch makes Conky print a sample config when being called with the
'-C' flag.

A short test showed an increase of ~10kbytes of the conky binary's size.
This commit is contained in:
Phil Sutter 2008-12-12 15:33:25 +01:00
parent c84b485178
commit 7a6ce89226
4 changed files with 41 additions and 0 deletions

1
.gitignore vendored
View File

@ -27,6 +27,7 @@ src/stamp-h1
src/.deps/
src/build.h
src/config.h
src/defconfig.h
src/*.o
conky-*.tar.*
doc/*.html

View File

@ -90,6 +90,20 @@ AC_SUBST(BUILD_DATE)
AC_SUBST(BUILD_ARCH)
dnl
dnl CONFIG_OUTPUT option
dnl
AC_ARG_ENABLE([config_output],
AC_HELP_STRING([--enable-config-output],
[enable printing a default config if requested @<:@default=no@:>@]),
[want_config_output="$enableval"], [want_config_output=no])
AM_CONDITIONAL(BUILD_CONFIG_OUTPUT, test x$want_config_output = xyes)
if test x$want_config_output = xyes; then
AC_DEFINE(CONFIG_OUTPUT, 1, [Define if you want default config printing support])
fi
dnl
dnl OWN_WINDOW option
dnl

View File

@ -27,6 +27,15 @@ INCLUDES = -DSYSTEM_CONFIG_FILE=\"$(sysconfdir)/conky/conky.conf\"
bin_PROGRAMS = conky
if BUILD_CONFIG_OUTPUT
config_output = defconfig.h
conky_DEPENDENCIES = $(config_output)
BUILT_SOURCES = $(config_output)
CLEANFILES = $(config_output)
$(config_output): ../doc/conky.conf
sh ../text2c.sh $< $@ defconfig
endif
if BUILD_AUDACIOUS
audacious = audacious.c audacious.h
endif
@ -100,6 +109,7 @@ nvidia = nvidia.c nvidia.h
endif
conky_SOURCES = \
$(config_output) \
$(audacious) \
$(bmpx) \
common.c \
@ -135,6 +145,7 @@ conky_LDFLAGS = \
-lm
EXTRA_DIST = \
$(config_output) \
audacious.c \
audacious.h \
bmpx.c \

View File

@ -60,6 +60,10 @@
#include <iconv.h>
#endif
#ifdef CONFIG_OUTPUT
#include "defconfig.h"
#endif
#include "build.h"
#include "temphelper.h"
@ -9094,6 +9098,9 @@ static const char *getopt_string = "vVqdDt:u:i:hc:"
#ifdef HAVE_XDBE
"b"
#endif
#ifdef CONFIG_OUTPUT
"C"
#endif
#endif /* X11 */
;
@ -9102,6 +9109,9 @@ static const struct option longopts[] = {
{ "version", 0, NULL, 'V' },
{ "debug", 0, NULL, 'D' },
{ "config", 1, NULL, 'c' },
#ifdef CONFIG_OUTPUT
{ "print-config", 0, NULL, 'C' },
#endif
{ "daemonize", 0, NULL, 'd' },
#ifdef X11
{ "alignment", 1, NULL, 'a' },
@ -9181,6 +9191,11 @@ int main(int argc, char **argv)
case 'h':
print_help(argv[0]);
return 0;
#ifdef CONFIG_OUTPUT
case 'C':
print_defconfig();
return 0;
#endif
#ifdef X11
case 'w':
window.window = strtol(optarg, 0, 0);