Check-in [304f4b8d4a]
Overview
Comment:Updated manual pages. The "extraconfig" files are now processed before the /etc ones.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 304f4b8d4a608faa93d96e2bc65363909e79e8b5
User & Date: rkeene on 2004-10-29 16:33:50
Other Links: manifest | tags
Context
2004-10-29
16:40
Updated man pages. check-in: 2dfd527012 user: rkeene tags: trunk
16:33
Updated manual pages. The "extraconfig" files are now processed before the /etc ones. check-in: 304f4b8d4a user: rkeene tags: trunk
16:17
Updated man pages. check-in: 6861d15aac user: rkeene tags: trunk
Changes

Modified Docs/USAGE from [1da5b3b06f] to [8e2c3e2916].

1

The usage goes here...

|
>
1
2
See the manual pages for details.
Currently there is no supplemental usage information, there will be soon.

Modified configure from [8d41d5a2ce] to [80531d32c6].

16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
    SHLIBOBJS="$SHLIBOBJS `echo $obj | sed 's/\.o$/_shr.o/g'`"
  done

  echo "$as_me:$LINENO: result: $SHOBJLDFLAGS $SHOBJFLAGS" >&5
echo "${ECHO_T}$SHOBJLDFLAGS $SHOBJFLAGS" >&6


                                                            ac_config_files="$ac_config_files Makefile lc_geterrno.3 lc_process.3 lc_register_var.3 lc_geterrstr.3 lc_register_callback.3"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems.  If it contains results you don't
# want to keep, you may remove or edit it.
#







|







16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
    SHLIBOBJS="$SHLIBOBJS `echo $obj | sed 's/\.o$/_shr.o/g'`"
  done

  echo "$as_me:$LINENO: result: $SHOBJLDFLAGS $SHOBJFLAGS" >&5
echo "${ECHO_T}$SHOBJLDFLAGS $SHOBJFLAGS" >&6


                                                                      ac_config_files="$ac_config_files Makefile lc_geterrno.3 lc_process.3 lc_register_var.3 lc_geterrstr.3 lc_register_callback.3 libconfig.3"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems.  If it contains results you don't
# want to keep, you may remove or edit it.
#
16851
16852
16853
16854
16855
16856
16857

16858
16859
16860
16861
16862
16863
16864
  # Handling of arguments.
  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
  "lc_geterrno.3" ) CONFIG_FILES="$CONFIG_FILES lc_geterrno.3" ;;
  "lc_process.3" ) CONFIG_FILES="$CONFIG_FILES lc_process.3" ;;
  "lc_register_var.3" ) CONFIG_FILES="$CONFIG_FILES lc_register_var.3" ;;
  "lc_geterrstr.3" ) CONFIG_FILES="$CONFIG_FILES lc_geterrstr.3" ;;
  "lc_register_callback.3" ) CONFIG_FILES="$CONFIG_FILES lc_register_callback.3" ;;

  "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
   { (exit 1); exit 1; }; };;
  esac
done








>







16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
  # Handling of arguments.
  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
  "lc_geterrno.3" ) CONFIG_FILES="$CONFIG_FILES lc_geterrno.3" ;;
  "lc_process.3" ) CONFIG_FILES="$CONFIG_FILES lc_process.3" ;;
  "lc_register_var.3" ) CONFIG_FILES="$CONFIG_FILES lc_register_var.3" ;;
  "lc_geterrstr.3" ) CONFIG_FILES="$CONFIG_FILES lc_geterrstr.3" ;;
  "lc_register_callback.3" ) CONFIG_FILES="$CONFIG_FILES lc_register_callback.3" ;;
  "libconfig.3" ) CONFIG_FILES="$CONFIG_FILES libconfig.3" ;;
  "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
   { (exit 1); exit 1; }; };;
  esac
done

Modified configure.in from [f1ad2924cf] to [10d7c6dbc1].

29
30
31
32
33
34
35
36

dnl Checks for Win32 specific things.
DC_DO_WIN32

dnl This must be last.
DC_GET_SHOBJFLAGS

AC_OUTPUT(Makefile lc_geterrno.3 lc_process.3 lc_register_var.3 lc_geterrstr.3 lc_register_callback.3)







|
29
30
31
32
33
34
35
36

dnl Checks for Win32 specific things.
DC_DO_WIN32

dnl This must be last.
DC_GET_SHOBJFLAGS

AC_OUTPUT(Makefile lc_geterrno.3 lc_process.3 lc_register_var.3 lc_geterrstr.3 lc_register_callback.3 libconfig.3)

Added libconfig.3.in version [7c04184349].































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
.TH LIBCONFIG 3 "25 Oct 04" "@PACKAGE_STRING@"
.SH NAME
libconfig \- Consistent configuration library.

.SH SYNOPSIS
.B #include <libconfig.h>
.sp
.BI "int lc_register_callback(const char *" var ", char " opt ", lc_var_type_t " type ", int (*" callback ")(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *" extra ");"

.BI "int lc_register_var(const char *" var ", lc_var_type_t " type ", void *" data ", char " opt ");"

.BI "int lc_process(int " argc ", char **" argv ", const char *" appname ", lc_conf_type_t " type ", const char *" extra ");"

.BI "lc_err_t lc_geterrno(void);"

.BI "char *lc_geterrstr(void);"

.SH DESCRIPTION
Libconfig is a library to provide easy access to configuration data in a consistent and logical manner.

.SH EXAMPLE
.nf
#include <libconfig.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
	int lc_p_ret, lc_rv_ret;
	char *filename = NULL;

	lc_rv_ret = lc_register_var("File", LC_VAR_STRING,
	                            &filename, 'f');

	if (lc_rv_ret != 0) {
		fprintf(stderr, "Error registering variable: %i.\\n",
		        lc_geterrno());
		return(EXIT_FAILURE);
	}

	lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
	                      NULL);
	if (lc_p_ret != 0) {
		fprintf(stderr, "Error processing configuration: \\
		        %s\\n", lc_geterrstr());
		return(EXIT_FAILURE);
	}

	if (filename != NULL) {
		printf("File specified was: %s\\n", filename);
	} else {
		printf("No filename specified.\\n");
	}

	return(EXIT_SUCCESS);
}
.fi

.SH "SEE ALSO"
.BR lc_register_var (3),
.BR lc_register_callback (3),
.BR lc_geterr (3),
.BR lc_geterrstr (3),
.BR lc_process (3)

Modified libconfig.c from [ce1c286cb1] to [b6b91c93e6].

741
742
743
744
745
746
747

748


749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
	struct passwd *pwinfo = NULL;
	char configfiles[3][13][512] = {{{0}}};
	char *configfile = NULL;
	char *homedir = NULL;
	int configsetidx = 0, configidx = 0;
	int chkretval = 0, retval = 0;


	snprintf(configfiles[0][0], sizeof(**configfiles) - 1, "/etc/%s.cfg", appname);


	snprintf(configfiles[0][1], sizeof(**configfiles) - 1, "/etc/%s.conf", appname);
	snprintf(configfiles[0][2], sizeof(**configfiles) - 1, "/etc/%s/%s.cfg", appname, appname);
	snprintf(configfiles[0][3], sizeof(**configfiles) - 1, "/etc/%s/%s.conf", appname, appname);
	snprintf(configfiles[0][4], sizeof(**configfiles) - 1, "/usr/etc/%s.cfg", appname);
	snprintf(configfiles[0][5], sizeof(**configfiles) - 1, "/usr/etc/%s.conf", appname);
	snprintf(configfiles[0][6], sizeof(**configfiles) - 1, "/usr/etc/%s/%s.cfg", appname, appname);
	snprintf(configfiles[0][7], sizeof(**configfiles) - 1, "/usr/etc/%s/%s.conf", appname, appname);
	snprintf(configfiles[0][8], sizeof(**configfiles) - 1, "/usr/local/etc/%s.cfg", appname);
	snprintf(configfiles[0][9], sizeof(**configfiles) - 1, "/usr/local/etc/%s.conf", appname);
	snprintf(configfiles[0][10], sizeof(**configfiles) - 1, "/usr/local/etc/%s/%s.cfg", appname, appname);
	snprintf(configfiles[0][11], sizeof(**configfiles) - 1, "/usr/local/etc/%s/%s.conf", appname, appname);
	snprintf(configfiles[1][0], sizeof(**configfiles) - 1, "%s", extraconfig);
	if (getuid() != 0) {
		homedir = getenv("HOME");
		if (homedir == NULL) {
			pwinfo = getpwuid(getuid());
			if (pwinfo != NULL) {
				homedir = pwinfo->pw_dir;
			}







>
|
>
>
|
|
|
|
|
|
|
|
|
|
|
<







741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762

763
764
765
766
767
768
769
	struct passwd *pwinfo = NULL;
	char configfiles[3][13][512] = {{{0}}};
	char *configfile = NULL;
	char *homedir = NULL;
	int configsetidx = 0, configidx = 0;
	int chkretval = 0, retval = 0;

	if (extraconfig != NULL) {
		snprintf(configfiles[0][0], sizeof(**configfiles) - 1, "%s", extraconfig);
	}
	snprintf(configfiles[1][0], sizeof(**configfiles) - 1, "/etc/%s.cfg", appname);
	snprintf(configfiles[1][1], sizeof(**configfiles) - 1, "/etc/%s.conf", appname);
	snprintf(configfiles[1][2], sizeof(**configfiles) - 1, "/etc/%s/%s.cfg", appname, appname);
	snprintf(configfiles[1][3], sizeof(**configfiles) - 1, "/etc/%s/%s.conf", appname, appname);
	snprintf(configfiles[1][4], sizeof(**configfiles) - 1, "/usr/etc/%s.cfg", appname);
	snprintf(configfiles[1][5], sizeof(**configfiles) - 1, "/usr/etc/%s.conf", appname);
	snprintf(configfiles[1][6], sizeof(**configfiles) - 1, "/usr/etc/%s/%s.cfg", appname, appname);
	snprintf(configfiles[1][7], sizeof(**configfiles) - 1, "/usr/etc/%s/%s.conf", appname, appname);
	snprintf(configfiles[1][8], sizeof(**configfiles) - 1, "/usr/local/etc/%s.cfg", appname);
	snprintf(configfiles[1][9], sizeof(**configfiles) - 1, "/usr/local/etc/%s.conf", appname);
	snprintf(configfiles[1][10], sizeof(**configfiles) - 1, "/usr/local/etc/%s/%s.cfg", appname, appname);
	snprintf(configfiles[1][11], sizeof(**configfiles) - 1, "/usr/local/etc/%s/%s.conf", appname, appname);

	if (getuid() != 0) {
		homedir = getenv("HOME");
		if (homedir == NULL) {
			pwinfo = getpwuid(getuid());
			if (pwinfo != NULL) {
				homedir = pwinfo->pw_dir;
			}