diff options
Diffstat (limited to 'Source/FusionDale/src/misc')
-rwxr-xr-x | Source/FusionDale/src/misc/Makefile.am | 16 | ||||
-rwxr-xr-x | Source/FusionDale/src/misc/Makefile.in | 464 | ||||
-rwxr-xr-x | Source/FusionDale/src/misc/dale_config.c | 377 | ||||
-rwxr-xr-x | Source/FusionDale/src/misc/dale_config.h | 64 |
4 files changed, 921 insertions, 0 deletions
diff --git a/Source/FusionDale/src/misc/Makefile.am b/Source/FusionDale/src/misc/Makefile.am new file mode 100755 index 0000000..72c8fbf --- /dev/null +++ b/Source/FusionDale/src/misc/Makefile.am @@ -0,0 +1,16 @@ +## Makefile.am for FusionDale/src/misc + +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + $(FUSION_CFLAGS) + +AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\" + +noinst_LTLIBRARIES = \ + libfusiondalemisc.la + +libfusiondalemisc_la_SOURCES = \ + dale_config.c \ + dale_config.h diff --git a/Source/FusionDale/src/misc/Makefile.in b/Source/FusionDale/src/misc/Makefile.in new file mode 100755 index 0000000..4b89119 --- /dev/null +++ b/Source/FusionDale/src/misc/Makefile.in @@ -0,0 +1,464 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/misc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libfusiondalemisc_la_LIBADD = +am_libfusiondalemisc_la_OBJECTS = dale_config.lo +libfusiondalemisc_la_OBJECTS = $(am_libfusiondalemisc_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libfusiondalemisc_la_SOURCES) +DIST_SOURCES = $(libfusiondalemisc_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FUSIONDALE_BINARY_AGE = @FUSIONDALE_BINARY_AGE@ +FUSIONDALE_INTERFACE_AGE = @FUSIONDALE_INTERFACE_AGE@ +FUSIONDALE_MAJOR_VERSION = @FUSIONDALE_MAJOR_VERSION@ +FUSIONDALE_MICRO_VERSION = @FUSIONDALE_MICRO_VERSION@ +FUSIONDALE_MINOR_VERSION = @FUSIONDALE_MINOR_VERSION@ +FUSIONDALE_VERSION = @FUSIONDALE_VERSION@ +FUSION_CFLAGS = @FUSION_CFLAGS@ +FUSION_LIBS = @FUSION_LIBS@ +GREP = @GREP@ +INCLUDEDIR = @INCLUDEDIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULEDIR = @MODULEDIR@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + $(FUSION_CFLAGS) + +AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\" +noinst_LTLIBRARIES = \ + libfusiondalemisc.la + +libfusiondalemisc_la_SOURCES = \ + dale_config.c \ + dale_config.h + +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 \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/misc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/misc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libfusiondalemisc.la: $(libfusiondalemisc_la_OBJECTS) $(libfusiondalemisc_la_DEPENDENCIES) + $(LINK) $(libfusiondalemisc_la_OBJECTS) $(libfusiondalemisc_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dale_config.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +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: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + 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; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + 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)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && 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'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +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 + +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-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES 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. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Source/FusionDale/src/misc/dale_config.c b/Source/FusionDale/src/misc/dale_config.c new file mode 100755 index 0000000..96c9e3d --- /dev/null +++ b/Source/FusionDale/src/misc/dale_config.c @@ -0,0 +1,377 @@ +/* + (c) Copyright 2006-2007 directfb.org + + All rights reserved. + + Written by Denis Oliver Kropp <dok@directfb.org>. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include <config.h> + +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <fusiondale.h> + +#include <direct/conf.h> +#include <direct/debug.h> +#include <direct/mem.h> +#include <direct/memcpy.h> +#include <direct/messages.h> +#include <direct/util.h> + +#include <fusion/conf.h> + +#include <coma/policy.h> + +#include "dale_config.h" + + +FusionDaleConfig *fusiondale_config = NULL; + +static const char *config_usage = + "FusionDale version " FUSIONDALE_VERSION "\n" + "\n" + " --fd-help Output FusionDale usage information and exit\n" + " --fd:<option>[,<option>]... Pass options to FusionDale (see below)\n" + "\n" + "FusionDale options:\n" + "\n" + " coma-shmpool-size=<kb> Set the maximum size of the shared memory pool created by\n" + " each component manager (once for all EnterComa with same name)\n" + " session=<num> Select multi app world (-1 = new)\n" + " remote=<host>[:<session>] Select remote session to connect to\n" + " [no-]banner Show FusionDale banner on startup\n" + "\n"; + + +static DirectResult +parse_args( const char *args ) +{ + char *buf = alloca( strlen(args) + 1 ); + + strcpy( buf, args ); + + while (buf && buf[0]) { + DirectResult ret; + char *value; + char *next; + + if ((next = strchr( buf, ',' )) != NULL) + *next++ = '\0'; + + if (strcmp (buf, "help") == 0) { + fprintf( stderr, config_usage ); + exit(1); + } + + if ((value = strchr( buf, '=' )) != NULL) + *value++ = '\0'; + + ret = fd_config_set( buf, value ); + switch (ret) { + case DR_OK: + break; + case DR_UNSUPPORTED: + D_ERROR( "FusionDale/Config: Unknown option '%s'!\n", buf ); + break; + default: + return ret; + } + + buf = next; + } + + return DR_OK; +} + +static void +config_allocate() +{ + if (fusiondale_config) + return; + + fusiondale_config = D_CALLOC( 1, sizeof(FusionDaleConfig) ); + + fusiondale_config->session = 5; // FIXME!!! + + fusiondale_config->banner = true; + fusiondale_config->coma_shmpool_size = 16 * 1024 * 1024; +} + +const char* +fd_config_usage( void ) +{ + return config_usage; +} + +DirectResult +fd_config_set( const char *name, const char *value ) +{ + if (!strcmp( name, "session" )) { + if (value) { + int session; + + if (sscanf( value, "%d", &session ) < 1) { + D_ERROR( "FusionDale/Config 'session': " + "Could not parse value!\n"); + return DR_INVARG; + } + + fusiondale_config->session = session; + } + else { + D_ERROR( "FusionDale/Config 'session': " + "No value specified!\n" ); + return DR_INVARG; + } + } + else if (strcmp (name, "remote" ) == 0) { + if (value) { + char host[128]; + int session = 0; + + if (sscanf( value, "%127s:%d", host, &session ) < 1) { + D_ERROR("FusionDale/Config 'remote': " + "Could not parse value (format is <host>[:<session>])!\n"); + return DR_INVARG; + } + + if (fusiondale_config->remote.host) + D_FREE( fusiondale_config->remote.host ); + + fusiondale_config->remote.host = D_STRDUP( host ); + fusiondale_config->remote.session = session; + } + else { + fusiondale_config->remote.host = D_STRDUP( "" ); + fusiondale_config->remote.session = 0; + } + } + else if (!strcmp( name, "coma-shmpool-size" )) { + if (value) { + int size_kb; + + if (sscanf( value, "%d", &size_kb ) < 1) { + D_ERROR( "FusionDale/Config '%s': Could not parse value!\n", name); + return DR_INVARG; + } + + fusiondale_config->coma_shmpool_size = size_kb * 1024; + } + else { + D_ERROR( "FusionDale/Config '%s': No value specified!\n", name ); + return DR_INVARG; + } + } + else if (!strcmp( name, "banner" )) { + fusiondale_config->banner = true; + } + else if (!strcmp( name, "no-banner" )) { + fusiondale_config->banner = false; + } + else if (strcmp ( name, "force-slave" ) == 0) { + fusiondale_config->force_slave = true; + } + else if (strcmp ( name, "no-force-slave" ) == 0) { + fusiondale_config->force_slave = false; + } + else if (strcmp ( name, "coma-allow" ) == 0) { + if (value) { + coma_policy_config( value, true ); + } + else { + fusiondale_config->coma_policy = true; + } + } + else if (strcmp ( name, "coma-deny" ) == 0) { + if (value) { + coma_policy_config( value, false ); + } + else { + fusiondale_config->coma_policy = false; + } + } else + if (fusion_config_set( name, value ) && direct_config_set( name, value )) + return DR_UNSUPPORTED; + + return DR_OK; +} + +static DirectResult +fd_config_read( const char *filename ) +{ + DirectResult ret = DR_OK; + char line[400]; + FILE *f; + + f = fopen( filename, "r" ); + if (!f) { + D_DEBUG( "FusionDale/Config: " + "Unable to open config file `%s'!\n", filename ); + return DR_IO; + } else { +// D_INFO( "FusionDale/Config: " +// "Parsing config file '%s'.\n", filename ); + } + + while (fgets( line, 400, f )) { + char *name = line; + char *value = strchr( line, '=' ); + + if (value) { + *value++ = 0; + direct_trim( &value ); + } + + direct_trim( &name ); + + if (!*name || *name == '#') + continue; + + ret = fd_config_set( name, value ); + if (ret) { + if (ret == DR_UNSUPPORTED) + D_ERROR( "FusionDale/Config: In config file `%s': " + "Invalid option `%s'!\n", filename, name ); + break; + } + } + + fclose( f ); + + return ret; +} + +DirectResult +fd_config_init( int *argc, char **argv[] ) +{ + DirectResult ret; + char *home = getenv( "HOME" ); + char *prog = NULL; + char *fdargs; + + if (fusiondale_config) + return DR_OK; + + config_allocate(); + + /* Read system settings. */ + ret = fd_config_read( SYSCONFDIR"/fusiondalerc" ); + if (ret && ret != DR_IO) + return ret; + + /* Read user settings. */ + if (home) { + int len = strlen(home) + sizeof("/.fusiondalerc"); + char buf[len]; + + snprintf( buf, len, "%s/.fusiondalerc", home ); + + ret = fd_config_read( buf ); + if (ret && ret != DR_IO) + return ret; + } + + /* Get application name. */ + if (argc && *argc && argv && *argv) { + prog = strrchr( (*argv)[0], '/' ); + + if (prog) + prog++; + else + prog = (*argv)[0]; + } + + /* Read global application settings. */ + if (prog && prog[0]) { + int len = sizeof(SYSCONFDIR"/fusiondalerc.") + strlen(prog); + char buf[len]; + + snprintf( buf, len, SYSCONFDIR"/fusiondalerc.%s", prog ); + + ret = fd_config_read( buf ); + if (ret && ret != DR_IO) + return ret; + } + + /* Read user application settings. */ + if (home && prog && prog[0]) { + int len = strlen(home) + sizeof("/.fusiondalerc.") + strlen(prog); + char buf[len]; + + snprintf( buf, len, "%s/.fusiondalerc.%s", home, prog ); + + ret = fd_config_read( buf ); + if (ret && ret != DR_IO) + return ret; + } + + /* Read settings from environment variable. */ + fdargs = getenv( "FDARGS" ); + if (fdargs) { + ret = parse_args( fdargs ); + if (ret) + return ret; + } + + /* Read settings from command line. */ + if (argc && argv) { + int i; + + for (i = 1; i < *argc; i++) { + + if (!strcmp( (*argv)[i], "--fd-help" )) { + fprintf( stderr, config_usage ); + exit(1); + } + + if (!strncmp( (*argv)[i], "--fd:", 5 )) { + ret = parse_args( (*argv)[i] + 5 ); + if (ret) + return ret; + + (*argv)[i] = NULL; + } + } + + for (i = 1; i < *argc; i++) { + int k; + + for (k = i; k < *argc; k++) + if ((*argv)[k] != NULL) + break; + + if (k > i) { + int j; + + k -= i; + + for (j = i + k; j < *argc; j++) + (*argv)[j-k] = (*argv)[j]; + + *argc -= k; + } + } + } + + return DR_OK; +} + diff --git a/Source/FusionDale/src/misc/dale_config.h b/Source/FusionDale/src/misc/dale_config.h new file mode 100755 index 0000000..777929e --- /dev/null +++ b/Source/FusionDale/src/misc/dale_config.h @@ -0,0 +1,64 @@ +/* + (c) Copyright 2006-2007 directfb.org + + All rights reserved. + + Written by Denis Oliver Kropp <dok@directfb.org>. + + 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., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __FD__DALE_CONFIG_H__ +#define __FD__DALE_CONFIG_H__ + +#include <fusiondale.h> + +typedef struct { + int session; /* select multi app world */ + + bool banner; /* startup banner */ + + bool force_slave; + + int coma_shmpool_size; /* Set the maximum size of the shared memory pool created by + each component manager (once for all EnterComa with same name). */ + + struct { + char *host; + int session; + } remote; + + bool coma_policy; +} FusionDaleConfig; + +extern FusionDaleConfig *fusiondale_config; + +/* + * Allocate Config struct, fill with defaults and parse command line options + * for overrides. Options identified as FusionDale options are stripped out + * of the array. + */ +DirectResult fd_config_init( int *argc, char **argv[] ); + +/* + * Set indiviual option. Used by config_init(), and FusionDaleSetOption() + */ +DirectResult fd_config_set( const char *name, const char *value ); + +const char *fd_config_usage( void ); + +#endif /* __FD__DALE_CONFIG_H__ */ + |