diff options
| author | Michael Biebl <biebl@debian.org> | 2013-02-09 03:16:54 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2013-02-09 03:16:54 +0100 |
| commit | e17c5736fc3722ce51cb33f3edb203960125a4c1 (patch) | |
| tree | 2b41ee92b307915e9d97f0ef2c012fc793653599 /tools | |
| parent | 9c202e3e860b3be9e1f8882630b69affbb130102 (diff) | |
Imported Upstream version 0.9.7.997 upstream/0.9.7.997
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/Makefile.am | 30 | ||||
| -rw-r--r-- | tools/Makefile.in | 233 | ||||
| -rw-r--r-- | tools/generate-settings-spec.c | 434 | ||||
| -rw-r--r-- | tools/manpages-docbook.xsl | 5 |
4 files changed, 666 insertions, 36 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index dbbe18c6..38d861ec 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1 +1,29 @@ -EXTRA_DIST = doc-generator.xsl check-exports.sh glib-mkenums +GENERATE_SETTINGS_SPEC_SOURCE = generate-settings-spec.c + +INCLUDES = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util + +noinst_PROGRAMS = \ + generate-settings-spec + +generate_settings_spec_SOURCES = \ + $(GENERATE_SETTINGS_SPEC_SOURCE) + +generate_settings_spec_CPPFLAGS = \ + $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) + +generate_settings_spec_LDADD = \ + $(top_builddir)/libnm-util/libnm-util.la \ + $(GLIB_LIBS) \ + $(DBUS_LIBS) + +EXTRA_DIST = \ + doc-generator.xsl \ + manpages-docbook.xsl \ + check-exports.sh \ + glib-mkenums \ + $(GENERATE_SETTINGS_SPEC_SOURCE) diff --git a/tools/Makefile.in b/tools/Makefile.in index 8f460e49..23d33f28 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -14,6 +14,7 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + VPATH = @srcdir@ am__make_dryrun = \ { \ @@ -50,6 +51,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +noinst_PROGRAMS = generate-settings-spec$(EXEEXT) subdir = tools DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -60,31 +62,64 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/vapigen.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +PROGRAMS = $(noinst_PROGRAMS) +am__objects_1 = \ + generate_settings_spec-generate-settings-spec.$(OBJEXT) +am_generate_settings_spec_OBJECTS = $(am__objects_1) +generate_settings_spec_OBJECTS = $(am_generate_settings_spec_OBJECTS) +am__DEPENDENCIES_1 = +generate_settings_spec_DEPENDENCIES = \ + $(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ -SOURCES = -DIST_SOURCES = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(generate_settings_spec_SOURCES) +DIST_SOURCES = $(generate_settings_spec_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +ETAGS = etags +CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALL_LINGUAS = @ALL_LINGUAS@ @@ -184,12 +219,6 @@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBM = @LIBM@ -LIBNL1_CFLAGS = @LIBNL1_CFLAGS@ -LIBNL1_LIBS = @LIBNL1_LIBS@ -LIBNL2_CFLAGS = @LIBNL2_CFLAGS@ -LIBNL2_LIBS = @LIBNL2_LIBS@ -LIBNL3_CFLAGS = @LIBNL3_CFLAGS@ -LIBNL3_LIBS = @LIBNL3_LIBS@ LIBNL_CFLAGS = @LIBNL_CFLAGS@ LIBNL_LIBS = @LIBNL_LIBS@ LIBOBJS = @LIBOBJS@ @@ -329,10 +358,36 @@ with_dhclient = @with_dhclient@ with_dhcpcd = @with_dhcpcd@ with_netconfig = @with_netconfig@ with_resolvconf = @with_resolvconf@ -EXTRA_DIST = doc-generator.xsl check-exports.sh glib-mkenums +GENERATE_SETTINGS_SPEC_SOURCE = generate-settings-spec.c +INCLUDES = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/libnm-util \ + -I$(top_builddir)/libnm-util + +generate_settings_spec_SOURCES = \ + $(GENERATE_SETTINGS_SPEC_SOURCE) + +generate_settings_spec_CPPFLAGS = \ + $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) + +generate_settings_spec_LDADD = \ + $(top_builddir)/libnm-util/libnm-util.la \ + $(GLIB_LIBS) \ + $(DBUS_LIBS) + +EXTRA_DIST = \ + doc-generator.xsl \ + manpages-docbook.xsl \ + check-exports.sh \ + glib-mkenums \ + $(GENERATE_SETTINGS_SPEC_SOURCE) + all: all-am .SUFFIXES: +.SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -364,17 +419,118 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +generate-settings-spec$(EXEEXT): $(generate_settings_spec_OBJECTS) $(generate_settings_spec_DEPENDENCIES) $(EXTRA_generate_settings_spec_DEPENDENCIES) + @rm -f generate-settings-spec$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(generate_settings_spec_OBJECTS) $(generate_settings_spec_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate_settings_spec-generate-settings-spec.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +generate_settings_spec-generate-settings-spec.o: generate-settings-spec.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(generate_settings_spec_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT generate_settings_spec-generate-settings-spec.o -MD -MP -MF $(DEPDIR)/generate_settings_spec-generate-settings-spec.Tpo -c -o generate_settings_spec-generate-settings-spec.o `test -f 'generate-settings-spec.c' || echo '$(srcdir)/'`generate-settings-spec.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/generate_settings_spec-generate-settings-spec.Tpo $(DEPDIR)/generate_settings_spec-generate-settings-spec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='generate-settings-spec.c' object='generate_settings_spec-generate-settings-spec.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(generate_settings_spec_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o generate_settings_spec-generate-settings-spec.o `test -f 'generate-settings-spec.c' || echo '$(srcdir)/'`generate-settings-spec.c + +generate_settings_spec-generate-settings-spec.obj: generate-settings-spec.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(generate_settings_spec_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT generate_settings_spec-generate-settings-spec.obj -MD -MP -MF $(DEPDIR)/generate_settings_spec-generate-settings-spec.Tpo -c -o generate_settings_spec-generate-settings-spec.obj `if test -f 'generate-settings-spec.c'; then $(CYGPATH_W) 'generate-settings-spec.c'; else $(CYGPATH_W) '$(srcdir)/generate-settings-spec.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/generate_settings_spec-generate-settings-spec.Tpo $(DEPDIR)/generate_settings_spec-generate-settings-spec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='generate-settings-spec.c' object='generate_settings_spec-generate-settings-spec.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(generate_settings_spec_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o generate_settings_spec-generate-settings-spec.obj `if test -f 'generate-settings-spec.c'; then $(CYGPATH_W) 'generate-settings-spec.c'; else $(CYGPATH_W) '$(srcdir)/generate-settings-spec.c'; fi` + mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique tags: TAGS -TAGS: +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi ctags: CTAGS -CTAGS: - +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -408,7 +564,7 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile +all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am @@ -442,11 +598,14 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool mostlyclean-am +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am distclean: distclean-am + -rm -rf ./$(DEPDIR) -rm -f Makefile -distclean-am: clean-am distclean-generic +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags dvi: dvi-am @@ -489,12 +648,14 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am -mostlyclean-am: mostlyclean-generic mostlyclean-libtool +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf: pdf-am @@ -508,16 +669,18 @@ uninstall-am: .MAKE: install-am install-strip -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/tools/generate-settings-spec.c b/tools/generate-settings-spec.c new file mode 100644 index 00000000..5281dcbf --- /dev/null +++ b/tools/generate-settings-spec.c @@ -0,0 +1,434 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * Dan Williams <dcbw@redhat.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * (C) Copyright 2009 - 2013 Red Hat, Inc. + */ + +#include <stdio.h> +#include <errno.h> +#include <unistd.h> +#include <string.h> +#include <time.h> + +#include <glib.h> +#include <dbus/dbus-glib.h> +#include "config.h" + +#include <nm-setting-8021x.h> +#include <nm-setting-adsl.h> +#include <nm-setting-bluetooth.h> +#include <nm-setting-cdma.h> +#include <nm-setting-connection.h> +#include <nm-setting-gsm.h> +#include <nm-setting.h> +#include <nm-setting-ip4-config.h> +#include <nm-setting-ip6-config.h> +#include <nm-setting-olpc-mesh.h> +#include <nm-setting-ppp.h> +#include <nm-setting-pppoe.h> +#include <nm-setting-serial.h> +#include <nm-setting-vpn.h> +#include <nm-setting-wimax.h> +#include <nm-setting-wired.h> +#include <nm-setting-wireless.h> +#include <nm-setting-wireless-security.h> +#include <nm-setting-infiniband.h> +#include <nm-setting-bond.h> +#include <nm-setting-bridge.h> +#include <nm-setting-bridge-port.h> +#include <nm-setting-vlan.h> + +#include <nm-utils.h> + +typedef NMSetting* (*SettingNewFunc) (void); + +static SettingNewFunc funcs[] = { + nm_setting_802_1x_new, + nm_setting_adsl_new, + nm_setting_bluetooth_new, + nm_setting_bond_new, + nm_setting_bridge_new, + nm_setting_bridge_port_new, + nm_setting_cdma_new, + nm_setting_connection_new, + nm_setting_gsm_new, + nm_setting_infiniband_new, + nm_setting_ip4_config_new, + nm_setting_ip6_config_new, + nm_setting_olpc_mesh_new, + nm_setting_ppp_new, + nm_setting_pppoe_new, + nm_setting_serial_new, + nm_setting_vlan_new, + nm_setting_vpn_new, + nm_setting_wimax_new, + nm_setting_wired_new, + nm_setting_wireless_new, + nm_setting_wireless_security_new, + NULL +}; + +typedef struct { + const char *gvalue_name; + const char *new_name; +} TypeNameElement; + +static TypeNameElement name_map[] = { + { "gchararray", "string" }, + { "GSList_gchararray_", "array of string" }, + { "GArray_guchar_", "byte array" }, + { "gboolean", "boolean" }, + { "guint64", "uint64" }, + { "gint", "int32" }, + { "guint", "uint32" }, + { "GArray_guint_", "array of uint32" }, + { "GPtrArray_GArray_guint__", "array of array of uint32" }, + { "GPtrArray_GArray_guchar__", "array of byte array" }, + { "GPtrArray_gchararray_", "array of string" }, + { "GHashTable_gchararray+gchararray_", "dict of (string::string)" }, + { "GPtrArray_GValueArray_GArray_guchar_+guint+GArray_guchar___", "array of (byte array, uint32, byte array)" }, + { "GPtrArray_GValueArray_GArray_guchar_+guint+GArray_guchar_+guint__", "array of (byte array, uint32, byte array, uint32)" }, + { NULL, NULL } +}; + +static void +write_one_setting (FILE *f, gboolean book, SettingNewFunc func) +{ + NMSetting *s; + GParamSpec **props, **iter; + guint num; + const char *row_fmt_str; + + s = func (); + + /* write out section header */ + (void) fprintf (f, + "<table>\n" + " <title>%s setting</title>\n" + " <tgroup cols=\"4\">\n" + " <thead>\n" + " <row>\n" + " <entry>Key Name</entry>\n" + " <entry>Value Type</entry>\n" + " <entry>Default Value</entry>\n" + " <entry>Value Description</entry>\n" + " </row>\n" + " </thead>\n" + " <tbody>\n", + nm_setting_get_name (s)); + + props = g_object_class_list_properties (G_OBJECT_GET_CLASS (G_OBJECT (s)), &num); + for (iter = props; iter && *iter; iter++) { + const char *key_name, *value_type, *value_desc; + char *default_value; + TypeNameElement *name_iter; + GValue value = { 0, }; + char *flags_str = NULL; + + value_type = g_type_name (G_PARAM_SPEC_VALUE_TYPE (*iter)); + for (name_iter = &name_map[0]; name_iter && name_iter->gvalue_name; name_iter++) { + if (!strcmp (value_type, name_iter->gvalue_name)) { + value_type = name_iter->new_name; + break; + } + } + + key_name = g_param_spec_get_name (*iter); + value_desc = g_param_spec_get_blurb (*iter); + + g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (*iter)); + g_param_value_set_default (*iter, &value); + default_value = g_strdup_value_contents (&value); + if (default_value && !strcmp (default_value, "NULL")) { + g_free (default_value); + default_value = NULL; + } + + if (!strcmp (key_name, NM_SETTING_NAME)) { + g_free (default_value); + default_value = NULL; + g_object_get (G_OBJECT (s), NM_SETTING_NAME, &default_value, NULL); + } + + if (g_str_has_suffix (key_name, "-flags")) + flags_str = g_strdup_printf (" (see <xref linkend=\"secrets-flags\"/> for flag values)"); + + if (book) + row_fmt_str = + " <row>\n" + " <entry><screen>%s</screen></entry>\n" + " <entry><screen>%s</screen></entry>\n" + " <entry><screen>%s</screen></entry>\n" + " <entry>%s%s</entry>\n" + " </row>\n"; + else + row_fmt_str = + " <row>\n" + " <entry align=\"left\">%s</entry>\n" + " <entry align=\"left\">%s</entry>\n" + " <entry align=\"left\">%s</entry>\n" + " <entry>%s%s</entry>\n" + " </row>\n"; + + (void) fprintf (f, row_fmt_str, + key_name, + value_type, + default_value ? default_value : "", + value_desc, + flags_str ? flags_str : ""); + + g_free (flags_str); + g_free (default_value); + } + + (void) fprintf (f, + " </tbody>\n" + " </tgroup>\n" + "</table>\n"); + + g_object_unref (s); +} + +static void +writer_header_docbook_section (FILE *f) +{ + (void) fprintf (f, + "<?xml version=\"1.0\"?>\n" + "<!DOCTYPE section PUBLIC \"-//OASIS//DTD DocBook XML V4.3//EN\"\n" + " \"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd\" [\n" + "<!ENTITY %% local.common.attrib \"xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'\">" + "]>" + "<section>\n" + " <title>Configuration Settings</title>\n" + " <para>\n"); +} + +static void +writer_footer_docbook_section (FILE *f) +{ + (void) fprintf (f, + " </para>\n" + "</section>\n"); +} + +static void +writer_header_docbook_manpage (FILE *f) +{ + char time_str[64]; + time_t t; + + t = time (NULL); + strftime (time_str, sizeof (time_str), "%d %B %Y", localtime (&t)); + + (void) fprintf (f, + "<?xml version=\"1.0\"?>\n" + "<!DOCTYPE refentry PUBLIC \"-//OASIS//DTD DocBook XML V4.3//EN\"\n" + " \"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd\" [\n" + "<!ENTITY %% local.common.attrib \"xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'\">" + "]>" + "<refentry id=\"nm-settings\">\n" + " <refentryinfo>\n" + " <date>%s</date>\n" + " </refentryinfo>\n" + " <refmeta>\n" + " <refentrytitle>nm-settings</refentrytitle>\n" + " <manvolnum>5</manvolnum>\n" + " <refmiscinfo class=\"source\">NetworkManager</refmiscinfo>\n" + " <refmiscinfo class=\"manual\">Configuration</refmiscinfo>\n" + " <refmiscinfo class=\"version\">%s</refmiscinfo>\n" + " </refmeta>\n" + " <refnamediv>\n" + " <refname>nm-settings</refname>\n" + " <refpurpose>Description of settings and parameters of NetworkManager connections.</refpurpose>\n" + " </refnamediv>\n" + " <refsect1>\n" + " <title>DESCRIPTION</title>\n" + " <para>\n" + " NetworkManager is based on a concept of connections. These connections are\n" + " then applied to a device to make an active network connection. Users can create\n" + " as many connections as they see fit. The connections are handled by NetworkManager\n" + " via <emphasis>settings service</emphasis> and are exported on D-Bus \n" + " (<emphasis>/org/freedesktop/NetworkManager/Settings/<num></emphasis> objects).\n" + " The conceptual objects can be described as follows:\n" + " <variablelist>\n" + " <varlistentry>\n" + " <term>Connection</term>\n" + " <listitem>\n" + " <para>\n" + " A specific, encapsulated, independent group of settings describing\n" + " all the configuration required to connect to a specific network.\n" + " It is referred to by a unique identifier called the UUID. A connection\n" + " is tied to a one specific device type, but not necessarily a specific\n" + " hardware device. It is composed of one or more <emphasis>Settings</emphasis>\n" + " objects.\n" + " </para>\n" + " </listitem>\n" + " </varlistentry>\n" + " </variablelist>\n" + " <variablelist>\n" + " <varlistentry>\n" + " <term>Setting</term>\n" + " <listitem>\n" + " <para>\n" + " A group of related key/value pairs describing a specific piece of a\n" + " <emphasis>Connection</emphasis>. Settings keys and allowed values are\n" + " described in the tables below. Developers can find the settings\n" + " objects in the libnm-util sources. Look for the <function>class_init</function>\n" + " functions near the bottoms of each setting source file.\n" + " </para>\n" + " </listitem>\n" + " </varlistentry>\n" + " </variablelist>\n", + time_str, VERSION); +} + +static void +writer_footer_docbook_manpage (FILE *f) +{ + (void) fprintf (f, + " </para>\n" + " <refsect2 id=\"secrets-flags\">\n" + " <title>Secret flag types:</title>\n" + " <para>\n" + " Each secret property in a setting has an associated <emphasis>flags</emphasis> property\n" + " that describes how to handle that secret. The <emphasis>flags</emphasis> property is a bitfield\n" + " that contains zero or more of the following values logically OR-ed together.\n" + " </para>\n" + " <itemizedlist>\n" + " <listitem>\n" + " <para>0x0 (none) - the system is responsible for providing and storing this secret.</para>\n" + " </listitem>\n" + " <listitem>\n" + " <para>0x1 (agent-owned) - a user-session secret agent is responsible for providing and storing\n" + " this secret; when it is required, agents will be asked to provide it.</para>\n" + " </listitem>\n" + " <listitem>\n" + " <para>0x2 (not-saved) - this secret should not be saved but should be requested from the user\n" + " each time it is required. This flag should be used for One-Time-Pad secrets, PIN codes from hardware tokens,\n" + " or if the user simply does not want to save the secret.</para>\n" + " </listitem>\n" + " <listitem>\n" + " <para>0x4 (not-required) - in some situations it cannot be automatically determined that a secret\n" + " is required or not. This flag hints that the secret is not required and should not be requested from the user.</para>\n" + " </listitem>\n" + " </itemizedlist>\n" + " </refsect2>\n" + " </refsect1>\n" + " <refsect1>\n" + " <title>AUTHOR</title>\n" + " <para>\n" + " <author>\n" + " <firstname>NetworkManager developers</firstname>\n" + " </author>\n" + " </para>\n" + " </refsect1>\n" + " <refsect1>\n" + " <title>FILES</title>\n" + " <para>/etc/NetworkManager/system-connections</para>\n" + " <para>or distro plugin-specific location</para>\n" + " </refsect1>\n" + " <refsect1>\n" + " <title>SEE ALSO</title>\n" + " <para>https://live.gnome.org/NetworkManagerConfiguration</para>\n" + " <para>NetworkManager(8), nmcli(1), NetworkManager.conf(5)</para>\n" + " </refsect1>\n" + "</refentry>\n"); +} + +static void +usage (const char *str) +{ + fprintf (stderr, "Usage: %s <type> <output file> [<type> <output file>]\n" + "<type> := book|refentry\n", + str); + _exit (1); +} + +int +main (int argc, char *argv[]) +{ + GError *error = NULL; + FILE *f1 = NULL, *f2 = NULL; + SettingNewFunc *fptr; + const char *book_file = NULL, *refentry_file = NULL;; + + if (argc != 3 && argc != 5) + usage (argv[0]); + + if (strcmp (argv[1], "book") == 0) + book_file = argv[2]; + else if (strcmp (argv[1], "refentry") == 0) + refentry_file = argv[2]; + else + usage (argv[0]); + + if (argc == 5) { + if (strcmp (argv[3], "book") == 0 && !book_file) + book_file = argv[4]; + else if (strcmp (argv[3], "refentry") == 0 && !refentry_file) + refentry_file = argv[4]; + else + usage (argv[0]); + } + + g_type_init (); + + if (!nm_utils_init (&error)) { + fprintf (stderr, "ERR: failed to initialize libnm-util: %s", error->message); + _exit (2); + } + + if (book_file) { + f1 = fopen (book_file, "w"); + if (!f1) { + fprintf (stderr, "ERR: could not create %s: %d\n", book_file, errno); + _exit (3); + } + } + if (refentry_file) { + f2 = fopen (refentry_file, "w"); + if (!f2) { + fprintf (stderr, "ERR: could not create %s: %d\n", refentry_file, errno); + _exit (3); + } + } + + /* Write out docbook 'book' xml - for html generation */ + if (f1) { + writer_header_docbook_section (f1); + for (fptr = funcs; fptr && *fptr; fptr++) + write_one_setting (f1, TRUE, *fptr); + writer_footer_docbook_section (f1); + } + + /* Write out docbook 'refentry' xml - for man page generation */ + if (f2) { + writer_header_docbook_manpage (f2); + for (fptr = funcs; fptr && *fptr; fptr++) + write_one_setting (f2, FALSE, *fptr); + writer_footer_docbook_manpage (f2); + } + + if (f1) + fclose (f1); + if (f2) + fclose (f2); + _exit (0); +} + diff --git a/tools/manpages-docbook.xsl b/tools/manpages-docbook.xsl new file mode 100644 index 00000000..15e87a0f --- /dev/null +++ b/tools/manpages-docbook.xsl @@ -0,0 +1,5 @@ +<?xml version='1.0'?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> +<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/> +</xsl:stylesheet> |