4580617 [rkeene@sledge /home/rkeene/devel/libconfig-0.2.5]$ cat -n lc_process_file.3.in
   1: .TH LC_PROCESS_FILE 3 "25 Oct 04" "@PACKAGE_STRING@"
   2: .SH NAME
   3: lc_process_file \- Process a specific file
   4: 
   5: .SH SYNOPSIS
   6: .B #include <libconfig.h>
   7: .sp
   8: .BI "int lc_process_file(const char *" appname ", const char *" pathname ", lc_conf_type_t " type ");"
   9: 
  10: .SH DESCRIPTION
  11: The
  12: .BR lc_process_file (3)
  13: function processes exactly one configuration file.  The file is specified by the
  14: .I pathname
  15: argument and should be in the format specified by the
  16: .I type
  17: argument.  The
  18: .I appname
  19: argument should be a reasonable form of the name of the application.
  20: 
  21: .SH "RETURN VALUE"
  22: On success 0 is returned, otherwise -1 is returned.
  23: 
  24: .SH EXAMPLE
  25: .nf
  26: #include <libconfig.h>
  27: #include <stdlib.h>
  28: #include <stdio.h>
  29: 
  30: int main(int argc, char **argv) {
  31: 	int lc_p_ret, lc_rv_ret;
  32: 	char *filename = NULL;
  33: 
  34: 	lc_rv_ret = lc_register_var("File", LC_VAR_STRING,
  35: 	                            &filename, 'f');
  36: 	if (lc_rv_ret != 0) {
  37: 		fprintf(stderr, "Error registering variable: %i.\\n",
  38: 		        lc_geterrno());
  39: 		return(EXIT_FAILURE);
  40: 	}
  41: 
  42: 	lc_p_ret = lc_process_file("example", "/data/extra.conf",
  43: 	                           LC_CONF_APACHE);
  44: 
  45: 	lc_cleanup();
  46: 
  47: 	if (lc_p_ret != 0) {
  48: 		fprintf(stderr, "Error processing configuration file: \\
  49: 		        %s\\n", lc_geterrstr());
  50: 		return(EXIT_FAILURE);
  51: 	}
  52: 
  53: 	if (filename != NULL) {
  54: 		printf("File specified was: %s\\n", filename);
  55: 	} else {
  56: 		printf("No filename specified.\\n");
  57: 	}
  58: 
  59: 	return(EXIT_SUCCESS);
  60: }
  61: .fi
  62: 
  63: .SH "SEE ALSO"
  64: .BR libconfig (3),
  65: .BR lc_register_var (3),
  66: .BR lc_register_callback (3),                          
  67: .BR lc_geterrno (3),                                                                                                           
  68: .BR lc_geterrstr (3),                                                                                                          
  69: .BR lc_seterrstr (3),                                                                                                          
  70: .BR lc_handle_type (3),
  71: .BR lc_process (3),                                                                                                            
  72: .BR lc_cleanup (3)
4580618 [rkeene@sledge /home/rkeene/devel/libconfig-0.2.5]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2006-12-18 01:41:57