Check-in [80d18a8d82]
Overview
Comment:Win32 support fixed. Added a new man page (lc_cleanup)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:80d18a8d82e7ff601f9bc170b2b5b476523aadb6
User & Date: rkeene on 2004-12-18 10:05:59
Other Links: manifest | tags
Context
2004-12-18
10:46
Win32 fixes. libconfig 0.1.8 check-in: 5baa5c16a6 user: rkeene tags: trunk, 0.1.8
10:05
Win32 support fixed. Added a new man page (lc_cleanup) check-in: 80d18a8d82 user: rkeene tags: trunk
2004-12-03
12:22
Added an AUTHORS file. check-in: a3f979b75d user: rkeene tags: trunk
Changes

Modified Makefile.in from [452002dfb3] to [6d7f8667ba].

    52     52   	cat $? | $(CPP) $(CPPFLAGS) - | grep -v '^#' | grep -v '^ *$$' | sed 's/^!/#  /g;s/__BLANK_LINE__//' > $@
    53     53   
    54     54   test-lc: $(LIBS) test-lc.c
    55     55   	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(filter %.c, $?) $(LDFLAGS) -Wl,-R -Wl,. -L. -lconfig
    56     56   
    57     57   .PHONY: clean distclean install
    58     58   clean:
    59         -	rm -f *.o $(BINS) $(LIBS) libconfig.h *~ test-lc
           59  +	rm -f *.o $(BINS) $(LIBS) libconfig.h *~ test-lc *.dll.a *.dll.def *.dll
    60     60   distclean: clean
    61     61   	rm -f Makefile config.h config.status config.log lc_geterrno.3 lc_process.3 lc_cleanup.3 lc_process_file.3 lc_register_var.3 lc_geterrstr.3 lc_register_callback.3 libconfig.3
    62     62   
    63     63   
    64     64   install: all libconfig.h
    65     65   	-$(INSTALL) -d $(mandir)
    66     66   	-$(INSTALL) -d $(mandir)/man3

Added build/build_win32.sh version [295d16231e].

            1  +#! /bin/sh
            2  +
            3  +if [ ! -x configure ]; then cd ../; fi
            4  +WIN32="${HOME}/root/windows-i386"
            5  +CFLAGS="-I${WIN32}/include"
            6  +CPPFLAGS="${CFLAGS}"
            7  +LDFLAGS="-L${WIN32}/lib"
            8  +DATE="`date +%Y%m%d%H%M`"
            9  +CROSS=i586-mingw32msvc
           10  +if [ ! -z "${CROSS}" ]; then
           11  +	CROSSCMD="${CROSS}-"
           12  +fi
           13  +export CFLAGS LDFLAGS CPPFLAGS
           14  +make distclean
           15  +./configure --host=${CROSS} && \
           16  +make || exit 1

Modified compat.h from [cd6e5c8c4f] to [e7ac67c392].

     8      8   #include "win32.h"
     9      9   #endif
    10     10   
    11     11   #ifndef LC_LINEBUF_LEN
    12     12   #define LC_LINEBUF_LEN 1024
    13     13   #endif
    14     14   
           15  +#ifndef HAVE_GETUID
           16  +#include "getuid.h"
           17  +#endif
    15     18   #ifndef HAVE_STRTOLL
    16     19   #include "strtoll.h"
    17     20   #endif
    18     21   #ifndef HAVE_STRSEP
    19     22   #include "strsep.h"
    20     23   #endif
    21     24   #ifdef HAVE_INTTYPES_H

Modified config.h.in from [093c4e8a7f] to [105e0ec8a5].

     4      4   #undef HAVE_CTYPE_H
     5      5   
     6      6   /* Define to 1 if you have the <dirent.h> header file. */
     7      7   #undef HAVE_DIRENT_H
     8      8   
     9      9   /* Define to 1 if you have the `getpwuid' function. */
    10     10   #undef HAVE_GETPWUID
           11  +
           12  +/* Define to 1 if you have the `getuid' function. */
           13  +#undef HAVE_GETUID
    11     14   
    12     15   /* Define to 1 if you have the <inttypes.h> header file. */
    13     16   #undef HAVE_INTTYPES_H
    14     17   
    15     18   /* Define to 1 if you have fopen_net from libopennet */
    16     19   #undef HAVE_LIBOPENNET
    17     20   

Modified configure from [2dd96896d3] to [2142567030].

     1      1   #! /bin/sh
     2      2   # From configure.ac Revision .
     3      3   # Guess values for system-dependent variables and create Makefiles.
     4         -# Generated by GNU Autoconf 2.59 for libconfig 0.1.6.
            4  +# Generated by GNU Autoconf 2.59 for libconfig 0.1.7.
     5      5   #
     6      6   # Copyright (C) 2003 Free Software Foundation, Inc.
     7      7   # This configure script is free software; the Free Software Foundation
     8      8   # gives unlimited permission to copy, distribute and modify it.
     9      9   ## --------------------- ##
    10     10   ## M4sh Initialization.  ##
    11     11   ## --------------------- ##
................................................................................
   264    264   # This variable seems obsolete.  It should probably be removed, and
   265    265   # only ac_max_sed_lines should be used.
   266    266   : ${ac_max_here_lines=38}
   267    267   
   268    268   # Identity of this package.
   269    269   PACKAGE_NAME='libconfig'
   270    270   PACKAGE_TARNAME='libconfig'
   271         -PACKAGE_VERSION='0.1.6'
   272         -PACKAGE_STRING='libconfig 0.1.6'
          271  +PACKAGE_VERSION='0.1.7'
          272  +PACKAGE_STRING='libconfig 0.1.7'
   273    273   PACKAGE_BUGREPORT=''
   274    274   
   275    275   # Factoring default headers for most tests.
   276    276   ac_includes_default="\
   277    277   #include <stdio.h>
   278    278   #if HAVE_SYS_TYPES_H
   279    279   # include <sys/types.h>
................................................................................
   774    774   #
   775    775   # Report the --help message.
   776    776   #
   777    777   if test "$ac_init_help" = "long"; then
   778    778     # Omit some internal or obsolete options to make the list less imposing.
   779    779     # This message is too long to be a string in the A/UX 3.1 sh.
   780    780     cat <<_ACEOF
   781         -\`configure' configures libconfig 0.1.6 to adapt to many kinds of systems.
          781  +\`configure' configures libconfig 0.1.7 to adapt to many kinds of systems.
   782    782   
   783    783   Usage: $0 [OPTION]... [VAR=VALUE]...
   784    784   
   785    785   To assign environment variables (e.g., CC, CFLAGS...), specify them as
   786    786   VAR=VALUE.  See below for descriptions of some of the useful variables.
   787    787   
   788    788   Defaults for the options are specified in brackets.
................................................................................
   835    835     --build=BUILD     configure for building on BUILD [guessed]
   836    836     --host=HOST       cross-compile to build programs to run on HOST [BUILD]
   837    837   _ACEOF
   838    838   fi
   839    839   
   840    840   if test -n "$ac_init_help"; then
   841    841     case $ac_init_help in
   842         -     short | recursive ) echo "Configuration of libconfig 0.1.6:";;
          842  +     short | recursive ) echo "Configuration of libconfig 0.1.7:";;
   843    843      esac
   844    844     cat <<\_ACEOF
   845    845   
   846    846   Optional Packages:
   847    847     --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   848    848     --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   849    849     --with-libopennet       Enable opennet support
................................................................................
   951    951       cd $ac_popdir
   952    952     done
   953    953   fi
   954    954   
   955    955   test -n "$ac_init_help" && exit 0
   956    956   if $ac_init_version; then
   957    957     cat <<\_ACEOF
   958         -libconfig configure 0.1.6
          958  +libconfig configure 0.1.7
   959    959   generated by GNU Autoconf 2.59
   960    960   
   961    961   Copyright (C) 2003 Free Software Foundation, Inc.
   962    962   This configure script is free software; the Free Software Foundation
   963    963   gives unlimited permission to copy, distribute and modify it.
   964    964   _ACEOF
   965    965     exit 0
   966    966   fi
   967    967   exec 5>config.log
   968    968   cat >&5 <<_ACEOF
   969    969   This file contains any messages produced by compilers while
   970    970   running configure, to aid debugging if configure makes a mistake.
   971    971   
   972         -It was created by libconfig $as_me 0.1.6, which was
          972  +It was created by libconfig $as_me 0.1.7, which was
   973    973   generated by GNU Autoconf 2.59.  Invocation command line was
   974    974   
   975    975     $ $0 $@
   976    976   
   977    977   _ACEOF
   978    978   {
   979    979   cat <<_ASUNAME
................................................................................
 15439  15439   			break
 15440  15440   		fi
 15441  15441   	done
 15442  15442   
 15443  15443   
 15444  15444   
 15445  15445   
 15446         -for ac_func in strsep strtoll
        15446  +
        15447  +for ac_func in strsep strtoll getuid
 15447  15448   do
 15448  15449   as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 15449  15450   echo "$as_me:$LINENO: checking for $ac_func" >&5
 15450  15451   echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 15451  15452   if eval "test \"\${$as_ac_var+set}\" = set"; then
 15452  15453     echo $ECHO_N "(cached) $ECHO_C" >&6
 15453  15454   else
................................................................................
 17205  17206     echo
 17206  17207     sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
 17207  17208   ## Running $as_me. ##
 17208  17209   _ASBOX
 17209  17210   } >&5
 17210  17211   cat >&5 <<_CSEOF
 17211  17212   
 17212         -This file was extended by libconfig $as_me 0.1.6, which was
        17213  +This file was extended by libconfig $as_me 0.1.7, which was
 17213  17214   generated by GNU Autoconf 2.59.  Invocation command line was
 17214  17215   
 17215  17216     CONFIG_FILES    = $CONFIG_FILES
 17216  17217     CONFIG_HEADERS  = $CONFIG_HEADERS
 17217  17218     CONFIG_LINKS    = $CONFIG_LINKS
 17218  17219     CONFIG_COMMANDS = $CONFIG_COMMANDS
 17219  17220     $ $0 $@
................................................................................
 17265  17266   $config_headers
 17266  17267   
 17267  17268   Report bugs to <bug-autoconf@gnu.org>."
 17268  17269   _ACEOF
 17269  17270   
 17270  17271   cat >>$CONFIG_STATUS <<_ACEOF
 17271  17272   ac_cs_version="\\
 17272         -libconfig config.status 0.1.6
        17273  +libconfig config.status 0.1.7
 17273  17274   configured by $0, generated by GNU Autoconf 2.59,
 17274  17275     with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 17275  17276   
 17276  17277   Copyright (C) 2003 Free Software Foundation, Inc.
 17277  17278   This config.status script is free software; the Free Software Foundation
 17278  17279   gives unlimited permission to copy, distribute and modify it."
 17279  17280   srcdir=$srcdir

Modified configure.ac from [e41d1c8825] to [49b46603c1].

     1      1   AC_REVISION($Revision $)
     2         -AC_INIT(libconfig, 0.1.6)
            2  +AC_INIT(libconfig, 0.1.7)
     3      3   AC_CONFIG_HEADER(config.h)
     4      4   
     5      5   dnl Find out about the host OS
     6      6   DC_CHK_OS_INFO
     7      7   
     8      8   dnl Checks for programs.
     9      9   AC_PROG_CC
................................................................................
    20     20   DC_DO_TYPE(uint64_t, unsigned, 8)
    21     21   DC_DO_TYPE(int64_t, signed, 8)
    22     22   DC_DO_TYPE(uint32_t, unsigned, 4)
    23     23   DC_DO_TYPE(int32_t, signed, 4)
    24     24   DC_DO_TYPE(uint16_t, unsigned, 2)
    25     25   DC_DO_TYPE(int16_t, signed, 2)
    26     26   
    27         -AC_REPLACE_FUNCS(strsep strtoll)
           27  +AC_REPLACE_FUNCS(strsep strtoll getuid)
    28     28   AC_CHECK_FUNCS(getpwuid)
    29     29   
    30     30   DC_ASK_OPTLIB(opennet, fopen_net, opennet.h, [      Enable opennet support], libopennet, HAVE_LIBOPENNET, HAVE_OPENNET_H)
    31     31   
    32     32   dnl Checks for Win32 specific things.
    33     33   DC_DO_WIN32
    34     34   
    35     35   dnl This must be last.
    36     36   DC_GET_SHOBJFLAGS
    37     37   
    38     38   AC_OUTPUT(Makefile lc_geterrno.3 lc_process.3 lc_register_var.3 lc_geterrstr.3 lc_register_callback.3 lc_cleanup.3 lc_process_file.3 libconfig.3)

Added getuid.c version [721d47a38b].

            1  +#include "getuid.h"
            2  +
            3  +uid_t getuid(void) {
            4  +	return(0);
            5  +}

Added getuid.h version [bc30b2d770].

            1  +#ifndef _LC_GETUID_H
            2  +#define _LC_GETUID_H
            3  +
            4  +typedef int uid_t;
            5  +
            6  +uid_t getuid(void);
            7  +
            8  +#endif

Modified lc_cleanup.3.in from [da39a3ee5e] to [1a58c9eea6].

            1  +.TH LC_GETERRNO 3 "25 Oct 04" "@PACKAGE_STRING@"
            2  +.SH NAME
            3  +lc_cleanup \- Clean up internal structures after processing data.
            4  +
            5  +.SH SYNOPSIS
            6  +.B #include <libconfig.h>
            7  +.sp
            8  +.BI "void lc_cleanup(void);"
            9  +
           10  +.SH DESCRIPTION
           11  +The
           12  +.BR lc_cleanup (3)
           13  +function cleans up the internal structures created by calling
           14  +.BR lc_register_var (3)
           15  +or
           16  +.BR lc_register_callback (3)
           17  +and returns the memory to the application.  It is not strictly required, however memory concious programmers will still want to call this after finishing processing configuration files.
           18  +
           19  +After you call
           20  +.BR lc_cleanup (3)
           21  +calling
           22  +.BR lc_process (3)
           23  +or
           24  +.BR lc_process_file (3)
           25  +will generally cause errors since the registered variables and callbacks have been unregistered.
           26  +
           27  +.SH EXAMPLE
           28  +.nf
           29  +#include <libconfig.h>
           30  +#include <stdlib.h>
           31  +#include <stdio.h>
           32  +
           33  +int main(int argc, char **argv) {
           34  +	int lc_p_ret, lc_rv_ret;
           35  +	char *filename = NULL;
           36  +
           37  +	lc_rv_ret = lc_register_var("File", LC_VAR_STRING,
           38  +	                            &filename, 'f');
           39  +
           40  +	if (lc_rv_ret != 0) {
           41  +		fprintf(stderr, "Error registering variable: %i.\\n",
           42  +		        lc_geterrno());
           43  +		return(EXIT_FAILURE);
           44  +	}
           45  +
           46  +	lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
           47  +	                      NULL);
           48  +
           49  +	lc_cleanup();
           50  +
           51  +	if (lc_p_ret != 0) {
           52  +		fprintf(stderr, "Error processing configuration: \\
           53  +		        %s\\n", lc_geterrstr());
           54  +		return(EXIT_FAILURE);
           55  +	}
           56  +
           57  +	if (filename != NULL) {
           58  +		printf("File specified was: %s\\n", filename);
           59  +	} else {
           60  +		printf("No filename specified.\\n");
           61  +	}
           62  +
           63  +	return(EXIT_SUCCESS);
           64  +}
           65  +.fi
           66  +
           67  +.SH "SEE ALSO"
           68  +.BR lc_register_var (3),
           69  +.BR lc_register_callback (3),
           70  +.BR lc_geterrstr (3),
           71  +.BR lc_geterrno (3),
           72  +.BR lc_process_file (3),
           73  +.BR lc_process (3)

Modified libconfig.c from [8802ab0d93] to [a7581f8b4f].

   813    813   	snprintf(configfiles[1][7], sizeof(**configfiles) - 1, "/usr/etc/%s/%s.conf", appname, appname);
   814    814   	snprintf(configfiles[1][8], sizeof(**configfiles) - 1, "/usr/local/etc/%s.cfg", appname);
   815    815   	snprintf(configfiles[1][9], sizeof(**configfiles) - 1, "/usr/local/etc/%s.conf", appname);
   816    816   	snprintf(configfiles[1][10], sizeof(**configfiles) - 1, "/usr/local/etc/%s/%s.cfg", appname, appname);
   817    817   	snprintf(configfiles[1][11], sizeof(**configfiles) - 1, "/usr/local/etc/%s/%s.conf", appname, appname);
   818    818   	if (getuid() != 0) {
   819    819   		homedir = getenv("HOME");
          820  +#ifdef HAVE_GETPWUID
   820    821   		if (homedir == NULL) {
   821    822   			pwinfo = getpwuid(getuid());
   822    823   			if (pwinfo != NULL) {
   823    824   				homedir = pwinfo->pw_dir;
   824    825   			}
   825    826   		}
          827  +#endif
   826    828   		if (homedir != NULL) {
   827    829   			if (strcmp(homedir, "/") != 0 && access(homedir, R_OK|W_OK|X_OK) == 0) {
   828    830   				snprintf(configfiles[2][0], sizeof(**configfiles) - 1, "%s/.%src", homedir, appname);
   829    831   				snprintf(configfiles[2][1], sizeof(**configfiles) - 1, "%s/.%s.cfg", homedir, appname);
   830    832   				snprintf(configfiles[2][2], sizeof(**configfiles) - 1, "%s/.%s.conf", homedir, appname);
   831    833   				snprintf(configfiles[2][3], sizeof(**configfiles) - 1, "%s/.%s/%s.cfg", homedir, appname, appname);
   832    834   				snprintf(configfiles[2][4], sizeof(**configfiles) - 1, "%s/.%s/%s.conf", homedir, appname, appname);