removed mercurius from trunk
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@66 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
родитель
4fd1df0586
Коммит
c5287c543e
@ -1,7 +1,7 @@
|
||||
SHELL = /bin/sh
|
||||
VPATH = @srcdir@
|
||||
|
||||
subdirs = libssh sftp_server
|
||||
subdirs = libssh
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = .
|
||||
srcdir = @srcdir@
|
||||
|
@ -84,8 +84,7 @@ AC_SEARCH_LIBS([gethostbyname],[nsl resolv])
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h \
|
||||
sys/time.h termios.h unistd.h openssl/aes.h openssl/blowfish.h \
|
||||
openssl/des.h zlib.h sys/poll.h stdint.h pty.h pam/pam_appl.h \
|
||||
security/pam_appl.h gcrypt.h])
|
||||
openssl/des.h zlib.h sys/poll.h stdint.h pty.h gcrypt.h])
|
||||
|
||||
#Warn user when no openssl available
|
||||
#FIXME ! how to make it work with gcrypt ?
|
||||
@ -117,6 +116,5 @@ AC_CHECK_FUNCS([endpwent getaddrinfo gethostbyname getpass memmove memset \
|
||||
cfmakeraw select socket strchr strdup strerror strstr poll])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
libssh/Makefile
|
||||
sftp_server/Makefile])
|
||||
libssh/Makefile])
|
||||
AC_OUTPUT
|
||||
|
@ -1,52 +0,0 @@
|
||||
OBJECTS= main.o config.o list.o protocol.o userauth.o acl.o \
|
||||
libconfig/libconfig.a ../libssh/libssh.la
|
||||
SHELL = /bin/sh
|
||||
VPATH = @srcdir@
|
||||
|
||||
subdirs = @subdirs@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
srcdir = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = $(exec_prefix)/bin
|
||||
incldir= $(prefix)/include
|
||||
infodir = $(prefix)/info
|
||||
libdir = $(prefix)/lib/
|
||||
mandir = $(prefix)/man/man1
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@ -Wall -I../include/ -Ilibconfig/
|
||||
LDFLAGS =
|
||||
LIBS = @LIBS@ -lpam
|
||||
INSTALL = @INSTALL@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBSSH_LDFLAGS = @LIBSSH_LDFLAGS@
|
||||
|
||||
all: sftp_server
|
||||
|
||||
main.o: server.h libconfig/libconfig.h
|
||||
list.o: server.h libconfig/libconfig.h
|
||||
protocol.o: server.h libconfig/libconfig.h
|
||||
userauth.o: server.h libconfig/libconfig.h
|
||||
config.o: server.h libconfig/libconfig.h
|
||||
|
||||
libconfig/libconfig.a: libconfig/libconfig.h
|
||||
make -C libconfig/
|
||||
../libssh/libssh.la:
|
||||
make -C ../libssh/ libssh.la
|
||||
libconfig/libconfig.h:
|
||||
cd libconfig ; ./configure ; cd ..
|
||||
make -C libconfig/
|
||||
sftp_server: $(OBJECTS)
|
||||
# make -C ../libssh libssh.la
|
||||
$(LIBTOOL) --mode=link $(CC) -o sftp_server $(OBJECTS) $(LIBS) $(LDFLAGS)
|
||||
install: all
|
||||
$(top_srcdir)/mkinstalldirs $(incldir)
|
||||
$(top_srcdir)/mkinstalldirs $(libdir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL) sftp_server $(bindir)
|
||||
clean:
|
||||
$(LIBTOOL) --mode=clean rm -f *~ sftp_server *.o
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
|
@ -1,56 +0,0 @@
|
||||
Mercurius : a secure ftp server
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
What does it do ?
|
||||
-----------------
|
||||
Mercurius is a sftp server. secure ftp is not FTP over SSL. It's a file transfert protocol (not ftp) over SSH.
|
||||
Mercurius uses libssh as a transport layer, meaning it doesn't need a ssh server running. Which also mean it cannot run on the same server port that your current ssh server.
|
||||
|
||||
Well, openssh also has a sftp server, what then?
|
||||
------------------------------------------------
|
||||
|
||||
Openssh's server was meant to transfert files from users of the system. Mercurius is meant to transfert files from regular users or anonymous users, with configurations :
|
||||
|
||||
-users can be set into groups. These groups have different capabilities. Let's say you have a webmaster, a sysadmin, a user (joe) and a public ftp.
|
||||
|
||||
you want your sysadmin to have full access all over the disk, and be authenticated
|
||||
You want your public ftp just to have right of reading files into the ftp directory
|
||||
you want the webmaster to be able to add files into the ftp directory
|
||||
You want joe to access only his homedir readwrite.
|
||||
|
||||
We then have a configuration file. The groups are defined this way:
|
||||
<group users>
|
||||
user joe, someother
|
||||
chroot $HOME/
|
||||
</group>
|
||||
<group anonymous>
|
||||
user ftp, anonymous
|
||||
chroot /home/ftp
|
||||
uid ftp
|
||||
</group>
|
||||
<group admin>
|
||||
user admin
|
||||
chroot /home
|
||||
uid root
|
||||
</group>
|
||||
<group webmaster>
|
||||
chroot /home/ftp
|
||||
</group>
|
||||
|
||||
At this state, you have the kernel ACL that controls your users. You may want to add usermode ACL. Well, you'll wait tomorow's snapshot :)
|
||||
|
||||
How to compile that crap ?
|
||||
--------------------------
|
||||
|
||||
Well, you'll need other craps to have it to compile, like libssl and libpam.
|
||||
under debian, they are libssl-dev and libpam-dev packages. I don't know for others.
|
||||
just untar, ./configure ; make
|
||||
there are 2 important files : sftp_server and mercurius.conf. by default, the server will use the config file into the current dir.
|
||||
Then, you have to configure PAM for our service : sftp.
|
||||
in most distro, there is a library /etc/pam.d/
|
||||
i've given sample pam config files to put there into the pam/ directory, but if they don't work, just copy /etc/pam.d/login or gdm on /etc/pam.d/sftp
|
||||
|
||||
What's working/not working ?
|
||||
----------------------------
|
||||
there is no file upload support yet. The directory ACL is parsed but not run yet. The authentication errors may be cryptic. It might crash and dump a core (I'd like a backtrace if possible).
|
||||
|
@ -1,31 +0,0 @@
|
||||
/* Access control lists*/
|
||||
/*
|
||||
Copyright 2005 Aris Adamantiadis
|
||||
|
||||
This file is part of the SSH Library
|
||||
|
||||
The SSH 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.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The SSH 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 the SSH Library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA. */
|
||||
#include "server.h"
|
||||
|
||||
int acl_open(char *file, int mode);
|
||||
int acl_opendir(char *dir);
|
||||
int acl_stat(char *file);
|
||||
int acl_rm(char *file);
|
||||
int acl_rmdir(char *dir);
|
||||
int acl_mv(char *from, char *to);
|
||||
int acl_mkdir(char *dir);
|
||||
int acl_symlink(char *from, char *to);
|
||||
int acl_setstat(char *file);
|
@ -1,345 +0,0 @@
|
||||
/* config.c */
|
||||
/*
|
||||
Copyright 2005 Aris Adamantiadis
|
||||
|
||||
This file is part of the SSH Library
|
||||
|
||||
The SSH 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.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The SSH 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 the SSH Library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA. */
|
||||
|
||||
#include "libconfig.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "server.h"
|
||||
/* shortvar is "port" in "port 22" */
|
||||
|
||||
int port=22;
|
||||
char *dsa=NULL;
|
||||
char *rsa=NULL;
|
||||
|
||||
list *groups;
|
||||
list *users;
|
||||
struct dir *root_dir=NULL;
|
||||
/* users is a list of users. The key of this list is the user name.
|
||||
the data of the list is a list of groups. both data & key from this list
|
||||
is the group name */
|
||||
struct group *current_group=NULL;
|
||||
char *current_group_name;
|
||||
int add_user(char *user){
|
||||
list *groups_from_user;
|
||||
// list *the_user;
|
||||
//printf("add_user(%s)\n",user);
|
||||
if(!list_find(current_group->users,user)){
|
||||
current_group->users=list_add(current_group->users,user,strdup(user));
|
||||
}
|
||||
groups_from_user=list_find(users,user);
|
||||
if(!groups_from_user){
|
||||
// the user isn't registered yet
|
||||
groups_from_user=list_add(NULL,current_group_name,current_group_name);
|
||||
users=list_add(users,user,groups_from_user);
|
||||
} else {
|
||||
// add the group name to the list of groups the user is bound to.
|
||||
if(!list_find(groups_from_user,current_group_name)) // don't add it if it is already set
|
||||
list_set(users,user,list_add(groups_from_user,current_group_name,current_group_name));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int add_group(char *group){
|
||||
struct group *grp=list_find(groups,group);
|
||||
list *usr;
|
||||
if(!grp){
|
||||
printf("no such group %s\n",group);
|
||||
return -1;
|
||||
}
|
||||
usr=grp->users;
|
||||
while(usr){
|
||||
add_user(usr->key);
|
||||
usr=usr->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int group_callback(const char *shortvar, const char *var, const char *arguments, const char *value, lc_flags_t flags, void *extra){
|
||||
switch(flags){
|
||||
case LC_FLAGS_SECTIONSTART:
|
||||
//printf("new group %s\n",arguments);
|
||||
if(current_group){
|
||||
printf("can't include a section into a section\n");
|
||||
return LC_CBRET_ERROR;
|
||||
}
|
||||
if(list_find(groups,arguments)){
|
||||
printf("group %s defined twice\n",arguments);
|
||||
return LC_CBRET_ERROR;
|
||||
}
|
||||
current_group=malloc(sizeof(struct group));
|
||||
memset(current_group,0,sizeof(struct group));
|
||||
groups=list_add(groups,arguments,current_group);
|
||||
current_group_name=strdup(arguments);
|
||||
break;
|
||||
case LC_FLAGS_SECTIONEND:
|
||||
//printf("end of group\n\n");
|
||||
current_group=NULL;
|
||||
break;
|
||||
default:
|
||||
//printf("%s - %s\n", shortvar, value);
|
||||
if(!strcasecmp(shortvar,"user")){
|
||||
char *ptr;
|
||||
char *user=(char *)value;
|
||||
do{
|
||||
ptr=strchr(user,',');
|
||||
if(ptr){
|
||||
*ptr=0;
|
||||
++ptr;
|
||||
}
|
||||
while(*user==' ')
|
||||
++user;
|
||||
add_user(user);
|
||||
user=ptr;
|
||||
} while (user);
|
||||
}
|
||||
if(!strcasecmp(shortvar,"group")){
|
||||
char *ptr;
|
||||
char *group=(char *)value;
|
||||
do{
|
||||
ptr=strchr(group,',');
|
||||
if(ptr){
|
||||
*ptr=0;
|
||||
++ptr;
|
||||
}
|
||||
while(*group==' ')
|
||||
++group;
|
||||
add_group(group);
|
||||
group=ptr;
|
||||
} while (group);
|
||||
}
|
||||
if(!strcasecmp(shortvar,"uid")){
|
||||
current_group->uid=strdup(value);
|
||||
}
|
||||
if(!strcasecmp(shortvar,"gid")){
|
||||
current_group->gid=strdup(value);
|
||||
}
|
||||
if(!strcasecmp(shortvar,"chroot")){
|
||||
current_group->chroot=strdup(value);
|
||||
}
|
||||
if(!strcasecmp(shortvar,"nopassword"))
|
||||
current_group->nopassword=1;
|
||||
}
|
||||
return LC_CBRET_OKAY;
|
||||
}
|
||||
struct dir *create_directory(const char *directory);
|
||||
struct dir *current_dir=NULL;
|
||||
int append_groups(list **plist, const char *groups){
|
||||
char *begin=strdup(groups);
|
||||
char *ptr;
|
||||
char *grp=begin;
|
||||
do{
|
||||
ptr=strchr(grp,',');
|
||||
if(ptr){
|
||||
*ptr=0;
|
||||
++ptr;
|
||||
}
|
||||
while(*grp==' ')
|
||||
++grp;
|
||||
if(!list_find(*plist,grp))
|
||||
*plist=list_add(*plist,grp,strdup(grp));
|
||||
grp=ptr;
|
||||
} while (grp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dir_callback(const char *shortvar, const char *var, const char *arguments, const char *value, lc_flags_t flags, void *extra){
|
||||
switch(flags){
|
||||
case LC_FLAGS_SECTIONSTART:
|
||||
if(current_dir){
|
||||
printf("Cannot define a directory into a directory !\n");
|
||||
return LC_CBRET_ERROR;
|
||||
}
|
||||
current_dir=create_directory(arguments);
|
||||
break;
|
||||
case LC_FLAGS_SECTIONEND:
|
||||
current_dir=NULL;
|
||||
break;
|
||||
default:
|
||||
if(!strcasecmp(shortvar,"list"))
|
||||
append_groups(¤t_dir->List,value);
|
||||
if(!strcasecmp(shortvar,"read"))
|
||||
append_groups(¤t_dir->Read,value);
|
||||
if(!strcasecmp(shortvar,"write"))
|
||||
append_groups(¤t_dir->Write,value);
|
||||
// printf("%s - %s\n",shortvar, value);
|
||||
}
|
||||
return LC_CBRET_OKAY;
|
||||
}
|
||||
|
||||
void list_config(){
|
||||
list *ptr=groups;
|
||||
list *user;
|
||||
printf("listing groups\n");
|
||||
while(ptr){
|
||||
printf("group %s\n",ptr->key);
|
||||
user=((struct group *)ptr->data)->users;
|
||||
while(user){
|
||||
printf(" user %s\n",user->key);
|
||||
user=user->next;
|
||||
}
|
||||
ptr=ptr->next;
|
||||
}
|
||||
printf("listing users\n");
|
||||
user=users;
|
||||
while(user){
|
||||
printf("user %s\n",user->key);
|
||||
ptr=user->data;
|
||||
while(ptr){
|
||||
printf(" group %s\n",ptr->key);
|
||||
ptr=ptr->next;
|
||||
}
|
||||
user=user->next;
|
||||
}
|
||||
}
|
||||
|
||||
char **cut_directory(const char *dir){
|
||||
char *tmp=strdup(dir);
|
||||
char *ptr;
|
||||
char *ret[128];
|
||||
char **answer;
|
||||
int i=0;
|
||||
while(tmp && *tmp && i<128){
|
||||
while(*tmp=='/')
|
||||
++tmp;
|
||||
ptr=strchr(tmp,'/');
|
||||
if(ptr){
|
||||
*ptr=0;
|
||||
++ptr;
|
||||
}
|
||||
ret[i]=strdup(tmp);
|
||||
tmp=ptr;
|
||||
i++;
|
||||
}
|
||||
answer=malloc((i+1)*sizeof(char *));
|
||||
memcpy(answer,ret,sizeof(char *)*i);
|
||||
answer[i]=NULL;
|
||||
return answer;
|
||||
}
|
||||
|
||||
struct dir *dir_new(){
|
||||
struct dir *dir=malloc(sizeof(struct dir));
|
||||
memset(dir,0,sizeof(*dir));
|
||||
return dir;
|
||||
}
|
||||
/* it doesn't really create the directory. it makes the tree to the directory
|
||||
* and returns a link to the last node */
|
||||
struct dir *create_directory(const char *directory){
|
||||
char **tokens=cut_directory(directory);
|
||||
int i=0;
|
||||
struct dir *dir,*ptr;
|
||||
if(!root_dir){
|
||||
root_dir=dir_new();
|
||||
root_dir->name="";
|
||||
}
|
||||
dir=root_dir;
|
||||
for(i=0;tokens[i];++i){
|
||||
ptr=list_find(dir->subdir,tokens[i]);
|
||||
if(!ptr){
|
||||
ptr=dir_new();
|
||||
ptr->name=strdup(tokens[i]);
|
||||
dir->subdir=list_add(dir->subdir,tokens[i],ptr);
|
||||
}
|
||||
dir=ptr;
|
||||
}
|
||||
for(i=0;tokens[i];++i)
|
||||
free(tokens[i]);
|
||||
free(tokens);
|
||||
return dir;
|
||||
}
|
||||
|
||||
int parse_config(char *file){
|
||||
int r;
|
||||
printf("Parsing configuration file %s\n",file);
|
||||
lc_register_var("Port",LC_VAR_INT,&port,' ');
|
||||
lc_register_var("Hostkeyrsa",LC_VAR_STRING,&rsa,' ');
|
||||
lc_register_var("Hostkeydsa",LC_VAR_STRING,&dsa,' ');
|
||||
|
||||
// lc_register_var("group", LC_VAR_SECTION, NULL, 0);
|
||||
r=lc_register_callback("group",0,LC_VAR_NONE,group_callback,NULL);
|
||||
r=lc_register_callback("group.user",0,LC_VAR_UNKNOWN,group_callback,NULL);
|
||||
r=lc_register_callback("group.uid",0,LC_VAR_UNKNOWN,group_callback,NULL);
|
||||
r=lc_register_callback("group.chroot",0,LC_VAR_UNKNOWN,group_callback,NULL);
|
||||
r=lc_register_callback("group.group",0,LC_VAR_UNKNOWN,group_callback,NULL);
|
||||
r=lc_register_callback("group.nopassword",0,LC_VAR_NONE,group_callback,NULL);
|
||||
// lc_register_var("dir", LC_VAR_SECTION, NULL, 0);
|
||||
r=lc_register_callback("dir",0,LC_VAR_NONE,dir_callback,NULL);
|
||||
r=lc_register_callback("dir.list",0,LC_VAR_UNKNOWN,dir_callback,NULL);
|
||||
r=lc_register_callback("dir.read",0,LC_VAR_UNKNOWN,dir_callback,NULL);
|
||||
r=lc_register_callback("dir.write",0,LC_VAR_UNKNOWN,dir_callback,NULL);
|
||||
|
||||
r=lc_process_file("sftp",file,LC_CONF_APACHE);
|
||||
if(r<0)
|
||||
printf("lc_process_file=%d,%s\n",r,lc_geterrstr());
|
||||
lc_cleanup();
|
||||
//list_config();
|
||||
return r<0;
|
||||
}
|
||||
|
||||
list *find_groups(char *user){
|
||||
return list_find(users,user);
|
||||
}
|
||||
|
||||
char *user_chroot(char *user){
|
||||
char *c_grp;
|
||||
list *group=find_groups(user);
|
||||
struct group *grp;
|
||||
while(group){
|
||||
c_grp=group->key;
|
||||
grp=list_find(groups,c_grp);
|
||||
if(grp->chroot)
|
||||
return grp->chroot;
|
||||
group=group->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *user_uid(char *user){
|
||||
char *c_grp;
|
||||
list *group=find_groups(user);
|
||||
struct group *grp;
|
||||
while(group){
|
||||
c_grp=group->key;
|
||||
grp=list_find(groups,c_grp);
|
||||
if(grp->uid)
|
||||
return grp->uid;
|
||||
group=group->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 0 if it's not specified. 1 if the user doesn't need a password */
|
||||
int user_nopassword(char *user){
|
||||
char *c_grp;
|
||||
list *group=find_groups(user);
|
||||
struct group *grp;
|
||||
if(!group)
|
||||
return 0; //user doesn't exist
|
||||
while(group){
|
||||
c_grp=group->key;
|
||||
grp=list_find(groups,c_grp);
|
||||
if(grp->nopassword)
|
||||
return 1;
|
||||
group=group->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
libconfig 0.1.16
|
||||
|
||||
Release information:
|
||||
pkg: libconfig version 0.1.16
|
||||
url: http://www.rkeene.org/files/oss/libconfig/devel/libconfig-0.1.16.tar.gz
|
||||
web: http://www.rkeene.org/oss/libconfig/
|
||||
date: Sat Dec 25 19:55:24 CST 2004
|
||||
mail: libconfig@rkeene.org
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Primary Authors:
|
||||
* Roy Keene <libconfig@rkeene.org>
|
||||
Primary maintainer.
|
||||
|
||||
People who have submitted patches:
|
||||
* Mirko Buffoni <mirko.buffoni@synthesys.it>
|
||||
Fixed installation issues and corrected mistakes in RPM spec file.
|
@ -1,12 +0,0 @@
|
||||
libconfig 0.1.16
|
||||
|
||||
Release information:
|
||||
pkg: libconfig version 0.1.16
|
||||
url: http://www.rkeene.org/files/oss/libconfig/devel/libconfig-0.1.16.tar.gz
|
||||
web: http://www.rkeene.org/oss/libconfig/
|
||||
date: Sat Dec 25 19:55:24 CST 2004
|
||||
mail: libconfig@rkeene.org
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
See the manual pages for details.
|
||||
Currently there is no supplemental usage information, there will be soon.
|
@ -1,27 +0,0 @@
|
||||
libconfig 0.1.16
|
||||
|
||||
Release information:
|
||||
pkg: libconfig version 0.1.16
|
||||
url: http://www.rkeene.org/files/oss/libconfig/devel/libconfig-0.1.16.tar.gz
|
||||
web: http://www.rkeene.org/oss/libconfig/
|
||||
date: Sat Dec 25 19:55:24 CST 2004
|
||||
mail: libconfig@rkeene.org
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Libconfig uses GNU autoconf configure scripts to build and should build on
|
||||
almost any platform.
|
||||
|
||||
Building it should be as easy as:
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
(note that `make' must not be BSD make, all other makes work fine.)
|
||||
|
||||
|
||||
OPTIONAL DEPENDENCIES:
|
||||
* libopennet (http://www.rkeene.org/oss/libopennet/)
|
||||
Libopennet allows URLs to be opened as easily as files, if it is
|
||||
available (and the --without-libopennet argument isn't passed to
|
||||
the `configure' script) libconfig will be able to process config
|
||||
files that are passed as URLs.
|
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2004 Roy Keene, Keene Enterprises
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,47 +0,0 @@
|
||||
d20abe87f3df651a20b24884d128bca0 AUTHORS
|
||||
9f2d044527db2c397f84c778e8c75456 Docs/USAGE
|
||||
b2faddb81da1473aef73670c1e8c259f INSTALL
|
||||
af73f33c88271873bf630bb0fa783b51 LICENSE
|
||||
5bbf4f68a457ad2f8bb95eb0bb557f4a Makefile.in
|
||||
2a9b9710ba9633da8195f40f55032d08 README
|
||||
7fd553099396ba3d260904ebc77a552a TODO
|
||||
c64af95075c04b64cbacd4de126556c4 aclocal.m4
|
||||
0a34ca3384fded2688c2cbb8e74cc8d7 compat.h
|
||||
2e9366edfbac1b6c02a04a3a79c5afea conf_apache.c
|
||||
0aefad5b20789493a49795809e834396 conf_apache.h
|
||||
b59d0984d6e2fb82d9e0be1605d69dc3 conf_colon.c
|
||||
fba2cdd01eaae32400724378e11de276 conf_colon.h
|
||||
4c7540425d5ce14ee6740a3563a632d6 conf_equal.c
|
||||
d27fec3580ac0513302d0dce04073c0c conf_equal.h
|
||||
5499a6e332981dfe631586a52857174e conf_section.c
|
||||
7d6d859d3b617e3c02291b5a27704822 conf_section.h
|
||||
eba9de5ba873ff9a3543a1a2b814081a conf_space.c
|
||||
fdcd441b45e16cf5cd9732d8c521a4bd conf_space.h
|
||||
5fa5cd19588003d3de6269ab2eaf2a78 conf_xml.c
|
||||
1fd61b990217b9befa413c8976fe6781 conf_xml.h
|
||||
24cc880101f03147b04e06e386c45050 config.guess
|
||||
3d0d007ee50b8e48ba8eb95f46a03c78 config.h.in
|
||||
5efd4f335eaecca6a494fd65b2ea64da config.sub
|
||||
3302e3c7f6ace43d8370bd2c8fa797ec configure
|
||||
7c1cd9338046000f24a29c0d1a5659be configure.ac
|
||||
63eeedf7e48d5f6535ea816b431be29c getuid.c
|
||||
1924b1441934126d1ffa717055025c53 getuid.h
|
||||
5afe8eb5573965dfb58378e4e46f3813 install-sh
|
||||
410e64ee52de23e8519277918e8ca273 lc_cleanup.3.in
|
||||
208683039f30ed2e4fff6043c592c5dc lc_geterrno.3.in
|
||||
d6c63b60666f3e1f1f70a0c636423875 lc_geterrstr.3.in
|
||||
f7cda40254ff5b4da35feab884384546 lc_process.3.in
|
||||
5ed22bb18e1a8342862e97bbf4b467b4 lc_process_file.3.in
|
||||
54be2a5f15c8af5f3a5fa479e2c869da lc_register_callback.3.in
|
||||
8a6eceab95d03e974994b19468cd0fc6 lc_register_var.3.in
|
||||
68f0a86b4893052771a225b36b35dd1d libconfig.3.in
|
||||
dca7847f0bd24079926a289f33e56ceb libconfig.c
|
||||
978db02ac1f79e88279cd7cde220ca17 libconfig.h.in
|
||||
0b912eb1413522cfbfb803e820d7836e libconfig.spec
|
||||
87fb87abe26a81ad87af44966080ea63 libconfig_private.h
|
||||
b5d78342dd660d935c5a3414a404e089 strsep.c
|
||||
afed61a2ad012a39a21072bb7a7b3756 strsep.h
|
||||
348071969f2fe79867abed5ba133caaf strtoll.c
|
||||
4c2c1dfb3d816a0b6904bc89679ec54e strtoll.h
|
||||
9340532d1509c65757f862bc6fb900a5 test-lc.c
|
||||
20409a32029af681ddfc110e4707c4c8 win32.h
|
@ -1,83 +0,0 @@
|
||||
CC = gcc
|
||||
LN_S = ln -s
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
CPP = gcc -E
|
||||
CFLAGS = -Wall -g -O2 -DHAVE_CONFIG_H
|
||||
CPPFLAGS = -DHAVE_CONFIG_H
|
||||
LDFLAGS =
|
||||
INSTALL = /usr/bin/install -c
|
||||
EXEEXT =
|
||||
OBJEXT = o
|
||||
PATH_SEPARATOR = :
|
||||
SHOBJFLAGS = -fPIC -DPIC
|
||||
SHOBJLDFLAGS = -shared -rdynamic
|
||||
SHOBJEXT = so
|
||||
ARFLAGS = # @ARFLAGS@
|
||||
AREXT = a
|
||||
PKGVERS = 0.1.16
|
||||
PKGVERSMAJOR = `echo $(PKGVERS) | cut -f 1 -d .`
|
||||
|
||||
prefix = /usr/local
|
||||
mandir = ${prefix}/man
|
||||
sysconfdir = ${prefix}/etc
|
||||
datadir = ${prefix}/share
|
||||
exec_prefix = ${prefix}
|
||||
bindir = ${exec_prefix}/bin
|
||||
libdir = ${exec_prefix}/lib
|
||||
includedir = ${prefix}/include
|
||||
|
||||
LIBS = libconfig.$(AREXT) libconfig.$(SHOBJEXT)
|
||||
BINS =
|
||||
# The following two lines need to be kept syncronised.
|
||||
OBJS = libconfig.o conf_space.o conf_section.o conf_apache.o conf_colon.o conf_equal.o conf_xml.o
|
||||
SHOBJS = libconfig_shr.o conf_space_shr.o conf_section_shr.o conf_apache_shr.o conf_colon_shr.o conf_equal_shr.o conf_xml_shr.o
|
||||
|
||||
all: $(LIBS) $(BINS)
|
||||
libconfig.$(SHOBJEXT): $(SHOBJS)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) $(SHOBJLDFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
libconfig.$(AREXT): $(OBJS)
|
||||
$(AR) rcu $@ $^
|
||||
-$(RANLIB) $@
|
||||
|
||||
libconfig.o: libconfig.c compat.h win32.h config.h libconfig.h
|
||||
libconfig_shr.o: libconfig.c compat.h win32.h config.h libconfig.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -c -o $@ libconfig.c
|
||||
|
||||
%_shr.o: %.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -c -o $@ $?
|
||||
|
||||
libconfig.h: libconfig.h.in
|
||||
cat $? | $(CPP) $(CPPFLAGS) - | grep -v '^#' | grep -v '^ *$$' | sed 's/^!/# /g;s/__BLANK_LINE__//' > $@
|
||||
|
||||
test-lc$(EXEEXT): $(LIBS) test-lc.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(filter %.c, $^) $(LDFLAGS) -Wl,-R -Wl,. -L. -lconfig
|
||||
|
||||
.PHONY: clean distclean install
|
||||
clean:
|
||||
rm -f *.o $(BINS) $(LIBS) libconfig.h *~ test-lc$(EXEEXT) *.dll.a *.dll.def *.dll
|
||||
distclean: clean
|
||||
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
|
||||
|
||||
|
||||
install: all libconfig.h
|
||||
-$(INSTALL) -d $(mandir)
|
||||
-$(INSTALL) -d $(mandir)/man3
|
||||
-$(INSTALL) -d $(libdir)
|
||||
-$(INSTALL) -d $(includedir)
|
||||
-$(INSTALL) -m 644 libconfig.$(SHOBJEXT).def $(libdir)/libconfig.$(SHOBJEXT).def
|
||||
-$(INSTALL) -m 644 libconfig.$(SHOBJEXT).a $(libdir)/libconfig.$(SHOBJEXT).a
|
||||
$(INSTALL) -m 755 libconfig.$(SHOBJEXT) $(libdir)/libconfig.$(SHOBJEXT).$(PKGVERS)
|
||||
$(INSTALL) -m 644 libconfig.$(AREXT) $(libdir)/libconfig.$(AREXT)
|
||||
$(INSTALL) -m 644 lc_register_callback.3 $(mandir)/man3/lc_register_callback.3
|
||||
$(INSTALL) -m 644 lc_register_var.3 $(mandir)/man3/lc_register_var.3
|
||||
$(INSTALL) -m 644 lc_process_file.3 $(mandir)/man3/lc_process_file.3
|
||||
$(INSTALL) -m 644 lc_geterrstr.3 $(mandir)/man3/lc_geterrstr.3
|
||||
$(INSTALL) -m 644 lc_geterrno.3 $(mandir)/man3/lc_geterrno.3
|
||||
$(INSTALL) -m 644 lc_process.3 $(mandir)/man3/lc_process.3
|
||||
$(INSTALL) -m 644 lc_cleanup.3 $(mandir)/man3/lc_cleanup.3
|
||||
$(INSTALL) -m 644 libconfig.3 $(mandir)/man3/libconfig.3
|
||||
$(INSTALL) -m 644 libconfig.h $(includedir)/libconfig.h
|
||||
-( cd $(libdir) && rm -f libconfig.$(SHOBJEXT).$(PKGVERSMAJOR) && $(LN_S) libconfig.$(SHOBJEXT).$(PKGVERS) libconfig.$(SHOBJEXT).$(PKGVERSMAJOR) )
|
||||
-( cd $(libdir) && rm -f libconfig.$(SHOBJEXT) && $(LN_S) libconfig.$(SHOBJEXT).$(PKGVERS) libconfig.$(SHOBJEXT) )
|
@ -1,83 +0,0 @@
|
||||
CC = @CC@
|
||||
LN_S = @LN_S@
|
||||
AR = @AR@
|
||||
RANLIB = @RANLIB@
|
||||
CPP = @CPP@
|
||||
CFLAGS = -Wall @CFLAGS@ @DEFS@
|
||||
CPPFLAGS = @CPPFLAGS@ @DEFS@
|
||||
LDFLAGS = @LDFLAGS@ @LIBS@
|
||||
INSTALL = @INSTALL@
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SHOBJFLAGS = @SHOBJFLAGS@
|
||||
SHOBJLDFLAGS = @SHOBJLDFLAGS@
|
||||
SHOBJEXT = @SHOBJEXT@
|
||||
ARFLAGS = # @ARFLAGS@
|
||||
AREXT = @AREXT@
|
||||
PKGVERS = @PACKAGE_VERSION@
|
||||
PKGVERSMAJOR = `echo $(PKGVERS) | cut -f 1 -d .`
|
||||
|
||||
prefix = @prefix@
|
||||
mandir = @mandir@
|
||||
sysconfdir = @sysconfdir@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
|
||||
LIBS = libconfig.$(AREXT) libconfig.$(SHOBJEXT)
|
||||
BINS =
|
||||
# The following two lines need to be kept syncronised.
|
||||
OBJS = libconfig.o conf_space.o conf_section.o conf_apache.o conf_colon.o conf_equal.o conf_xml.o @LIBOBJS@
|
||||
SHOBJS = libconfig_shr.o conf_space_shr.o conf_section_shr.o conf_apache_shr.o conf_colon_shr.o conf_equal_shr.o conf_xml_shr.o @SHLIBOBJS@
|
||||
|
||||
all: $(LIBS) $(BINS)
|
||||
libconfig.$(SHOBJEXT): $(SHOBJS)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) $(SHOBJLDFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
libconfig.$(AREXT): $(OBJS)
|
||||
$(AR) rcu $@ $^
|
||||
-$(RANLIB) $@
|
||||
|
||||
libconfig.o: libconfig.c compat.h win32.h config.h libconfig.h
|
||||
libconfig_shr.o: libconfig.c compat.h win32.h config.h libconfig.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -c -o $@ libconfig.c
|
||||
|
||||
%_shr.o: %.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -c -o $@ $?
|
||||
|
||||
libconfig.h: libconfig.h.in
|
||||
cat $? | $(CPP) $(CPPFLAGS) - | grep -v '^#' | grep -v '^ *$$' | sed 's/^!/# /g;s/__BLANK_LINE__//' > $@
|
||||
|
||||
test-lc$(EXEEXT): $(LIBS) test-lc.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(filter %.c, $^) $(LDFLAGS) -Wl,-R -Wl,. -L. -lconfig
|
||||
|
||||
.PHONY: clean distclean install
|
||||
clean:
|
||||
rm -f *.o $(BINS) $(LIBS) libconfig.h *~ test-lc$(EXEEXT) *.dll.a *.dll.def *.dll
|
||||
distclean: clean
|
||||
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
|
||||
|
||||
|
||||
install: all libconfig.h
|
||||
-$(INSTALL) -d $(mandir)
|
||||
-$(INSTALL) -d $(mandir)/man3
|
||||
-$(INSTALL) -d $(libdir)
|
||||
-$(INSTALL) -d $(includedir)
|
||||
-$(INSTALL) -m 644 libconfig.$(SHOBJEXT).def $(libdir)/libconfig.$(SHOBJEXT).def
|
||||
-$(INSTALL) -m 644 libconfig.$(SHOBJEXT).a $(libdir)/libconfig.$(SHOBJEXT).a
|
||||
$(INSTALL) -m 755 libconfig.$(SHOBJEXT) $(libdir)/libconfig.$(SHOBJEXT).$(PKGVERS)
|
||||
$(INSTALL) -m 644 libconfig.$(AREXT) $(libdir)/libconfig.$(AREXT)
|
||||
$(INSTALL) -m 644 lc_register_callback.3 $(mandir)/man3/lc_register_callback.3
|
||||
$(INSTALL) -m 644 lc_register_var.3 $(mandir)/man3/lc_register_var.3
|
||||
$(INSTALL) -m 644 lc_process_file.3 $(mandir)/man3/lc_process_file.3
|
||||
$(INSTALL) -m 644 lc_geterrstr.3 $(mandir)/man3/lc_geterrstr.3
|
||||
$(INSTALL) -m 644 lc_geterrno.3 $(mandir)/man3/lc_geterrno.3
|
||||
$(INSTALL) -m 644 lc_process.3 $(mandir)/man3/lc_process.3
|
||||
$(INSTALL) -m 644 lc_cleanup.3 $(mandir)/man3/lc_cleanup.3
|
||||
$(INSTALL) -m 644 libconfig.3 $(mandir)/man3/libconfig.3
|
||||
$(INSTALL) -m 644 libconfig.h $(includedir)/libconfig.h
|
||||
-( cd $(libdir) && rm -f libconfig.$(SHOBJEXT).$(PKGVERSMAJOR) && $(LN_S) libconfig.$(SHOBJEXT).$(PKGVERS) libconfig.$(SHOBJEXT).$(PKGVERSMAJOR) )
|
||||
-( cd $(libdir) && rm -f libconfig.$(SHOBJEXT) && $(LN_S) libconfig.$(SHOBJEXT).$(PKGVERS) libconfig.$(SHOBJEXT) )
|
@ -1,19 +0,0 @@
|
||||
libconfig 0.1.16
|
||||
|
||||
Release information:
|
||||
pkg: libconfig version 0.1.16
|
||||
url: http://www.rkeene.org/files/oss/libconfig/devel/libconfig-0.1.16.tar.gz
|
||||
web: http://www.rkeene.org/oss/libconfig/
|
||||
date: Sat Dec 25 19:55:24 CST 2004
|
||||
mail: libconfig@rkeene.org
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Tested platforms:
|
||||
Mac OS X 10.1
|
||||
HP-UX 11.11
|
||||
NetBSD 1.6.1
|
||||
FreeBSD 4.8
|
||||
OpenBSD 3.4
|
||||
SunOS 5.9
|
||||
Linux (Slackware, RedHat, Fedora Core, Debian)
|
||||
IRIX 6.5
|
@ -1,11 +0,0 @@
|
||||
libconfig 0.1.16
|
||||
|
||||
Release information:
|
||||
pkg: libconfig version 0.1.16
|
||||
url: http://www.rkeene.org/files/oss/libconfig/devel/libconfig-0.1.16.tar.gz
|
||||
web: http://www.rkeene.org/oss/libconfig/
|
||||
date: Sat Dec 25 19:55:24 CST 2004
|
||||
mail: libconfig@rkeene.org
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
More manual pages.
|
222
sftp_server/libconfig/aclocal.m4
поставляемый
222
sftp_server/libconfig/aclocal.m4
поставляемый
@ -1,222 +0,0 @@
|
||||
AC_DEFUN(DC_DO_WIN32, [
|
||||
AC_CHECK_HEADERS(windows.h windowsx.h)
|
||||
])
|
||||
|
||||
AC_DEFUN(DC_DO_TYPE, [
|
||||
if test -z "$ac_cv_sizeof_long"; then
|
||||
AC_C_INLINE
|
||||
AC_CHECK_SIZEOF(long long, 8)
|
||||
AC_CHECK_SIZEOF(long, 4)
|
||||
AC_CHECK_SIZEOF(int, 4)
|
||||
AC_CHECK_SIZEOF(short, 2)
|
||||
fi
|
||||
FOUND=0
|
||||
for dc_cv_loop in \$ac_cv_sizeof_long_long \$ac_cv_sizeof_int \$ac_cv_sizeof_long \$ac_cv_sizeof_short; do
|
||||
dc_cv_size=`eval echo $dc_cv_loop`
|
||||
dc_cv_name=`echo $dc_cv_loop | sed s/\\\$ac_cv_sizeof_//`
|
||||
if test "$dc_cv_size" = "$3"; then
|
||||
if test "$dc_cv_name" = "int"; then
|
||||
AC_CHECK_TYPE($1, $2 int)
|
||||
fi
|
||||
if test "$dc_cv_name" = "long"; then
|
||||
AC_CHECK_TYPE($1, $2 long)
|
||||
fi
|
||||
if test "$dc_cv_name" = "long_long"; then
|
||||
AC_CHECK_TYPE($1, $2 long long)
|
||||
fi
|
||||
if test "$dc_cv_name" = "short"; then
|
||||
AC_CHECK_TYPE($1, $2 short)
|
||||
fi
|
||||
FOUND=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
])
|
||||
|
||||
dnl Usage:
|
||||
dnl DC_TEST_SHOBJFLAGS(shobjflags, shobjldflags, action-if-not-found)
|
||||
dnl
|
||||
AC_DEFUN(DC_TEST_SHOBJFLAGS, [
|
||||
AC_SUBST(SHOBJFLAGS)
|
||||
AC_SUBST(SHOBJLDFLAGS)
|
||||
|
||||
OLD_LDFLAGS="$LDFLAGS"
|
||||
SHOBJFLAGS=""
|
||||
|
||||
LDFLAGS="$OLD_LDFLAGS $1 $2"
|
||||
|
||||
AC_TRY_LINK([#include <stdio.h>
|
||||
int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="$1"; SHOBJLDFLAGS="$2" ], [
|
||||
LDFLAGS="$OLD_LDFLAGS"
|
||||
$3
|
||||
])
|
||||
|
||||
LDFLAGS="$OLD_LDFLAGS"
|
||||
])
|
||||
|
||||
AC_DEFUN(DC_GET_SHOBJFLAGS, [
|
||||
AC_SUBST(SHOBJFLAGS)
|
||||
AC_SUBST(SHOBJLDFLAGS)
|
||||
|
||||
AC_MSG_CHECKING(how to create shared objects)
|
||||
|
||||
if test -z "$SHOBJFLAGS" -a -z "$SHOBJLDFLAGS"; then
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -mimpure-text], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -mimpure-text], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -Wl,-G,-z,textoff], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -Wl,-G,-z,textoff], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -dynamiclib -flat_namespace -undefined suppress -bind_at_load], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress -bind_at_load], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress], [
|
||||
DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib], [
|
||||
AC_MSG_RESULT(cant)
|
||||
AC_MSG_ERROR([We are unable to make shared objects.])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS)
|
||||
|
||||
DC_SYNC_SHLIBOBJS
|
||||
])
|
||||
|
||||
AC_DEFUN(DC_SYNC_SHLIBOBJS, [
|
||||
AC_SUBST(SHLIBOBJS)
|
||||
SHLIBOBJS=""
|
||||
for obj in $LIB@&t@OBJS; do
|
||||
SHLIBOBJS="$SHLIBOBJS `echo $obj | sed 's/\.o$/_shr.o/g'`"
|
||||
done
|
||||
])
|
||||
|
||||
AC_DEFUN(DC_CHK_OS_INFO, [
|
||||
AC_CANONICAL_HOST
|
||||
AC_SUBST(SHOBJEXT)
|
||||
AC_SUBST(SHOBJFLAGS)
|
||||
AC_SUBST(SHOBJLDFLAGS)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(CPPFLAGS)
|
||||
AC_SUBST(AREXT)
|
||||
|
||||
AC_MSG_CHECKING(host operating system)
|
||||
AC_MSG_RESULT($host_os)
|
||||
|
||||
SHOBJEXT="so"
|
||||
AREXT="a"
|
||||
|
||||
case $host_os in
|
||||
darwin*)
|
||||
SHOBJEXT="dylib"
|
||||
;;
|
||||
hpux*)
|
||||
SHOBJEXT="sl"
|
||||
;;
|
||||
mingw32msvc*)
|
||||
SHOBJEXT="dll"
|
||||
SHOBJFLAGS="-DPIC"
|
||||
CFLAGS="$CFLAGS -mno-cygwin -mms-bitfields"
|
||||
CPPFLAGS="$CPPFLAGS -mno-cygwin -mms-bitfields"
|
||||
SHOBJLDFLAGS='-shared -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a'
|
||||
;;
|
||||
cygwin*)
|
||||
SHOBJEXT="dll"
|
||||
SHOBJFLAGS="-fPIC -DPIC"
|
||||
CFLAGS="$CFLAGS -mms-bitfields"
|
||||
CPPFLAGS="$CPPFLAGS -mms-bitfields"
|
||||
SHOBJLDFLAGS='-shared -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a'
|
||||
;;
|
||||
|
||||
esac
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(DC_ASK_OPTLIB, [
|
||||
AC_ARG_WITH($5, [ --with-$5 $4], [
|
||||
# Specified
|
||||
LIBSPEC=$withval
|
||||
], [
|
||||
# Not specified
|
||||
LIBSPECFLAGS=`pkg-config --libs $5 2>/dev/null`
|
||||
LIBSPECCFLAGS=`pkg-config --cflags $5 2>/dev/null`
|
||||
AC_CHECK_LIB($1, $2, [
|
||||
OLDCPPFLAGS="$CPPFLAGS"
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $LIBSPECCFLAGS"
|
||||
CFLAGS="$CFLAGS $LIBSPECCFLAGS"
|
||||
AC_CHECK_HEADER($3, [
|
||||
LIBSPEC=yes
|
||||
], [
|
||||
LIBSPEC=no
|
||||
])
|
||||
CPPFLAGS="$OLDCPPFLAGS"
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
], [
|
||||
LIBSPEC=no
|
||||
AC_MSG_WARN(Didn't find $5)
|
||||
], $LIBSPECFLAGS)
|
||||
])
|
||||
case $LIBSPEC in
|
||||
no)
|
||||
AC_MSG_WARN(Support for $5 disabled)
|
||||
;;
|
||||
*)
|
||||
if test "${LIBSPEC}" = "yes"; then
|
||||
true
|
||||
else
|
||||
LIBSPECFLAGS="-L${LIBSPEC}/lib ${LIBSPECFLAGS}"
|
||||
LIBSPECCFLAGS="-I${LIBSPEC}/include ${LIBSPECCFLAGS}"
|
||||
fi
|
||||
AC_CHECK_LIB($1, $2, [
|
||||
OLDCFLAGS="$CFLAGS"
|
||||
OLDCPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS ${LIBSPECCFLAGS}"
|
||||
CFLAGS="$CFLAGS ${LIBSPECCFLAGS}"
|
||||
AC_CHECK_HEADER($3, [
|
||||
if test -n "$7"; then
|
||||
AC_DEFINE($7, [1], [Define to 1 if you have the <$3> header file.])
|
||||
fi
|
||||
if test -n "$6"; then
|
||||
AC_DEFINE($6, [1], [Define to 1 if you have $2 from $5])
|
||||
fi
|
||||
LDFLAGS="$LDFLAGS $LIBSPECFLAGS"
|
||||
LIBS="-l$1 $LIBS"
|
||||
], [
|
||||
CFLAGS="$OLDCFLAGS"
|
||||
CPPFLAGS="$OLDCPPFLAGS"
|
||||
AC_MSG_ERROR(Could not find $3)
|
||||
])
|
||||
], [
|
||||
AC_MSG_ERROR(Could not find $5)
|
||||
], $LIBSPECFLAGS)
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
AC_DEFUN(DC_ASK_SMALL, [
|
||||
SMALL=0
|
||||
AC_ARG_ENABLE(small, AC_HELP_STRING([--enable-small], [Enable small build of libconfig. (disabled)]), [
|
||||
case $enableval in
|
||||
yes)
|
||||
SMALL=1
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
if test $SMALL = 0; then
|
||||
dnl Use opennet if it's available AND not small
|
||||
DC_ASK_OPTLIB(opennet, fopen_net, opennet.h, [ Enable opennet support (auto)], libopennet, HAVE_LIBOPENNET, HAVE_OPENNET_H)
|
||||
else
|
||||
AC_DEFINE(ENABLE_SMALL, [1], [Define to 1 if you want to produce a minimalistic build.])
|
||||
fi
|
||||
])
|
@ -1,95 +0,0 @@
|
||||
#ifndef RSK_COMPAT_H
|
||||
#define RSK_COMPAT_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
#include "win32.h"
|
||||
#endif
|
||||
|
||||
#ifndef LC_LINEBUF_LEN
|
||||
#define LC_LINEBUF_LEN 1024
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETUID
|
||||
#include "getuid.h"
|
||||
#endif
|
||||
#ifndef HAVE_STRTOLL
|
||||
#include "strtoll.h"
|
||||
#endif
|
||||
#ifndef HAVE_STRSEP
|
||||
#include "strsep.h"
|
||||
#endif
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#else
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENNET_H
|
||||
#include <opennet.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBOPENNET
|
||||
#define lc_fopen(path, mode) fopen_net(path, mode)
|
||||
#else
|
||||
#define lc_fopen(path, mode) fopen(path, mode)
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,350 +0,0 @@
|
||||
#include "compat.h"
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
#include "conf_apache.h"
|
||||
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
static int lc_process_conf_apache_file(const char *configfile, const char *pathprefix);
|
||||
|
||||
static int lc_process_conf_apache_include(const char *pathname, const char *pathprefix) {
|
||||
struct stat pathinfo;
|
||||
struct dirent *dinfo = NULL;
|
||||
char includepath[LC_LINEBUF_LEN] = {0};
|
||||
DIR *dh = NULL;
|
||||
int statret = -1, lcpcafret = -1;
|
||||
int retval = 0;
|
||||
|
||||
statret = stat(pathname, &pathinfo);
|
||||
if (statret < 0) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (S_ISDIR(pathinfo.st_mode)) {
|
||||
dh = opendir(pathname);
|
||||
if (dh == NULL) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
dinfo = readdir(dh);
|
||||
if (dinfo == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Skip files that begin with a dot ('.') */
|
||||
if (dinfo->d_name[0] == '.') continue;
|
||||
|
||||
snprintf(includepath, sizeof(includepath) - 1, "%s/%s", pathname, dinfo->d_name);
|
||||
lcpcafret = lc_process_conf_apache_include(includepath, pathprefix);
|
||||
if (lcpcafret < 0) {
|
||||
retval = -1;
|
||||
/* XXX: should we break here (abort further including of files from a directory if one fails ?) */
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dh);
|
||||
} else {
|
||||
lcpcafret = lc_process_conf_apache_file(pathname, pathprefix);
|
||||
if (lcpcafret < 0) {
|
||||
retval = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
||||
static int lc_process_conf_apache_file(const char *configfile, const char *pathprefix) {
|
||||
FILE *configfp = NULL;
|
||||
char linebuf[LC_LINEBUF_LEN] = {0}, *linebuf_ptr = NULL, *tmp_ptr = NULL;
|
||||
char *lastsection = NULL;
|
||||
char qualifbuf[LC_LINEBUF_LEN] = {0};
|
||||
char *cmd = NULL, *value = NULL, *sep = NULL, *cmdend = NULL;
|
||||
char *fgetsret = NULL;
|
||||
int lcpvret = -1, lpcafret = -1;
|
||||
int invalid_section = 0, ignore_section = 0;
|
||||
int retval = 0;
|
||||
lc_err_t save_lc_errno = LC_ERR_NONE;
|
||||
|
||||
if (pathprefix != NULL) {
|
||||
/* Copy the prefix, if specified. */
|
||||
strncpy(qualifbuf, pathprefix, sizeof(qualifbuf) - 1);
|
||||
}
|
||||
|
||||
if (configfile == NULL) {
|
||||
lc_errno = LC_ERR_INVDATA;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
configfp = lc_fopen(configfile, "r");
|
||||
|
||||
if (configfp == NULL) {
|
||||
lc_errno = LC_ERR_CANTOPEN;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
fgetsret = fgets(linebuf, sizeof(linebuf) - 1, configfp);
|
||||
if (fgetsret == NULL) {
|
||||
break;
|
||||
}
|
||||
if (feof(configfp)) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Remove trailing crap (but not spaces). */
|
||||
linebuf_ptr = &linebuf[strlen(linebuf) - 1];
|
||||
while (*linebuf_ptr < ' ' && linebuf_ptr >= linebuf) {
|
||||
*linebuf_ptr = '\0';
|
||||
linebuf_ptr--;
|
||||
}
|
||||
|
||||
/* Remove leading spaces. */
|
||||
linebuf_ptr = &linebuf[0];
|
||||
while (*linebuf_ptr == ' ' || *linebuf_ptr == '\t') {
|
||||
linebuf_ptr++;
|
||||
}
|
||||
|
||||
/* Handle section header. */
|
||||
if (linebuf_ptr[0] == '<' && linebuf_ptr[strlen(linebuf_ptr) - 1] == '>') {
|
||||
/* Remove < and > from around the data. */
|
||||
linebuf_ptr[strlen(linebuf_ptr) - 1] = '\0';
|
||||
linebuf_ptr++;
|
||||
|
||||
/* Lowercase the command part of the section. */
|
||||
tmp_ptr = linebuf_ptr;
|
||||
while (*tmp_ptr != '\0' && *tmp_ptr != ' ') {
|
||||
*tmp_ptr = tolower(*tmp_ptr);
|
||||
tmp_ptr++;
|
||||
}
|
||||
|
||||
/* If this is a close section command, handle it */
|
||||
if (linebuf_ptr[0] == '/') {
|
||||
linebuf_ptr++;
|
||||
cmd = linebuf_ptr;
|
||||
|
||||
/* Find the last section closed. */
|
||||
tmp_ptr = strrchr(qualifbuf, '.');
|
||||
if (tmp_ptr == NULL) {
|
||||
lastsection = qualifbuf;
|
||||
tmp_ptr = qualifbuf;
|
||||
} else {
|
||||
lastsection = tmp_ptr + 1;
|
||||
}
|
||||
|
||||
if (strcmp(cmd, lastsection) != 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Section closing does not match last opened section.\n");
|
||||
fprintf(stderr, "Last opened = \"%s\", Closing = \"%s\"\n", lastsection, cmd);
|
||||
#endif
|
||||
retval = -1;
|
||||
lc_errno = LC_ERR_BADFORMAT;
|
||||
|
||||
/* For this error, we abort immediately. */
|
||||
break;
|
||||
}
|
||||
|
||||
lcpvret = lc_process_var(qualifbuf, NULL, NULL, LC_FLAGS_SECTIONEND);
|
||||
if (lcpvret < 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid section terminating: \"%s\"\n", qualifbuf);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Remove the "lastsection" part.. */
|
||||
*tmp_ptr = '\0';
|
||||
|
||||
/* We just sucessfully closed the last section opened,
|
||||
we must be in a valid section now since we only open
|
||||
sections from within valid sections. */
|
||||
invalid_section = 0;
|
||||
ignore_section = 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
/* Otherwise, open a new section. */
|
||||
|
||||
/* Don't open a section from an invalid section. */
|
||||
if (invalid_section == 1 || ignore_section == 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Parse out any argument passed. */
|
||||
sep = strpbrk(linebuf_ptr, " \t");
|
||||
|
||||
if (sep != NULL) {
|
||||
cmdend = sep;
|
||||
/* Delete space at the end of the command. */
|
||||
cmdend--; /* It currently derefs to the seperator.. */
|
||||
while (*cmdend <= ' ') {
|
||||
*cmdend = '\0';
|
||||
cmdend--;
|
||||
}
|
||||
|
||||
/* Delete the seperator char and any leading space. */
|
||||
*sep = '\0';
|
||||
sep++;
|
||||
while (*sep == ' ' || *sep == '\t') {
|
||||
sep++;
|
||||
}
|
||||
value = sep;
|
||||
} else {
|
||||
/* XXX: should this be "" or NULL ? */
|
||||
value = "";
|
||||
}
|
||||
|
||||
cmd = linebuf_ptr;
|
||||
|
||||
if (qualifbuf[0] != '\0') {
|
||||
strncat(qualifbuf, ".", sizeof(qualifbuf) - strlen(qualifbuf) - 1);
|
||||
}
|
||||
strncat(qualifbuf, cmd, sizeof(qualifbuf) - strlen(qualifbuf) - 1);
|
||||
|
||||
lcpvret = lc_process_var(qualifbuf, value, NULL, LC_FLAGS_SECTIONSTART);
|
||||
if (lcpvret < 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid section: \"%s\"\n", qualifbuf);
|
||||
#endif
|
||||
invalid_section = 1;
|
||||
lc_errno = LC_ERR_INVSECTION;
|
||||
retval = -1;
|
||||
}
|
||||
if (lcpvret == LC_CBRET_IGNORESECTION) {
|
||||
ignore_section = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Drop comments and blank lines. */
|
||||
if (*linebuf_ptr == '#' || *linebuf_ptr == '\0') {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Don't handle things for a section that doesn't exist. */
|
||||
if (invalid_section == 1) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Ignoring line (because invalid section): %s\n", linebuf);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
if (ignore_section == 1) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Ignoring line (because ignored section): %s\n", linebuf);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find the command and the data in the line. */
|
||||
sep = strpbrk(linebuf_ptr, " \t");
|
||||
if (sep != NULL) {
|
||||
cmdend = sep;
|
||||
|
||||
/* Delete space at the end of the command. */
|
||||
cmdend--; /* It currently derefs to the seperator.. */
|
||||
while (*cmdend <= ' ') {
|
||||
*cmdend = '\0';
|
||||
cmdend--;
|
||||
}
|
||||
|
||||
/* Delete the seperator char and any leading space. */
|
||||
*sep = '\0';
|
||||
sep++;
|
||||
while (*sep == ' ' || *sep == '\t') {
|
||||
sep++;
|
||||
}
|
||||
value = sep;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
||||
cmd = linebuf_ptr;
|
||||
|
||||
/* Handle special commands. */
|
||||
if (strcasecmp(cmd, "include") == 0) {
|
||||
if (value == NULL) {
|
||||
lc_errno = LC_ERR_BADFORMAT;
|
||||
retval = -1;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid include command.\n");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
lpcafret = lc_process_conf_apache_include(value, qualifbuf);
|
||||
if (lpcafret < 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Error in included file.\n");
|
||||
#endif
|
||||
retval = -1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Create the fully qualified variable name. */
|
||||
if (qualifbuf[0] != '\0') {
|
||||
strncat(qualifbuf, ".", sizeof(qualifbuf) - strlen(qualifbuf) - 1);
|
||||
}
|
||||
strncat(qualifbuf, cmd, sizeof(qualifbuf) - strlen(qualifbuf) - 1);
|
||||
|
||||
/* Call the parent and tell them we have data. */
|
||||
save_lc_errno = lc_errno;
|
||||
lc_errno = LC_ERR_NONE;
|
||||
lcpvret = lc_process_var(qualifbuf, NULL, value, LC_FLAGS_VAR);
|
||||
if (lcpvret < 0) {
|
||||
if (lc_errno == LC_ERR_NONE) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid command: \"%s\"\n", cmd);
|
||||
#endif
|
||||
lc_errno = LC_ERR_INVCMD;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Error processing command (command was valid, but an error occured, errno was set)\n");
|
||||
#endif
|
||||
}
|
||||
retval = -1;
|
||||
} else {
|
||||
lc_errno = save_lc_errno;
|
||||
}
|
||||
|
||||
/* Remove the "cmd" part of the buffer. */
|
||||
tmp_ptr = strrchr(qualifbuf, '.');
|
||||
if (tmp_ptr == NULL) {
|
||||
tmp_ptr = qualifbuf;
|
||||
}
|
||||
*tmp_ptr = '\0';
|
||||
}
|
||||
|
||||
fclose(configfp);
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
||||
int lc_process_conf_apache(const char *appname, const char *configfile) {
|
||||
return(lc_process_conf_apache_file(configfile, NULL));
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#ifndef LC_CONF_APACHE_H
|
||||
#define LC_CONF_APACHE_H
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
|
||||
int lc_process_conf_apache(const char *appname, const char *configfile);
|
||||
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
#include "conf_colon.h"
|
||||
|
||||
int lc_process_conf_colon(const char *appname, const char *configfile) {
|
||||
return(-1);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#ifndef LC_CONF_COLON_H
|
||||
#define LC_CONF_COLON_H
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
|
||||
int lc_process_conf_colon(const char *appname, const char *configfile);
|
||||
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
#include "conf_equal.h"
|
||||
|
||||
int lc_process_conf_equal(const char *appname, const char *configfile) {
|
||||
return(-1);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#ifndef LC_CONF_EQUAL_H
|
||||
#define LC_CONF_EQUAL_H
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
|
||||
int lc_process_conf_equal(const char *appname, const char *configfile);
|
||||
|
||||
#endif
|
@ -1,186 +0,0 @@
|
||||
#include "compat.h"
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
#include "conf_section.h"
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
int lc_process_conf_section(const char *appname, const char *configfile) {
|
||||
FILE *configfp = NULL;
|
||||
char linebuf[LC_LINEBUF_LEN] = {0}, *linebuf_ptr = NULL;
|
||||
char qualifbuf[LC_LINEBUF_LEN] = {0};
|
||||
char *cmd = NULL, *value = NULL, *sep = NULL, *cmdend = NULL;
|
||||
char *currsection = NULL;
|
||||
char *fgetsret = NULL;
|
||||
int lcpvret = -1;
|
||||
int invalid_section = 1, ignore_section = 0;
|
||||
int retval = 0;
|
||||
lc_err_t save_lc_errno = LC_ERR_NONE;
|
||||
|
||||
if (appname == NULL || configfile == NULL) {
|
||||
lc_errno = LC_ERR_INVDATA;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
configfp = lc_fopen(configfile, "r");
|
||||
|
||||
if (configfp == NULL) {
|
||||
lc_errno = LC_ERR_CANTOPEN;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
fgetsret = fgets(linebuf, sizeof(linebuf) - 1, configfp);
|
||||
if (fgetsret == NULL) {
|
||||
break;
|
||||
}
|
||||
if (feof(configfp)) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Remove trailing crap (but not spaces). */
|
||||
linebuf_ptr = &linebuf[strlen(linebuf) - 1];
|
||||
while (*linebuf_ptr < ' ' && linebuf_ptr >= linebuf) {
|
||||
*linebuf_ptr = '\0';
|
||||
linebuf_ptr--;
|
||||
}
|
||||
|
||||
/* Handle section header. */
|
||||
if (linebuf[0] == '[' && linebuf[strlen(linebuf) - 1] == ']') {
|
||||
linebuf[strlen(linebuf) - 1] = '\0';
|
||||
linebuf_ptr = &linebuf[1];
|
||||
|
||||
/* If a section was open, close it. */
|
||||
if (currsection != NULL) {
|
||||
lcpvret = lc_process_var(currsection, NULL, NULL, LC_FLAGS_SECTIONEND);
|
||||
if (lcpvret < 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid section terminating: \"%s\"\n", currsection);
|
||||
#endif
|
||||
}
|
||||
free(currsection);
|
||||
}
|
||||
|
||||
/* Open new section. */
|
||||
currsection = strdup(linebuf_ptr);
|
||||
lcpvret = lc_process_var(currsection, NULL, NULL, LC_FLAGS_SECTIONSTART);
|
||||
if (lcpvret < 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid section: \"%s\"\n", currsection);
|
||||
#endif
|
||||
invalid_section = 1;
|
||||
lc_errno = LC_ERR_INVSECTION;
|
||||
retval = -1;
|
||||
} else {
|
||||
invalid_section = 0;
|
||||
ignore_section = 0;
|
||||
}
|
||||
|
||||
if (lcpvret == LC_CBRET_IGNORESECTION) {
|
||||
ignore_section = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Remove leading spaces. */
|
||||
linebuf_ptr = &linebuf[0];
|
||||
while (*linebuf_ptr == ' ') {
|
||||
linebuf_ptr++;
|
||||
}
|
||||
|
||||
/* Drop comments and blank lines. */
|
||||
if (*linebuf_ptr == ';' || *linebuf_ptr == '\0') {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Don't handle things for a section that doesn't exist. */
|
||||
if (invalid_section == 1) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Ignoring line (because invalid section): %s\n", linebuf);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Don't process commands if this section is specifically ignored. */
|
||||
if (ignore_section == 1) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Ignoring line (because ignored section): %s\n", linebuf);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find the command and the data in the line. */
|
||||
cmdend = sep = strpbrk(linebuf_ptr, "=");
|
||||
if (sep == NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid line: \"%s\"\n", linebuf);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Delete space at the end of the command. */
|
||||
cmdend--; /* It currently derefs to the seperator.. */
|
||||
while (*cmdend <= ' ') {
|
||||
*cmdend = '\0';
|
||||
cmdend--;
|
||||
}
|
||||
|
||||
cmd = linebuf_ptr;
|
||||
|
||||
/* Delete the seperator char and any leading space. */
|
||||
*sep = '\0';
|
||||
sep++;
|
||||
while (*sep == ' ' || *sep == '\t') {
|
||||
sep++;
|
||||
}
|
||||
value = sep;
|
||||
|
||||
/* Create the fully qualified variable name. */
|
||||
if (currsection == NULL) {
|
||||
strncpy(qualifbuf, cmd, sizeof(qualifbuf) - 1);
|
||||
} else {
|
||||
snprintf(qualifbuf, sizeof(qualifbuf) - 1, "%s.%s", currsection, cmd);
|
||||
}
|
||||
|
||||
/* Call the parent and tell them we have data. */
|
||||
save_lc_errno = lc_errno;
|
||||
lc_errno = LC_ERR_NONE;
|
||||
lcpvret = lc_process_var(qualifbuf, NULL, value, LC_FLAGS_VAR);
|
||||
if (lcpvret < 0) {
|
||||
if (lc_errno == LC_ERR_NONE) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid command: \"%s\"\n", cmd);
|
||||
#endif
|
||||
lc_errno = LC_ERR_INVCMD;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Error processing command (command was valid, but an error occured, errno was set)\n");
|
||||
#endif
|
||||
}
|
||||
retval = -1;
|
||||
} else {
|
||||
lc_errno = save_lc_errno;
|
||||
}
|
||||
}
|
||||
|
||||
/* Close any open section, and clean-up. */
|
||||
if (currsection != NULL) {
|
||||
lcpvret = lc_process_var(currsection, NULL, NULL, LC_FLAGS_SECTIONEND);
|
||||
if (lcpvret < 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid section terminating: \"%s\"\n", currsection);
|
||||
#endif
|
||||
}
|
||||
free(currsection);
|
||||
}
|
||||
|
||||
fclose(configfp);
|
||||
|
||||
return(retval);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#ifndef LC_CONF_SECTION_H
|
||||
#define LC_CONF_SECTION_H
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
|
||||
int lc_process_conf_section(const char *appname, const char *configfile);
|
||||
|
||||
#endif
|
@ -1,96 +0,0 @@
|
||||
#include "compat.h"
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
#include "conf_space.h"
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
int lc_process_conf_space(const char *appname, const char *configfile) {
|
||||
FILE *configfp = NULL;
|
||||
char linebuf[LC_LINEBUF_LEN] = {0}, *linebuf_ptr = NULL;
|
||||
char *cmd = NULL, *value = NULL, *sep = NULL;
|
||||
char *fgetsret = NULL;
|
||||
int lcpvret = -1;
|
||||
int retval = 0;
|
||||
lc_err_t save_lc_errno = LC_ERR_NONE;
|
||||
|
||||
if (appname == NULL || configfile == NULL) {
|
||||
lc_errno = LC_ERR_INVDATA;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
configfp = lc_fopen(configfile, "r");
|
||||
|
||||
if (configfp == NULL) {
|
||||
lc_errno = LC_ERR_CANTOPEN;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
fgetsret = fgets(linebuf, sizeof(linebuf) - 1, configfp);
|
||||
if (fgetsret == NULL) {
|
||||
break;
|
||||
}
|
||||
if (feof(configfp)) {
|
||||
break;
|
||||
}
|
||||
|
||||
linebuf_ptr = &linebuf[strlen(linebuf) - 1];
|
||||
while (*linebuf_ptr < ' ' && linebuf_ptr >= linebuf) {
|
||||
*linebuf_ptr = '\0';
|
||||
linebuf_ptr--;
|
||||
}
|
||||
|
||||
linebuf_ptr = &linebuf[0];
|
||||
while (*linebuf_ptr == ' ') {
|
||||
linebuf_ptr++;
|
||||
}
|
||||
|
||||
if (*linebuf_ptr == '#' || *linebuf_ptr == '\0') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
sep = strpbrk(linebuf_ptr, " \t");
|
||||
cmd = linebuf_ptr;
|
||||
if (sep != NULL) {
|
||||
*sep = '\0';
|
||||
sep++;
|
||||
while (*sep == ' ' || *sep == '\t') {
|
||||
sep++;
|
||||
}
|
||||
value = sep;
|
||||
} else {
|
||||
value = NULL;
|
||||
}
|
||||
|
||||
save_lc_errno = lc_errno;
|
||||
lc_errno = LC_ERR_NONE;
|
||||
lcpvret = lc_process_var(cmd, NULL, value, LC_FLAGS_VAR);
|
||||
if (lcpvret < 0) {
|
||||
if (lc_errno == LC_ERR_NONE) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Invalid command: \"%s\"\n", cmd);
|
||||
#endif
|
||||
lc_errno = LC_ERR_INVCMD;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Error processing command (command was valid, but an error occured, errno was set)\n");
|
||||
#endif
|
||||
}
|
||||
retval = -1;
|
||||
} else {
|
||||
lc_errno = save_lc_errno;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(configfp);
|
||||
|
||||
return(retval);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#ifndef LC_CONF_SPACE_H
|
||||
#define LC_CONF_SPACE_H
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
|
||||
int lc_process_conf_space(const char *appname, const char *configfile);
|
||||
|
||||
#endif
|
@ -1,7 +0,0 @@
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
#include "conf_xml.h"
|
||||
|
||||
int lc_process_conf_xml(const char *appname, const char *configfile) {
|
||||
return(-1);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#ifndef LC_CONF_XML_H
|
||||
#define LC_CONF_XML_H
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
|
||||
int lc_process_conf_xml(const char *appname, const char *configfile);
|
||||
|
||||
#endif
|
1459
sftp_server/libconfig/config.guess
поставляемый
1459
sftp_server/libconfig/config.guess
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,138 +0,0 @@
|
||||
/* config.h. Generated by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you want to produce a minimalistic build. */
|
||||
/* #undef ENABLE_SMALL */
|
||||
|
||||
/* Define to 1 if you have the <ctype.h> header file. */
|
||||
#define HAVE_CTYPE_H 1
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file. */
|
||||
#define HAVE_DIRENT_H 1
|
||||
|
||||
/* Define to 1 if you have the `getpwuid' function. */
|
||||
#define HAVE_GETPWUID 1
|
||||
|
||||
/* Define to 1 if you have the `getuid' function. */
|
||||
#define HAVE_GETUID 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have fopen_net from libopennet */
|
||||
/* #undef HAVE_LIBOPENNET */
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the <opennet.h> header file. */
|
||||
/* #undef HAVE_OPENNET_H */
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#define HAVE_PWD_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#define HAVE_STDIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strsep' function. */
|
||||
#define HAVE_STRSEP 1
|
||||
|
||||
/* Define to 1 if you have the `strtoll' function. */
|
||||
#define HAVE_STRTOLL 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the <windowsx.h> header file. */
|
||||
/* #undef HAVE_WINDOWSX_H */
|
||||
|
||||
/* Define to 1 if you have the <windows.h> header file. */
|
||||
/* #undef HAVE_WINDOWS_H */
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "libconfig"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libconfig 0.1.16"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libconfig"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "0.1.16"
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG 8
|
||||
|
||||
/* The size of a `long long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* The size of a `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define to 1 if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
/* # undef _ALL_SOURCE */
|
||||
#endif
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
/* #undef inline */
|
||||
#endif
|
||||
|
||||
/* Define to `signed short' if <sys/types.h> does not define. */
|
||||
/* #undef int16_t */
|
||||
|
||||
/* Define to `signed short' if <sys/types.h> does not define. */
|
||||
/* #undef int32_t */
|
||||
|
||||
/* Define to `signed short' if <sys/types.h> does not define. */
|
||||
/* #undef int64_t */
|
||||
|
||||
/* Define to `unsigned short' if <sys/types.h> does not define. */
|
||||
/* #undef uint16_t */
|
||||
|
||||
/* Define to `unsigned short' if <sys/types.h> does not define. */
|
||||
/* #undef uint32_t */
|
||||
|
||||
/* Define to `unsigned short' if <sys/types.h> does not define. */
|
||||
/* #undef uint64_t */
|
@ -1,137 +0,0 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you want to produce a minimalistic build. */
|
||||
#undef ENABLE_SMALL
|
||||
|
||||
/* Define to 1 if you have the <ctype.h> header file. */
|
||||
#undef HAVE_CTYPE_H
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the `getpwuid' function. */
|
||||
#undef HAVE_GETPWUID
|
||||
|
||||
/* Define to 1 if you have the `getuid' function. */
|
||||
#undef HAVE_GETUID
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have fopen_net from libopennet */
|
||||
#undef HAVE_LIBOPENNET
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <opennet.h> header file. */
|
||||
#undef HAVE_OPENNET_H
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#undef HAVE_STDIO_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strsep' function. */
|
||||
#undef HAVE_STRSEP
|
||||
|
||||
/* Define to 1 if you have the `strtoll' function. */
|
||||
#undef HAVE_STRTOLL
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#undef HAVE_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the <windowsx.h> header file. */
|
||||
#undef HAVE_WINDOWSX_H
|
||||
|
||||
/* Define to 1 if you have the <windows.h> header file. */
|
||||
#undef HAVE_WINDOWS_H
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of a `long long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG_LONG
|
||||
|
||||
/* The size of a `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define to 1 if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to `signed short' if <sys/types.h> does not define. */
|
||||
#undef int16_t
|
||||
|
||||
/* Define to `signed short' if <sys/types.h> does not define. */
|
||||
#undef int32_t
|
||||
|
||||
/* Define to `signed short' if <sys/types.h> does not define. */
|
||||
#undef int64_t
|
||||
|
||||
/* Define to `unsigned short' if <sys/types.h> does not define. */
|
||||
#undef uint16_t
|
||||
|
||||
/* Define to `unsigned short' if <sys/types.h> does not define. */
|
||||
#undef uint32_t
|
||||
|
||||
/* Define to `unsigned short' if <sys/types.h> does not define. */
|
||||
#undef uint64_t
|
@ -1,994 +0,0 @@
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by libconfig configure 0.1.16, which was
|
||||
generated by GNU Autoconf 2.59. Invocation command line was
|
||||
|
||||
$ ./configure
|
||||
|
||||
## --------- ##
|
||||
## Platform. ##
|
||||
## --------- ##
|
||||
|
||||
hostname = darkside
|
||||
uname -m = x86_64
|
||||
uname -r = 2.6.11-gentoo-r11
|
||||
uname -s = Linux
|
||||
uname -v = #1 Wed Jun 15 23:29:57 UTC 2005
|
||||
|
||||
/usr/bin/uname -p = AMD Athlon 64 Processor 3400+
|
||||
/bin/uname -X = unknown
|
||||
|
||||
/bin/arch = x86_64
|
||||
/usr/bin/arch -k = unknown
|
||||
/usr/convex/getsysinfo = unknown
|
||||
hostinfo = unknown
|
||||
/bin/machine = unknown
|
||||
/usr/bin/oslevel = unknown
|
||||
/bin/universe = unknown
|
||||
|
||||
PATH: /usr/local/bin
|
||||
PATH: /usr/bin
|
||||
PATH: /bin
|
||||
PATH: /opt/bin
|
||||
PATH: /usr/x86_64-pc-linux-gnu/gcc-bin/3.4.4
|
||||
PATH: /opt/blackdown-jdk-1.4.2.02/bin
|
||||
PATH: /opt/blackdown-jdk-1.4.2.02/jre/bin
|
||||
PATH: /usr/qt/3/bin
|
||||
PATH: /usr/kde/3.4/bin
|
||||
PATH: /usr/kde/3.3/bin
|
||||
PATH: /usr/games/bin
|
||||
PATH: /opt/vmware/bin
|
||||
|
||||
|
||||
## ----------- ##
|
||||
## Core tests. ##
|
||||
## ----------- ##
|
||||
|
||||
configure:1347: checking build system type
|
||||
configure:1365: result: x86_64-unknown-linux-gnu
|
||||
configure:1374: checking host system type
|
||||
configure:1388: result: x86_64-unknown-linux-gnu
|
||||
configure:1403: checking host operating system
|
||||
configure:1405: result: linux-gnu
|
||||
configure:1482: checking for gcc
|
||||
configure:1498: found /usr/bin/gcc
|
||||
configure:1508: result: gcc
|
||||
configure:1752: checking for C compiler version
|
||||
configure:1755: gcc --version </dev/null >&5
|
||||
gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
configure:1758: $? = 0
|
||||
configure:1760: gcc -v </dev/null >&5
|
||||
Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/specs
|
||||
Configured with: /var/tmp/portage/gcc-3.4.4-r1/work/gcc-3.4.4/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/3.4.4 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.4 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.4/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.4/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/include/g++-v3 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --enable-multilib --disable-libgcj --enable-languages=c,c++,f77 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
|
||||
Thread model: posix
|
||||
gcc version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
|
||||
configure:1763: $? = 0
|
||||
configure:1765: gcc -V </dev/null >&5
|
||||
gcc: `-V' option must have argument
|
||||
configure:1768: $? = 1
|
||||
configure:1791: checking for C compiler default output file name
|
||||
configure:1794: gcc conftest.c >&5
|
||||
configure:1797: $? = 0
|
||||
configure:1843: result: a.out
|
||||
configure:1848: checking whether the C compiler works
|
||||
configure:1854: ./a.out
|
||||
configure:1857: $? = 0
|
||||
configure:1874: result: yes
|
||||
configure:1881: checking whether we are cross compiling
|
||||
configure:1883: result: no
|
||||
configure:1886: checking for suffix of executables
|
||||
configure:1888: gcc -o conftest conftest.c >&5
|
||||
configure:1891: $? = 0
|
||||
configure:1916: result:
|
||||
configure:1922: checking for suffix of object files
|
||||
configure:1943: gcc -c conftest.c >&5
|
||||
configure:1946: $? = 0
|
||||
configure:1968: result: o
|
||||
configure:1972: checking whether we are using the GNU C compiler
|
||||
configure:1996: gcc -c conftest.c >&5
|
||||
configure:2002: $? = 0
|
||||
configure:2006: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:2009: $? = 0
|
||||
configure:2012: test -s conftest.o
|
||||
configure:2015: $? = 0
|
||||
configure:2028: result: yes
|
||||
configure:2034: checking whether gcc accepts -g
|
||||
configure:2055: gcc -c -g conftest.c >&5
|
||||
configure:2061: $? = 0
|
||||
configure:2065: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:2068: $? = 0
|
||||
configure:2071: test -s conftest.o
|
||||
configure:2074: $? = 0
|
||||
configure:2085: result: yes
|
||||
configure:2102: checking for gcc option to accept ANSI C
|
||||
configure:2172: gcc -c -g -O2 conftest.c >&5
|
||||
configure:2178: $? = 0
|
||||
configure:2182: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:2185: $? = 0
|
||||
configure:2188: test -s conftest.o
|
||||
configure:2191: $? = 0
|
||||
configure:2209: result: none needed
|
||||
configure:2227: gcc -c -g -O2 conftest.c >&5
|
||||
conftest.c:2: error: parse error before "me"
|
||||
configure:2233: $? = 1
|
||||
configure: failed program was:
|
||||
| #ifndef __cplusplus
|
||||
| choke me
|
||||
| #endif
|
||||
configure:2366: checking whether make sets $(MAKE)
|
||||
configure:2386: result: yes
|
||||
configure:2408: checking for a BSD-compatible install
|
||||
configure:2463: result: /usr/bin/install -c
|
||||
configure:2474: checking whether ln -s works
|
||||
configure:2478: result: yes
|
||||
configure:2526: checking for ranlib
|
||||
configure:2542: found /usr/bin/ranlib
|
||||
configure:2553: result: ranlib
|
||||
configure:2571: checking how to run the C preprocessor
|
||||
configure:2606: gcc -E conftest.c
|
||||
configure:2612: $? = 0
|
||||
configure:2644: gcc -E conftest.c
|
||||
conftest.c:9:28: ac_nonexistent.h: No such file or directory
|
||||
configure:2650: $? = 1
|
||||
configure: failed program was:
|
||||
| /* confdefs.h. */
|
||||
|
|
||||
| #define PACKAGE_NAME "libconfig"
|
||||
| #define PACKAGE_TARNAME "libconfig"
|
||||
| #define PACKAGE_VERSION "0.1.16"
|
||||
| #define PACKAGE_STRING "libconfig 0.1.16"
|
||||
| #define PACKAGE_BUGREPORT ""
|
||||
| /* end confdefs.h. */
|
||||
| #include <ac_nonexistent.h>
|
||||
configure:2689: result: gcc -E
|
||||
configure:2713: gcc -E conftest.c
|
||||
configure:2719: $? = 0
|
||||
configure:2751: gcc -E conftest.c
|
||||
conftest.c:9:28: ac_nonexistent.h: No such file or directory
|
||||
configure:2757: $? = 1
|
||||
configure: failed program was:
|
||||
| /* confdefs.h. */
|
||||
|
|
||||
| #define PACKAGE_NAME "libconfig"
|
||||
| #define PACKAGE_TARNAME "libconfig"
|
||||
| #define PACKAGE_VERSION "0.1.16"
|
||||
| #define PACKAGE_STRING "libconfig 0.1.16"
|
||||
| #define PACKAGE_BUGREPORT ""
|
||||
| /* end confdefs.h. */
|
||||
| #include <ac_nonexistent.h>
|
||||
configure:2801: checking for egrep
|
||||
configure:2811: result: grep -E
|
||||
configure:2817: checking for AIX
|
||||
configure:2839: result: no
|
||||
configure:2886: checking for ar
|
||||
configure:2902: found /usr/bin/ar
|
||||
configure:2913: result: ar
|
||||
configure:2926: checking for ANSI C header files
|
||||
configure:2951: gcc -c -g -O2 conftest.c >&5
|
||||
configure:2957: $? = 0
|
||||
configure:2961: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:2964: $? = 0
|
||||
configure:2967: test -s conftest.o
|
||||
configure:2970: $? = 0
|
||||
configure:3059: gcc -o conftest -g -O2 conftest.c >&5
|
||||
configure:3062: $? = 0
|
||||
configure:3064: ./conftest
|
||||
configure:3067: $? = 0
|
||||
configure:3082: result: yes
|
||||
configure:3106: checking for sys/types.h
|
||||
configure:3122: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3128: $? = 0
|
||||
configure:3132: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3135: $? = 0
|
||||
configure:3138: test -s conftest.o
|
||||
configure:3141: $? = 0
|
||||
configure:3152: result: yes
|
||||
configure:3106: checking for sys/stat.h
|
||||
configure:3122: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3128: $? = 0
|
||||
configure:3132: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3135: $? = 0
|
||||
configure:3138: test -s conftest.o
|
||||
configure:3141: $? = 0
|
||||
configure:3152: result: yes
|
||||
configure:3106: checking for stdlib.h
|
||||
configure:3122: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3128: $? = 0
|
||||
configure:3132: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3135: $? = 0
|
||||
configure:3138: test -s conftest.o
|
||||
configure:3141: $? = 0
|
||||
configure:3152: result: yes
|
||||
configure:3106: checking for string.h
|
||||
configure:3122: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3128: $? = 0
|
||||
configure:3132: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3135: $? = 0
|
||||
configure:3138: test -s conftest.o
|
||||
configure:3141: $? = 0
|
||||
configure:3152: result: yes
|
||||
configure:3106: checking for memory.h
|
||||
configure:3122: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3128: $? = 0
|
||||
configure:3132: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3135: $? = 0
|
||||
configure:3138: test -s conftest.o
|
||||
configure:3141: $? = 0
|
||||
configure:3152: result: yes
|
||||
configure:3106: checking for strings.h
|
||||
configure:3122: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3128: $? = 0
|
||||
configure:3132: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3135: $? = 0
|
||||
configure:3138: test -s conftest.o
|
||||
configure:3141: $? = 0
|
||||
configure:3152: result: yes
|
||||
configure:3106: checking for inttypes.h
|
||||
configure:3122: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3128: $? = 0
|
||||
configure:3132: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3135: $? = 0
|
||||
configure:3138: test -s conftest.o
|
||||
configure:3141: $? = 0
|
||||
configure:3152: result: yes
|
||||
configure:3106: checking for stdint.h
|
||||
configure:3122: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3128: $? = 0
|
||||
configure:3132: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3135: $? = 0
|
||||
configure:3138: test -s conftest.o
|
||||
configure:3141: $? = 0
|
||||
configure:3152: result: yes
|
||||
configure:3106: checking for unistd.h
|
||||
configure:3122: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3128: $? = 0
|
||||
configure:3132: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3135: $? = 0
|
||||
configure:3138: test -s conftest.o
|
||||
configure:3141: $? = 0
|
||||
configure:3152: result: yes
|
||||
configure:3166: checking for inline
|
||||
configure:3187: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3193: $? = 0
|
||||
configure:3197: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3200: $? = 0
|
||||
configure:3203: test -s conftest.o
|
||||
configure:3206: $? = 0
|
||||
configure:3218: result: inline
|
||||
configure:3237: checking for long long
|
||||
configure:3261: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3267: $? = 0
|
||||
configure:3271: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3274: $? = 0
|
||||
configure:3277: test -s conftest.o
|
||||
configure:3280: $? = 0
|
||||
configure:3291: result: yes
|
||||
configure:3294: checking size of long long
|
||||
configure:3613: gcc -o conftest -g -O2 conftest.c >&5
|
||||
configure:3616: $? = 0
|
||||
configure:3618: ./conftest
|
||||
configure:3621: $? = 0
|
||||
configure:3644: result: 8
|
||||
configure:3651: checking for long
|
||||
configure:3675: gcc -c -g -O2 conftest.c >&5
|
||||
configure:3681: $? = 0
|
||||
configure:3685: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:3688: $? = 0
|
||||
configure:3691: test -s conftest.o
|
||||
configure:3694: $? = 0
|
||||
configure:3705: result: yes
|
||||
configure:3708: checking size of long
|
||||
configure:4027: gcc -o conftest -g -O2 conftest.c >&5
|
||||
configure:4030: $? = 0
|
||||
configure:4032: ./conftest
|
||||
configure:4035: $? = 0
|
||||
configure:4058: result: 8
|
||||
configure:4065: checking for int
|
||||
configure:4089: gcc -c -g -O2 conftest.c >&5
|
||||
configure:4095: $? = 0
|
||||
configure:4099: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:4102: $? = 0
|
||||
configure:4105: test -s conftest.o
|
||||
configure:4108: $? = 0
|
||||
configure:4119: result: yes
|
||||
configure:4122: checking size of int
|
||||
configure:4441: gcc -o conftest -g -O2 conftest.c >&5
|
||||
configure:4444: $? = 0
|
||||
configure:4446: ./conftest
|
||||
configure:4449: $? = 0
|
||||
configure:4472: result: 4
|
||||
configure:4479: checking for short
|
||||
configure:4503: gcc -c -g -O2 conftest.c >&5
|
||||
configure:4509: $? = 0
|
||||
configure:4513: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:4516: $? = 0
|
||||
configure:4519: test -s conftest.o
|
||||
configure:4522: $? = 0
|
||||
configure:4533: result: yes
|
||||
configure:4536: checking size of short
|
||||
configure:4855: gcc -o conftest -g -O2 conftest.c >&5
|
||||
configure:4858: $? = 0
|
||||
configure:4860: ./conftest
|
||||
configure:4863: $? = 0
|
||||
configure:4886: result: 2
|
||||
configure:5036: checking for uint64_t
|
||||
configure:5060: gcc -c -g -O2 conftest.c >&5
|
||||
configure:5066: $? = 0
|
||||
configure:5070: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:5073: $? = 0
|
||||
configure:5076: test -s conftest.o
|
||||
configure:5079: $? = 0
|
||||
configure:5090: result: yes
|
||||
configure:7048: checking for int64_t
|
||||
configure:7072: gcc -c -g -O2 conftest.c >&5
|
||||
configure:7078: $? = 0
|
||||
configure:7082: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:7085: $? = 0
|
||||
configure:7088: test -s conftest.o
|
||||
configure:7091: $? = 0
|
||||
configure:7102: result: yes
|
||||
configure:8924: checking for uint32_t
|
||||
configure:8948: gcc -c -g -O2 conftest.c >&5
|
||||
configure:8954: $? = 0
|
||||
configure:8958: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:8961: $? = 0
|
||||
configure:8964: test -s conftest.o
|
||||
configure:8967: $? = 0
|
||||
configure:8978: result: yes
|
||||
configure:10936: checking for int32_t
|
||||
configure:10960: gcc -c -g -O2 conftest.c >&5
|
||||
configure:10966: $? = 0
|
||||
configure:10970: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:10973: $? = 0
|
||||
configure:10976: test -s conftest.o
|
||||
configure:10979: $? = 0
|
||||
configure:10990: result: yes
|
||||
configure:13152: checking for uint16_t
|
||||
configure:13176: gcc -c -g -O2 conftest.c >&5
|
||||
configure:13182: $? = 0
|
||||
configure:13186: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:13189: $? = 0
|
||||
configure:13192: test -s conftest.o
|
||||
configure:13195: $? = 0
|
||||
configure:13206: result: yes
|
||||
configure:15164: checking for int16_t
|
||||
configure:15188: gcc -c -g -O2 conftest.c >&5
|
||||
configure:15194: $? = 0
|
||||
configure:15198: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:15201: $? = 0
|
||||
configure:15204: test -s conftest.o
|
||||
configure:15207: $? = 0
|
||||
configure:15218: result: yes
|
||||
configure:15266: checking for fopen_net in -lopennet
|
||||
configure:15296: gcc -o conftest -g -O2 conftest.c -lopennet >&5
|
||||
/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lopennet
|
||||
collect2: ld returned 1 exit status
|
||||
configure:15302: $? = 1
|
||||
configure: failed program was:
|
||||
| /* confdefs.h. */
|
||||
|
|
||||
| #define PACKAGE_NAME "libconfig"
|
||||
| #define PACKAGE_TARNAME "libconfig"
|
||||
| #define PACKAGE_VERSION "0.1.16"
|
||||
| #define PACKAGE_STRING "libconfig 0.1.16"
|
||||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define STDC_HEADERS 1
|
||||
| #define HAVE_SYS_TYPES_H 1
|
||||
| #define HAVE_SYS_STAT_H 1
|
||||
| #define HAVE_STDLIB_H 1
|
||||
| #define HAVE_STRING_H 1
|
||||
| #define HAVE_MEMORY_H 1
|
||||
| #define HAVE_STRINGS_H 1
|
||||
| #define HAVE_INTTYPES_H 1
|
||||
| #define HAVE_STDINT_H 1
|
||||
| #define HAVE_UNISTD_H 1
|
||||
| #define SIZEOF_LONG_LONG 8
|
||||
| #define SIZEOF_LONG 8
|
||||
| #define SIZEOF_INT 4
|
||||
| #define SIZEOF_SHORT 2
|
||||
| /* end confdefs.h. */
|
||||
|
|
||||
| /* Override any gcc2 internal prototype to avoid an error. */
|
||||
| #ifdef __cplusplus
|
||||
| extern "C"
|
||||
| #endif
|
||||
| /* We use char because int might match the return type of a gcc2
|
||||
| builtin and then its argument prototype would still apply. */
|
||||
| char fopen_net ();
|
||||
| int
|
||||
| main ()
|
||||
| {
|
||||
| fopen_net ();
|
||||
| ;
|
||||
| return 0;
|
||||
| }
|
||||
configure:15328: result: no
|
||||
configure:15490: WARNING: Didn't find libopennet
|
||||
configure:15499: WARNING: Support for libopennet disabled
|
||||
configure:15783: checking windows.h usability
|
||||
configure:15795: gcc -c -g -O2 conftest.c >&5
|
||||
conftest.c:57:21: windows.h: No such file or directory
|
||||
configure:15801: $? = 1
|
||||
configure: failed program was:
|
||||
| /* confdefs.h. */
|
||||
|
|
||||
| #define PACKAGE_NAME "libconfig"
|
||||
| #define PACKAGE_TARNAME "libconfig"
|
||||
| #define PACKAGE_VERSION "0.1.16"
|
||||
| #define PACKAGE_STRING "libconfig 0.1.16"
|
||||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define STDC_HEADERS 1
|
||||
| #define HAVE_SYS_TYPES_H 1
|
||||
| #define HAVE_SYS_STAT_H 1
|
||||
| #define HAVE_STDLIB_H 1
|
||||
| #define HAVE_STRING_H 1
|
||||
| #define HAVE_MEMORY_H 1
|
||||
| #define HAVE_STRINGS_H 1
|
||||
| #define HAVE_INTTYPES_H 1
|
||||
| #define HAVE_STDINT_H 1
|
||||
| #define HAVE_UNISTD_H 1
|
||||
| #define SIZEOF_LONG_LONG 8
|
||||
| #define SIZEOF_LONG 8
|
||||
| #define SIZEOF_INT 4
|
||||
| #define SIZEOF_SHORT 2
|
||||
| /* end confdefs.h. */
|
||||
| #include <stdio.h>
|
||||
| #if HAVE_SYS_TYPES_H
|
||||
| # include <sys/types.h>
|
||||
| #endif
|
||||
| #if HAVE_SYS_STAT_H
|
||||
| # include <sys/stat.h>
|
||||
| #endif
|
||||
| #if STDC_HEADERS
|
||||
| # include <stdlib.h>
|
||||
| # include <stddef.h>
|
||||
| #else
|
||||
| # if HAVE_STDLIB_H
|
||||
| # include <stdlib.h>
|
||||
| # endif
|
||||
| #endif
|
||||
| #if HAVE_STRING_H
|
||||
| # if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
| # include <memory.h>
|
||||
| # endif
|
||||
| # include <string.h>
|
||||
| #endif
|
||||
| #if HAVE_STRINGS_H
|
||||
| # include <strings.h>
|
||||
| #endif
|
||||
| #if HAVE_INTTYPES_H
|
||||
| # include <inttypes.h>
|
||||
| #else
|
||||
| # if HAVE_STDINT_H
|
||||
| # include <stdint.h>
|
||||
| # endif
|
||||
| #endif
|
||||
| #if HAVE_UNISTD_H
|
||||
| # include <unistd.h>
|
||||
| #endif
|
||||
| #include <windows.h>
|
||||
configure:15824: result: no
|
||||
configure:15828: checking windows.h presence
|
||||
configure:15838: gcc -E conftest.c
|
||||
conftest.c:23:21: windows.h: No such file or directory
|
||||
configure:15844: $? = 1
|
||||
configure: failed program was:
|
||||
| /* confdefs.h. */
|
||||
|
|
||||
| #define PACKAGE_NAME "libconfig"
|
||||
| #define PACKAGE_TARNAME "libconfig"
|
||||
| #define PACKAGE_VERSION "0.1.16"
|
||||
| #define PACKAGE_STRING "libconfig 0.1.16"
|
||||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define STDC_HEADERS 1
|
||||
| #define HAVE_SYS_TYPES_H 1
|
||||
| #define HAVE_SYS_STAT_H 1
|
||||
| #define HAVE_STDLIB_H 1
|
||||
| #define HAVE_STRING_H 1
|
||||
| #define HAVE_MEMORY_H 1
|
||||
| #define HAVE_STRINGS_H 1
|
||||
| #define HAVE_INTTYPES_H 1
|
||||
| #define HAVE_STDINT_H 1
|
||||
| #define HAVE_UNISTD_H 1
|
||||
| #define SIZEOF_LONG_LONG 8
|
||||
| #define SIZEOF_LONG 8
|
||||
| #define SIZEOF_INT 4
|
||||
| #define SIZEOF_SHORT 2
|
||||
| /* end confdefs.h. */
|
||||
| #include <windows.h>
|
||||
configure:15864: result: no
|
||||
configure:15899: checking for windows.h
|
||||
configure:15906: result: no
|
||||
configure:15783: checking windowsx.h usability
|
||||
configure:15795: gcc -c -g -O2 conftest.c >&5
|
||||
conftest.c:57:22: windowsx.h: No such file or directory
|
||||
configure:15801: $? = 1
|
||||
configure: failed program was:
|
||||
| /* confdefs.h. */
|
||||
|
|
||||
| #define PACKAGE_NAME "libconfig"
|
||||
| #define PACKAGE_TARNAME "libconfig"
|
||||
| #define PACKAGE_VERSION "0.1.16"
|
||||
| #define PACKAGE_STRING "libconfig 0.1.16"
|
||||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define STDC_HEADERS 1
|
||||
| #define HAVE_SYS_TYPES_H 1
|
||||
| #define HAVE_SYS_STAT_H 1
|
||||
| #define HAVE_STDLIB_H 1
|
||||
| #define HAVE_STRING_H 1
|
||||
| #define HAVE_MEMORY_H 1
|
||||
| #define HAVE_STRINGS_H 1
|
||||
| #define HAVE_INTTYPES_H 1
|
||||
| #define HAVE_STDINT_H 1
|
||||
| #define HAVE_UNISTD_H 1
|
||||
| #define SIZEOF_LONG_LONG 8
|
||||
| #define SIZEOF_LONG 8
|
||||
| #define SIZEOF_INT 4
|
||||
| #define SIZEOF_SHORT 2
|
||||
| /* end confdefs.h. */
|
||||
| #include <stdio.h>
|
||||
| #if HAVE_SYS_TYPES_H
|
||||
| # include <sys/types.h>
|
||||
| #endif
|
||||
| #if HAVE_SYS_STAT_H
|
||||
| # include <sys/stat.h>
|
||||
| #endif
|
||||
| #if STDC_HEADERS
|
||||
| # include <stdlib.h>
|
||||
| # include <stddef.h>
|
||||
| #else
|
||||
| # if HAVE_STDLIB_H
|
||||
| # include <stdlib.h>
|
||||
| # endif
|
||||
| #endif
|
||||
| #if HAVE_STRING_H
|
||||
| # if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
| # include <memory.h>
|
||||
| # endif
|
||||
| # include <string.h>
|
||||
| #endif
|
||||
| #if HAVE_STRINGS_H
|
||||
| # include <strings.h>
|
||||
| #endif
|
||||
| #if HAVE_INTTYPES_H
|
||||
| # include <inttypes.h>
|
||||
| #else
|
||||
| # if HAVE_STDINT_H
|
||||
| # include <stdint.h>
|
||||
| # endif
|
||||
| #endif
|
||||
| #if HAVE_UNISTD_H
|
||||
| # include <unistd.h>
|
||||
| #endif
|
||||
| #include <windowsx.h>
|
||||
configure:15824: result: no
|
||||
configure:15828: checking windowsx.h presence
|
||||
configure:15838: gcc -E conftest.c
|
||||
conftest.c:23:22: windowsx.h: No such file or directory
|
||||
configure:15844: $? = 1
|
||||
configure: failed program was:
|
||||
| /* confdefs.h. */
|
||||
|
|
||||
| #define PACKAGE_NAME "libconfig"
|
||||
| #define PACKAGE_TARNAME "libconfig"
|
||||
| #define PACKAGE_VERSION "0.1.16"
|
||||
| #define PACKAGE_STRING "libconfig 0.1.16"
|
||||
| #define PACKAGE_BUGREPORT ""
|
||||
| #define STDC_HEADERS 1
|
||||
| #define HAVE_SYS_TYPES_H 1
|
||||
| #define HAVE_SYS_STAT_H 1
|
||||
| #define HAVE_STDLIB_H 1
|
||||
| #define HAVE_STRING_H 1
|
||||
| #define HAVE_MEMORY_H 1
|
||||
| #define HAVE_STRINGS_H 1
|
||||
| #define HAVE_INTTYPES_H 1
|
||||
| #define HAVE_STDINT_H 1
|
||||
| #define HAVE_UNISTD_H 1
|
||||
| #define SIZEOF_LONG_LONG 8
|
||||
| #define SIZEOF_LONG 8
|
||||
| #define SIZEOF_INT 4
|
||||
| #define SIZEOF_SHORT 2
|
||||
| /* end confdefs.h. */
|
||||
| #include <windowsx.h>
|
||||
configure:15864: result: no
|
||||
configure:15899: checking for windowsx.h
|
||||
configure:15906: result: no
|
||||
configure:15925: checking how to create shared objects
|
||||
configure:15955: gcc -o conftest -g -O2 -fPIC -DPIC -shared -rdynamic conftest.c >&5
|
||||
configure:15961: $? = 0
|
||||
configure:15965: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:15968: $? = 0
|
||||
configure:15971: test -s conftest
|
||||
configure:15974: $? = 0
|
||||
configure:16629: result: -shared -rdynamic -fPIC -DPIC
|
||||
configure:16665: checking ctype.h usability
|
||||
configure:16677: gcc -c -g -O2 conftest.c >&5
|
||||
configure:16683: $? = 0
|
||||
configure:16687: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16690: $? = 0
|
||||
configure:16693: test -s conftest.o
|
||||
configure:16696: $? = 0
|
||||
configure:16706: result: yes
|
||||
configure:16710: checking ctype.h presence
|
||||
configure:16720: gcc -E conftest.c
|
||||
configure:16726: $? = 0
|
||||
configure:16746: result: yes
|
||||
configure:16781: checking for ctype.h
|
||||
configure:16788: result: yes
|
||||
configure:16665: checking dirent.h usability
|
||||
configure:16677: gcc -c -g -O2 conftest.c >&5
|
||||
configure:16683: $? = 0
|
||||
configure:16687: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16690: $? = 0
|
||||
configure:16693: test -s conftest.o
|
||||
configure:16696: $? = 0
|
||||
configure:16706: result: yes
|
||||
configure:16710: checking dirent.h presence
|
||||
configure:16720: gcc -E conftest.c
|
||||
configure:16726: $? = 0
|
||||
configure:16746: result: yes
|
||||
configure:16781: checking for dirent.h
|
||||
configure:16788: result: yes
|
||||
configure:16665: checking pwd.h usability
|
||||
configure:16677: gcc -c -g -O2 conftest.c >&5
|
||||
configure:16683: $? = 0
|
||||
configure:16687: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16690: $? = 0
|
||||
configure:16693: test -s conftest.o
|
||||
configure:16696: $? = 0
|
||||
configure:16706: result: yes
|
||||
configure:16710: checking pwd.h presence
|
||||
configure:16720: gcc -E conftest.c
|
||||
configure:16726: $? = 0
|
||||
configure:16746: result: yes
|
||||
configure:16781: checking for pwd.h
|
||||
configure:16788: result: yes
|
||||
configure:16665: checking stdio.h usability
|
||||
configure:16677: gcc -c -g -O2 conftest.c >&5
|
||||
configure:16683: $? = 0
|
||||
configure:16687: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16690: $? = 0
|
||||
configure:16693: test -s conftest.o
|
||||
configure:16696: $? = 0
|
||||
configure:16706: result: yes
|
||||
configure:16710: checking stdio.h presence
|
||||
configure:16720: gcc -E conftest.c
|
||||
configure:16726: $? = 0
|
||||
configure:16746: result: yes
|
||||
configure:16781: checking for stdio.h
|
||||
configure:16788: result: yes
|
||||
configure:16656: checking for stdlib.h
|
||||
configure:16661: result: yes
|
||||
configure:16656: checking for string.h
|
||||
configure:16661: result: yes
|
||||
configure:16656: checking for sys/stat.h
|
||||
configure:16661: result: yes
|
||||
configure:16665: checking sys/time.h usability
|
||||
configure:16677: gcc -c -g -O2 conftest.c >&5
|
||||
configure:16683: $? = 0
|
||||
configure:16687: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16690: $? = 0
|
||||
configure:16693: test -s conftest.o
|
||||
configure:16696: $? = 0
|
||||
configure:16706: result: yes
|
||||
configure:16710: checking sys/time.h presence
|
||||
configure:16720: gcc -E conftest.c
|
||||
configure:16726: $? = 0
|
||||
configure:16746: result: yes
|
||||
configure:16781: checking for sys/time.h
|
||||
configure:16788: result: yes
|
||||
configure:16656: checking for sys/types.h
|
||||
configure:16661: result: yes
|
||||
configure:16665: checking time.h usability
|
||||
configure:16677: gcc -c -g -O2 conftest.c >&5
|
||||
configure:16683: $? = 0
|
||||
configure:16687: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16690: $? = 0
|
||||
configure:16693: test -s conftest.o
|
||||
configure:16696: $? = 0
|
||||
configure:16706: result: yes
|
||||
configure:16710: checking time.h presence
|
||||
configure:16720: gcc -E conftest.c
|
||||
configure:16726: $? = 0
|
||||
configure:16746: result: yes
|
||||
configure:16781: checking for time.h
|
||||
configure:16788: result: yes
|
||||
configure:16656: checking for unistd.h
|
||||
configure:16661: result: yes
|
||||
configure:16801: checking whether time.h and sys/time.h may both be included
|
||||
configure:16826: gcc -c -g -O2 conftest.c >&5
|
||||
configure:16832: $? = 0
|
||||
configure:16836: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16839: $? = 0
|
||||
configure:16842: test -s conftest.o
|
||||
configure:16845: $? = 0
|
||||
configure:16856: result: yes
|
||||
configure:16873: checking for strsep
|
||||
configure:16930: gcc -o conftest -g -O2 conftest.c >&5
|
||||
configure:16936: $? = 0
|
||||
configure:16940: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16943: $? = 0
|
||||
configure:16946: test -s conftest
|
||||
configure:16949: $? = 0
|
||||
configure:16961: result: yes
|
||||
configure:16873: checking for strtoll
|
||||
configure:16930: gcc -o conftest -g -O2 conftest.c >&5
|
||||
configure:16936: $? = 0
|
||||
configure:16940: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16943: $? = 0
|
||||
configure:16946: test -s conftest
|
||||
configure:16949: $? = 0
|
||||
configure:16961: result: yes
|
||||
configure:16873: checking for getuid
|
||||
configure:16930: gcc -o conftest -g -O2 conftest.c >&5
|
||||
configure:16936: $? = 0
|
||||
configure:16940: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:16943: $? = 0
|
||||
configure:16946: test -s conftest
|
||||
configure:16949: $? = 0
|
||||
configure:16961: result: yes
|
||||
configure:16985: checking for getpwuid
|
||||
configure:17042: gcc -o conftest -g -O2 conftest.c >&5
|
||||
configure:17048: $? = 0
|
||||
configure:17052: test -z
|
||||
|| test ! -s conftest.err
|
||||
configure:17055: $? = 0
|
||||
configure:17058: test -s conftest
|
||||
configure:17061: $? = 0
|
||||
configure:17073: result: yes
|
||||
configure:17188: creating ./config.status
|
||||
|
||||
## ---------------------- ##
|
||||
## Running config.status. ##
|
||||
## ---------------------- ##
|
||||
|
||||
This file was extended by libconfig config.status 0.1.16, which was
|
||||
generated by GNU Autoconf 2.59. Invocation command line was
|
||||
|
||||
CONFIG_FILES =
|
||||
CONFIG_HEADERS =
|
||||
CONFIG_LINKS =
|
||||
CONFIG_COMMANDS =
|
||||
$ ./config.status
|
||||
|
||||
on darkside
|
||||
|
||||
config.status:676: creating Makefile
|
||||
config.status:676: creating lc_geterrno.3
|
||||
config.status:676: creating lc_process.3
|
||||
config.status:676: creating lc_register_var.3
|
||||
config.status:676: creating lc_geterrstr.3
|
||||
config.status:676: creating lc_register_callback.3
|
||||
config.status:676: creating lc_cleanup.3
|
||||
config.status:676: creating lc_process_file.3
|
||||
config.status:676: creating libconfig.3
|
||||
config.status:780: creating config.h
|
||||
|
||||
## ---------------- ##
|
||||
## Cache variables. ##
|
||||
## ---------------- ##
|
||||
|
||||
ac_cv_build=x86_64-unknown-linux-gnu
|
||||
ac_cv_build_alias=x86_64-unknown-linux-gnu
|
||||
ac_cv_c_compiler_gnu=yes
|
||||
ac_cv_c_inline=inline
|
||||
ac_cv_env_CC_set=
|
||||
ac_cv_env_CC_value=
|
||||
ac_cv_env_CFLAGS_set=
|
||||
ac_cv_env_CFLAGS_value=
|
||||
ac_cv_env_CPPFLAGS_set=
|
||||
ac_cv_env_CPPFLAGS_value=
|
||||
ac_cv_env_CPP_set=
|
||||
ac_cv_env_CPP_value=
|
||||
ac_cv_env_LDFLAGS_set=
|
||||
ac_cv_env_LDFLAGS_value=
|
||||
ac_cv_env_build_alias_set=
|
||||
ac_cv_env_build_alias_value=
|
||||
ac_cv_env_host_alias_set=
|
||||
ac_cv_env_host_alias_value=
|
||||
ac_cv_env_target_alias_set=
|
||||
ac_cv_env_target_alias_value=
|
||||
ac_cv_exeext=
|
||||
ac_cv_func_getpwuid=yes
|
||||
ac_cv_func_getuid=yes
|
||||
ac_cv_func_strsep=yes
|
||||
ac_cv_func_strtoll=yes
|
||||
ac_cv_header_ctype_h=yes
|
||||
ac_cv_header_dirent_h=yes
|
||||
ac_cv_header_inttypes_h=yes
|
||||
ac_cv_header_memory_h=yes
|
||||
ac_cv_header_pwd_h=yes
|
||||
ac_cv_header_stdc=yes
|
||||
ac_cv_header_stdint_h=yes
|
||||
ac_cv_header_stdio_h=yes
|
||||
ac_cv_header_stdlib_h=yes
|
||||
ac_cv_header_string_h=yes
|
||||
ac_cv_header_strings_h=yes
|
||||
ac_cv_header_sys_stat_h=yes
|
||||
ac_cv_header_sys_time_h=yes
|
||||
ac_cv_header_sys_types_h=yes
|
||||
ac_cv_header_time=yes
|
||||
ac_cv_header_time_h=yes
|
||||
ac_cv_header_unistd_h=yes
|
||||
ac_cv_header_windows_h=no
|
||||
ac_cv_header_windowsx_h=no
|
||||
ac_cv_host=x86_64-unknown-linux-gnu
|
||||
ac_cv_host_alias=x86_64-unknown-linux-gnu
|
||||
ac_cv_lib_opennet_fopen_net=no
|
||||
ac_cv_objext=o
|
||||
ac_cv_path_install='/usr/bin/install -c'
|
||||
ac_cv_prog_CPP='gcc -E'
|
||||
ac_cv_prog_ac_ct_AR=ar
|
||||
ac_cv_prog_ac_ct_CC=gcc
|
||||
ac_cv_prog_ac_ct_RANLIB=ranlib
|
||||
ac_cv_prog_cc_g=yes
|
||||
ac_cv_prog_cc_stdc=
|
||||
ac_cv_prog_egrep='grep -E'
|
||||
ac_cv_prog_make_make_set=yes
|
||||
ac_cv_sizeof_int=4
|
||||
ac_cv_sizeof_long=8
|
||||
ac_cv_sizeof_long_long=8
|
||||
ac_cv_sizeof_short=2
|
||||
ac_cv_type_int=yes
|
||||
ac_cv_type_int16_t=yes
|
||||
ac_cv_type_int32_t=yes
|
||||
ac_cv_type_int64_t=yes
|
||||
ac_cv_type_long=yes
|
||||
ac_cv_type_long_long=yes
|
||||
ac_cv_type_short=yes
|
||||
ac_cv_type_uint16_t=yes
|
||||
ac_cv_type_uint32_t=yes
|
||||
ac_cv_type_uint64_t=yes
|
||||
dc_cv_loop='$ac_cv_sizeof_short'
|
||||
dc_cv_name=short
|
||||
dc_cv_size=2
|
||||
|
||||
## ----------------- ##
|
||||
## Output variables. ##
|
||||
## ----------------- ##
|
||||
|
||||
AR='ar'
|
||||
AREXT='a'
|
||||
CC='gcc'
|
||||
CFLAGS='-g -O2'
|
||||
CPP='gcc -E'
|
||||
CPPFLAGS=''
|
||||
DEFS='-DHAVE_CONFIG_H'
|
||||
ECHO_C=''
|
||||
ECHO_N='-n'
|
||||
ECHO_T=''
|
||||
EGREP='grep -E'
|
||||
EXEEXT=''
|
||||
INSTALL_DATA='${INSTALL} -m 644'
|
||||
INSTALL_PROGRAM='${INSTALL}'
|
||||
INSTALL_SCRIPT='${INSTALL}'
|
||||
LDFLAGS=''
|
||||
LIBOBJS=''
|
||||
LIBS=''
|
||||
LN_S='ln -s'
|
||||
LTLIBOBJS=''
|
||||
OBJEXT='o'
|
||||
PACKAGE_BUGREPORT=''
|
||||
PACKAGE_NAME='libconfig'
|
||||
PACKAGE_STRING='libconfig 0.1.16'
|
||||
PACKAGE_TARNAME='libconfig'
|
||||
PACKAGE_VERSION='0.1.16'
|
||||
PATH_SEPARATOR=':'
|
||||
RANLIB='ranlib'
|
||||
SET_MAKE=''
|
||||
SHELL='/bin/sh'
|
||||
SHLIBOBJS=''
|
||||
SHOBJEXT='so'
|
||||
SHOBJFLAGS='-fPIC -DPIC'
|
||||
SHOBJLDFLAGS='-shared -rdynamic'
|
||||
ac_ct_AR='ar'
|
||||
ac_ct_CC='gcc'
|
||||
ac_ct_RANLIB='ranlib'
|
||||
bindir='${exec_prefix}/bin'
|
||||
build='x86_64-unknown-linux-gnu'
|
||||
build_alias=''
|
||||
build_cpu='x86_64'
|
||||
build_os='linux-gnu'
|
||||
build_vendor='unknown'
|
||||
datadir='${prefix}/share'
|
||||
exec_prefix='${prefix}'
|
||||
host='x86_64-unknown-linux-gnu'
|
||||
host_alias=''
|
||||
host_cpu='x86_64'
|
||||
host_os='linux-gnu'
|
||||
host_vendor='unknown'
|
||||
includedir='${prefix}/include'
|
||||
infodir='${prefix}/info'
|
||||
libdir='${exec_prefix}/lib'
|
||||
libexecdir='${exec_prefix}/libexec'
|
||||
localstatedir='${prefix}/var'
|
||||
mandir='${prefix}/man'
|
||||
oldincludedir='/usr/include'
|
||||
prefix='/usr/local'
|
||||
program_transform_name='s,x,x,'
|
||||
sbindir='${exec_prefix}/sbin'
|
||||
sharedstatedir='${prefix}/com'
|
||||
sysconfdir='${prefix}/etc'
|
||||
target_alias=''
|
||||
|
||||
## ----------- ##
|
||||
## confdefs.h. ##
|
||||
## ----------- ##
|
||||
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_DIRENT_H 1
|
||||
#define HAVE_GETPWUID 1
|
||||
#define HAVE_GETUID 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_PWD_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRSEP 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#define HAVE_TIME_H 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
#define PACKAGE_NAME "libconfig"
|
||||
#define PACKAGE_STRING "libconfig 0.1.16"
|
||||
#define PACKAGE_TARNAME "libconfig"
|
||||
#define PACKAGE_VERSION "0.1.16"
|
||||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_LONG 8
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SIZEOF_SHORT 2
|
||||
#define STDC_HEADERS 1
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
configure: exit 0
|
@ -1,971 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Generated by configure.
|
||||
# Run this file to recreate the current configuration.
|
||||
# Compiler output produced by configure, useful for debugging
|
||||
# configure, is in config.log if it exists.
|
||||
|
||||
debug=false
|
||||
ac_cs_recheck=false
|
||||
ac_cs_silent=false
|
||||
SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
## --------------------- ##
|
||||
## M4sh Initialization. ##
|
||||
## --------------------- ##
|
||||
|
||||
# Be Bourne compatible
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
|
||||
set -o posix
|
||||
fi
|
||||
DUALCASE=1; export DUALCASE # for MKS sh
|
||||
|
||||
# Support unset when possible.
|
||||
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
|
||||
as_unset=unset
|
||||
else
|
||||
as_unset=false
|
||||
fi
|
||||
|
||||
|
||||
# Work around bugs in pre-3.0 UWIN ksh.
|
||||
$as_unset ENV MAIL MAILPATH
|
||||
PS1='$ '
|
||||
PS2='> '
|
||||
PS4='+ '
|
||||
|
||||
# NLS nuisances.
|
||||
for as_var in \
|
||||
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
|
||||
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
|
||||
LC_TELEPHONE LC_TIME
|
||||
do
|
||||
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
|
||||
eval $as_var=C; export $as_var
|
||||
else
|
||||
$as_unset $as_var
|
||||
fi
|
||||
done
|
||||
|
||||
# Required to use basename.
|
||||
if expr a : '\(a\)' >/dev/null 2>&1; then
|
||||
as_expr=expr
|
||||
else
|
||||
as_expr=false
|
||||
fi
|
||||
|
||||
if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
|
||||
as_basename=basename
|
||||
else
|
||||
as_basename=false
|
||||
fi
|
||||
|
||||
|
||||
# Name of the executable.
|
||||
as_me=`$as_basename "$0" ||
|
||||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
|
||||
X"$0" : 'X\(//\)$' \| \
|
||||
X"$0" : 'X\(/\)$' \| \
|
||||
. : '\(.\)' 2>/dev/null ||
|
||||
echo X/"$0" |
|
||||
sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
|
||||
/^X\/\(\/\/\)$/{ s//\1/; q; }
|
||||
/^X\/\(\/\).*/{ s//\1/; q; }
|
||||
s/.*/./; q'`
|
||||
|
||||
|
||||
# PATH needs CR, and LINENO needs CR and PATH.
|
||||
# Avoid depending upon Character Ranges.
|
||||
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
|
||||
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
|
||||
as_cr_digits='0123456789'
|
||||
as_cr_alnum=$as_cr_Letters$as_cr_digits
|
||||
|
||||
# The user is always right.
|
||||
if test "${PATH_SEPARATOR+set}" != set; then
|
||||
echo "#! /bin/sh" >conf$$.sh
|
||||
echo "exit 0" >>conf$$.sh
|
||||
chmod +x conf$$.sh
|
||||
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
|
||||
PATH_SEPARATOR=';'
|
||||
else
|
||||
PATH_SEPARATOR=:
|
||||
fi
|
||||
rm -f conf$$.sh
|
||||
fi
|
||||
|
||||
|
||||
as_lineno_1=$LINENO
|
||||
as_lineno_2=$LINENO
|
||||
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
|
||||
test "x$as_lineno_1" != "x$as_lineno_2" &&
|
||||
test "x$as_lineno_3" = "x$as_lineno_2" || {
|
||||
# Find who we are. Look in the path if we contain no path at all
|
||||
# relative or not.
|
||||
case $0 in
|
||||
*[\\/]* ) as_myself=$0 ;;
|
||||
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
|
||||
done
|
||||
|
||||
;;
|
||||
esac
|
||||
# We did not find ourselves, most probably we were run as `sh COMMAND'
|
||||
# in which case we are not to be found in the path.
|
||||
if test "x$as_myself" = x; then
|
||||
as_myself=$0
|
||||
fi
|
||||
if test ! -f "$as_myself"; then
|
||||
{ { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
|
||||
echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
case $CONFIG_SHELL in
|
||||
'')
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for as_base in sh bash ksh sh5; do
|
||||
case $as_dir in
|
||||
/*)
|
||||
if ("$as_dir/$as_base" -c '
|
||||
as_lineno_1=$LINENO
|
||||
as_lineno_2=$LINENO
|
||||
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
|
||||
test "x$as_lineno_1" != "x$as_lineno_2" &&
|
||||
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
|
||||
$as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
|
||||
$as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
|
||||
CONFIG_SHELL=$as_dir/$as_base
|
||||
export CONFIG_SHELL
|
||||
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
|
||||
fi;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
|
||||
# uniformly replaced by the line number. The first 'sed' inserts a
|
||||
# line-number line before each line; the second 'sed' does the real
|
||||
# work. The second script uses 'N' to pair each line-number line
|
||||
# with the numbered line, and appends trailing '-' during
|
||||
# substitution so that $LINENO is not a special case at line end.
|
||||
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
|
||||
# second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
|
||||
sed '=' <$as_myself |
|
||||
sed '
|
||||
N
|
||||
s,$,-,
|
||||
: loop
|
||||
s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
|
||||
t loop
|
||||
s,-$,,
|
||||
s,^['$as_cr_digits']*\n,,
|
||||
' >$as_me.lineno &&
|
||||
chmod +x $as_me.lineno ||
|
||||
{ { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
|
||||
echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
|
||||
# Don't try to exec as it changes $[0], causing all sort of problems
|
||||
# (the dirname of $[0] is not the place where we might find the
|
||||
# original and so on. Autoconf is especially sensible to this).
|
||||
. ./$as_me.lineno
|
||||
# Exit status is that of the last command.
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
|
||||
*c*,-n*) ECHO_N= ECHO_C='
|
||||
' ECHO_T=' ' ;;
|
||||
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
|
||||
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
|
||||
esac
|
||||
|
||||
if expr a : '\(a\)' >/dev/null 2>&1; then
|
||||
as_expr=expr
|
||||
else
|
||||
as_expr=false
|
||||
fi
|
||||
|
||||
rm -f conf$$ conf$$.exe conf$$.file
|
||||
echo >conf$$.file
|
||||
if ln -s conf$$.file conf$$ 2>/dev/null; then
|
||||
# We could just check for DJGPP; but this test a) works b) is more generic
|
||||
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
|
||||
if test -f conf$$.exe; then
|
||||
# Don't use ln at all; we don't have any links
|
||||
as_ln_s='cp -p'
|
||||
else
|
||||
as_ln_s='ln -s'
|
||||
fi
|
||||
elif ln conf$$.file conf$$ 2>/dev/null; then
|
||||
as_ln_s=ln
|
||||
else
|
||||
as_ln_s='cp -p'
|
||||
fi
|
||||
rm -f conf$$ conf$$.exe conf$$.file
|
||||
|
||||
if mkdir -p . 2>/dev/null; then
|
||||
as_mkdir_p=:
|
||||
else
|
||||
test -d ./-p && rmdir ./-p
|
||||
as_mkdir_p=false
|
||||
fi
|
||||
|
||||
as_executable_p="test -f"
|
||||
|
||||
# Sed expression to map a string onto a valid CPP name.
|
||||
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
|
||||
|
||||
# Sed expression to map a string onto a valid variable name.
|
||||
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
|
||||
|
||||
|
||||
# IFS
|
||||
# We need space, tab and new line, in precisely that order.
|
||||
as_nl='
|
||||
'
|
||||
IFS=" $as_nl"
|
||||
|
||||
# CDPATH.
|
||||
$as_unset CDPATH
|
||||
|
||||
exec 6>&1
|
||||
|
||||
# Open the log real soon, to keep \$[0] and so on meaningful, and to
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling. Logging --version etc. is OK.
|
||||
exec 5>>config.log
|
||||
{
|
||||
echo
|
||||
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
|
||||
## Running $as_me. ##
|
||||
_ASBOX
|
||||
} >&5
|
||||
cat >&5 <<_CSEOF
|
||||
|
||||
This file was extended by libconfig $as_me 0.1.16, which was
|
||||
generated by GNU Autoconf 2.59. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
CONFIG_HEADERS = $CONFIG_HEADERS
|
||||
CONFIG_LINKS = $CONFIG_LINKS
|
||||
CONFIG_COMMANDS = $CONFIG_COMMANDS
|
||||
$ $0 $@
|
||||
|
||||
_CSEOF
|
||||
echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
|
||||
echo >&5
|
||||
config_files=" 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"
|
||||
config_headers=" config.h"
|
||||
|
||||
ac_cs_usage="\
|
||||
\`$as_me' instantiates files from templates according to the
|
||||
current configuration.
|
||||
|
||||
Usage: $0 [OPTIONS] [FILE]...
|
||||
|
||||
-h, --help print this help, then exit
|
||||
-V, --version print version number, then exit
|
||||
-q, --quiet do not print progress messages
|
||||
-d, --debug don't remove temporary files
|
||||
--recheck update $as_me by reconfiguring in the same conditions
|
||||
--file=FILE[:TEMPLATE]
|
||||
instantiate the configuration file FILE
|
||||
--header=FILE[:TEMPLATE]
|
||||
instantiate the configuration header FILE
|
||||
|
||||
Configuration files:
|
||||
$config_files
|
||||
|
||||
Configuration headers:
|
||||
$config_headers
|
||||
|
||||
Report bugs to <bug-autoconf@gnu.org>."
|
||||
ac_cs_version="\
|
||||
libconfig config.status 0.1.16
|
||||
configured by ./configure, generated by GNU Autoconf 2.59,
|
||||
with options \"\"
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
This config.status script is free software; the Free Software Foundation
|
||||
gives unlimited permission to copy, distribute and modify it."
|
||||
srcdir=.
|
||||
INSTALL="/usr/bin/install -c"
|
||||
# If no file are specified by the user, then we need to provide default
|
||||
# value. By we need to know if files were specified by the user.
|
||||
ac_need_defaults=:
|
||||
while test $# != 0
|
||||
do
|
||||
case $1 in
|
||||
--*=*)
|
||||
ac_option=`expr "x$1" : 'x\([^=]*\)='`
|
||||
ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
|
||||
ac_shift=:
|
||||
;;
|
||||
-*)
|
||||
ac_option=$1
|
||||
ac_optarg=$2
|
||||
ac_shift=shift
|
||||
;;
|
||||
*) # This is not an option, so the user has probably given explicit
|
||||
# arguments.
|
||||
ac_option=$1
|
||||
ac_need_defaults=false;;
|
||||
esac
|
||||
|
||||
case $ac_option in
|
||||
# Handling of the options.
|
||||
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
|
||||
ac_cs_recheck=: ;;
|
||||
--version | --vers* | -V )
|
||||
echo "$ac_cs_version"; exit 0 ;;
|
||||
--he | --h)
|
||||
# Conflict between --help and --header
|
||||
{ { echo "$as_me:$LINENO: error: ambiguous option: $1
|
||||
Try \`$0 --help' for more information." >&5
|
||||
echo "$as_me: error: ambiguous option: $1
|
||||
Try \`$0 --help' for more information." >&2;}
|
||||
{ (exit 1); exit 1; }; };;
|
||||
--help | --hel | -h )
|
||||
echo "$ac_cs_usage"; exit 0 ;;
|
||||
--debug | --d* | -d )
|
||||
debug=: ;;
|
||||
--file | --fil | --fi | --f )
|
||||
$ac_shift
|
||||
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
|
||||
ac_need_defaults=false;;
|
||||
--header | --heade | --head | --hea )
|
||||
$ac_shift
|
||||
CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
|
||||
ac_need_defaults=false;;
|
||||
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
|
||||
| -silent | --silent | --silen | --sile | --sil | --si | --s)
|
||||
ac_cs_silent=: ;;
|
||||
|
||||
# This is an error.
|
||||
-*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
|
||||
Try \`$0 --help' for more information." >&5
|
||||
echo "$as_me: error: unrecognized option: $1
|
||||
Try \`$0 --help' for more information." >&2;}
|
||||
{ (exit 1); exit 1; }; } ;;
|
||||
|
||||
*) ac_config_targets="$ac_config_targets $1" ;;
|
||||
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
ac_configure_extra_args=
|
||||
|
||||
if $ac_cs_silent; then
|
||||
exec 6>/dev/null
|
||||
ac_configure_extra_args="$ac_configure_extra_args --silent"
|
||||
fi
|
||||
|
||||
if $ac_cs_recheck; then
|
||||
echo "running /bin/sh ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6
|
||||
exec /bin/sh ./configure $ac_configure_extra_args --no-create --no-recursion
|
||||
fi
|
||||
|
||||
for ac_config_target in $ac_config_targets
|
||||
do
|
||||
case "$ac_config_target" in
|
||||
# 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" ;;
|
||||
"lc_cleanup.3" ) CONFIG_FILES="$CONFIG_FILES lc_cleanup.3" ;;
|
||||
"lc_process_file.3" ) CONFIG_FILES="$CONFIG_FILES lc_process_file.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
|
||||
|
||||
# If the user did not use the arguments to specify the items to instantiate,
|
||||
# then the envvar interface is used. Set only those that are not.
|
||||
# We use the long form for the default assignment because of an extremely
|
||||
# bizarre bug on SunOS 4.1.3.
|
||||
if $ac_need_defaults; then
|
||||
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
|
||||
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
|
||||
fi
|
||||
|
||||
# Have a temporary directory for convenience. Make it in the build tree
|
||||
# simply because there is no reason to put it here, and in addition,
|
||||
# creating and moving files from /tmp can sometimes cause problems.
|
||||
# Create a temporary directory, and hook for its removal unless debugging.
|
||||
$debug ||
|
||||
{
|
||||
trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
|
||||
trap '{ (exit 1); exit 1; }' 1 2 13 15
|
||||
}
|
||||
|
||||
# Create a (secure) tmp directory for tmp files.
|
||||
|
||||
{
|
||||
tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
|
||||
test -n "$tmp" && test -d "$tmp"
|
||||
} ||
|
||||
{
|
||||
tmp=./confstat$$-$RANDOM
|
||||
(umask 077 && mkdir $tmp)
|
||||
} ||
|
||||
{
|
||||
echo "$me: cannot create a temporary directory in ." >&2
|
||||
{ (exit 1); exit 1; }
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# CONFIG_FILES section.
|
||||
#
|
||||
|
||||
# No need to generate the scripts if there are no CONFIG_FILES.
|
||||
# This happens for instance when ./config.status config.h
|
||||
if test -n "$CONFIG_FILES"; then
|
||||
# Protect against being on the right side of a sed subst in config.status.
|
||||
sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g;
|
||||
s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF
|
||||
s,@SHELL@,/bin/sh,;t t
|
||||
s,@PATH_SEPARATOR@,:,;t t
|
||||
s,@PACKAGE_NAME@,libconfig,;t t
|
||||
s,@PACKAGE_TARNAME@,libconfig,;t t
|
||||
s,@PACKAGE_VERSION@,0.1.16,;t t
|
||||
s,@PACKAGE_STRING@,libconfig 0.1.16,;t t
|
||||
s,@PACKAGE_BUGREPORT@,,;t t
|
||||
s,@exec_prefix@,${prefix},;t t
|
||||
s,@prefix@,/usr/local,;t t
|
||||
s,@program_transform_name@,s,x,x,,;t t
|
||||
s,@bindir@,${exec_prefix}/bin,;t t
|
||||
s,@sbindir@,${exec_prefix}/sbin,;t t
|
||||
s,@libexecdir@,${exec_prefix}/libexec,;t t
|
||||
s,@datadir@,${prefix}/share,;t t
|
||||
s,@sysconfdir@,${prefix}/etc,;t t
|
||||
s,@sharedstatedir@,${prefix}/com,;t t
|
||||
s,@localstatedir@,${prefix}/var,;t t
|
||||
s,@libdir@,${exec_prefix}/lib,;t t
|
||||
s,@includedir@,${prefix}/include,;t t
|
||||
s,@oldincludedir@,/usr/include,;t t
|
||||
s,@infodir@,${prefix}/info,;t t
|
||||
s,@mandir@,${prefix}/man,;t t
|
||||
s,@build_alias@,,;t t
|
||||
s,@host_alias@,,;t t
|
||||
s,@target_alias@,,;t t
|
||||
s,@DEFS@,-DHAVE_CONFIG_H,;t t
|
||||
s,@ECHO_C@,,;t t
|
||||
s,@ECHO_N@,-n,;t t
|
||||
s,@ECHO_T@,,;t t
|
||||
s,@LIBS@,,;t t
|
||||
s,@build@,x86_64-unknown-linux-gnu,;t t
|
||||
s,@build_cpu@,x86_64,;t t
|
||||
s,@build_vendor@,unknown,;t t
|
||||
s,@build_os@,linux-gnu,;t t
|
||||
s,@host@,x86_64-unknown-linux-gnu,;t t
|
||||
s,@host_cpu@,x86_64,;t t
|
||||
s,@host_vendor@,unknown,;t t
|
||||
s,@host_os@,linux-gnu,;t t
|
||||
s,@SHOBJEXT@,so,;t t
|
||||
s,@SHOBJFLAGS@,-fPIC -DPIC,;t t
|
||||
s,@SHOBJLDFLAGS@,-shared -rdynamic,;t t
|
||||
s,@CFLAGS@,-g -O2,;t t
|
||||
s,@CPPFLAGS@,,;t t
|
||||
s,@AREXT@,a,;t t
|
||||
s,@CC@,gcc,;t t
|
||||
s,@LDFLAGS@,,;t t
|
||||
s,@ac_ct_CC@,gcc,;t t
|
||||
s,@EXEEXT@,,;t t
|
||||
s,@OBJEXT@,o,;t t
|
||||
s,@SET_MAKE@,,;t t
|
||||
s,@INSTALL_PROGRAM@,${INSTALL},;t t
|
||||
s,@INSTALL_SCRIPT@,${INSTALL},;t t
|
||||
s,@INSTALL_DATA@,${INSTALL} -m 644,;t t
|
||||
s,@LN_S@,ln -s,;t t
|
||||
s,@RANLIB@,ranlib,;t t
|
||||
s,@ac_ct_RANLIB@,ranlib,;t t
|
||||
s,@CPP@,gcc -E,;t t
|
||||
s,@EGREP@,grep -E,;t t
|
||||
s,@AR@,ar,;t t
|
||||
s,@ac_ct_AR@,ar,;t t
|
||||
s,@SHLIBOBJS@,,;t t
|
||||
s,@LIBOBJS@,,;t t
|
||||
s,@LTLIBOBJS@,,;t t
|
||||
CEOF
|
||||
|
||||
# Split the substitutions into bite-sized pieces for seds with
|
||||
# small command number limits, like on Digital OSF/1 and HP-UX.
|
||||
ac_max_sed_lines=48
|
||||
ac_sed_frag=1 # Number of current file.
|
||||
ac_beg=1 # First line for current file.
|
||||
ac_end=$ac_max_sed_lines # Line after last line for current file.
|
||||
ac_more_lines=:
|
||||
ac_sed_cmds=
|
||||
while $ac_more_lines; do
|
||||
if test $ac_beg -gt 1; then
|
||||
sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
|
||||
else
|
||||
sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
|
||||
fi
|
||||
if test ! -s $tmp/subs.frag; then
|
||||
ac_more_lines=false
|
||||
else
|
||||
# The purpose of the label and of the branching condition is to
|
||||
# speed up the sed processing (if there are no `@' at all, there
|
||||
# is no need to browse any of the substitutions).
|
||||
# These are the two extra sed commands mentioned above.
|
||||
(echo ':t
|
||||
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
|
||||
if test -z "$ac_sed_cmds"; then
|
||||
ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
|
||||
else
|
||||
ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
|
||||
fi
|
||||
ac_sed_frag=`expr $ac_sed_frag + 1`
|
||||
ac_beg=$ac_end
|
||||
ac_end=`expr $ac_end + $ac_max_sed_lines`
|
||||
fi
|
||||
done
|
||||
if test -z "$ac_sed_cmds"; then
|
||||
ac_sed_cmds=cat
|
||||
fi
|
||||
fi # test -n "$CONFIG_FILES"
|
||||
|
||||
for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
|
||||
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
|
||||
case $ac_file in
|
||||
- | *:- | *:-:* ) # input from stdin
|
||||
cat >$tmp/stdin
|
||||
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
* ) ac_file_in=$ac_file.in ;;
|
||||
esac
|
||||
|
||||
# Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
|
||||
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
|
||||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$ac_file" : 'X\(//\)[^/]' \| \
|
||||
X"$ac_file" : 'X\(//\)$' \| \
|
||||
X"$ac_file" : 'X\(/\)' \| \
|
||||
. : '\(.\)' 2>/dev/null ||
|
||||
echo X"$ac_file" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
|
||||
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
|
||||
/^X\(\/\/\)$/{ s//\1/; q; }
|
||||
/^X\(\/\).*/{ s//\1/; q; }
|
||||
s/.*/./; q'`
|
||||
{ if $as_mkdir_p; then
|
||||
mkdir -p "$ac_dir"
|
||||
else
|
||||
as_dir="$ac_dir"
|
||||
as_dirs=
|
||||
while test ! -d "$as_dir"; do
|
||||
as_dirs="$as_dir $as_dirs"
|
||||
as_dir=`(dirname "$as_dir") 2>/dev/null ||
|
||||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$as_dir" : 'X\(//\)[^/]' \| \
|
||||
X"$as_dir" : 'X\(//\)$' \| \
|
||||
X"$as_dir" : 'X\(/\)' \| \
|
||||
. : '\(.\)' 2>/dev/null ||
|
||||
echo X"$as_dir" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
|
||||
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
|
||||
/^X\(\/\/\)$/{ s//\1/; q; }
|
||||
/^X\(\/\).*/{ s//\1/; q; }
|
||||
s/.*/./; q'`
|
||||
done
|
||||
test ! -n "$as_dirs" || mkdir $as_dirs
|
||||
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
|
||||
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
|
||||
{ (exit 1); exit 1; }; }; }
|
||||
|
||||
ac_builddir=.
|
||||
|
||||
if test "$ac_dir" != .; then
|
||||
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
|
||||
# A "../" for each directory in $ac_dir_suffix.
|
||||
ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
|
||||
else
|
||||
ac_dir_suffix= ac_top_builddir=
|
||||
fi
|
||||
|
||||
case $srcdir in
|
||||
.) # No --srcdir option. We are building in place.
|
||||
ac_srcdir=.
|
||||
if test -z "$ac_top_builddir"; then
|
||||
ac_top_srcdir=.
|
||||
else
|
||||
ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
|
||||
fi ;;
|
||||
[\\/]* | ?:[\\/]* ) # Absolute path.
|
||||
ac_srcdir=$srcdir$ac_dir_suffix;
|
||||
ac_top_srcdir=$srcdir ;;
|
||||
*) # Relative path.
|
||||
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
|
||||
ac_top_srcdir=$ac_top_builddir$srcdir ;;
|
||||
esac
|
||||
|
||||
# Do not use `cd foo && pwd` to compute absolute paths, because
|
||||
# the directories may not exist.
|
||||
case `pwd` in
|
||||
.) ac_abs_builddir="$ac_dir";;
|
||||
*)
|
||||
case "$ac_dir" in
|
||||
.) ac_abs_builddir=`pwd`;;
|
||||
[\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
|
||||
*) ac_abs_builddir=`pwd`/"$ac_dir";;
|
||||
esac;;
|
||||
esac
|
||||
case $ac_abs_builddir in
|
||||
.) ac_abs_top_builddir=${ac_top_builddir}.;;
|
||||
*)
|
||||
case ${ac_top_builddir}. in
|
||||
.) ac_abs_top_builddir=$ac_abs_builddir;;
|
||||
[\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
|
||||
*) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
|
||||
esac;;
|
||||
esac
|
||||
case $ac_abs_builddir in
|
||||
.) ac_abs_srcdir=$ac_srcdir;;
|
||||
*)
|
||||
case $ac_srcdir in
|
||||
.) ac_abs_srcdir=$ac_abs_builddir;;
|
||||
[\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
|
||||
*) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
|
||||
esac;;
|
||||
esac
|
||||
case $ac_abs_builddir in
|
||||
.) ac_abs_top_srcdir=$ac_top_srcdir;;
|
||||
*)
|
||||
case $ac_top_srcdir in
|
||||
.) ac_abs_top_srcdir=$ac_abs_builddir;;
|
||||
[\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
|
||||
*) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
|
||||
case $INSTALL in
|
||||
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
|
||||
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
|
||||
esac
|
||||
|
||||
if test x"$ac_file" != x-; then
|
||||
{ echo "$as_me:$LINENO: creating $ac_file" >&5
|
||||
echo "$as_me: creating $ac_file" >&6;}
|
||||
rm -f "$ac_file"
|
||||
fi
|
||||
# Let's still pretend it is `configure' which instantiates (i.e., don't
|
||||
# use $as_me), people would be surprised to read:
|
||||
# /* config.h. Generated by config.status. */
|
||||
if test x"$ac_file" = x-; then
|
||||
configure_input=
|
||||
else
|
||||
configure_input="$ac_file. "
|
||||
fi
|
||||
configure_input=$configure_input"Generated from `echo $ac_file_in |
|
||||
sed 's,.*/,,'` by configure."
|
||||
|
||||
# First look for the input files in the build tree, otherwise in the
|
||||
# src tree.
|
||||
ac_file_inputs=`IFS=:
|
||||
for f in $ac_file_in; do
|
||||
case $f in
|
||||
-) echo $tmp/stdin ;;
|
||||
[\\/$]*)
|
||||
# Absolute (can't be DOS-style, as IFS=:)
|
||||
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
echo "$f";;
|
||||
*) # Relative
|
||||
if test -f "$f"; then
|
||||
# Build tree
|
||||
echo "$f"
|
||||
elif test -f "$srcdir/$f"; then
|
||||
# Source tree
|
||||
echo "$srcdir/$f"
|
||||
else
|
||||
# /dev/null tree
|
||||
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi;;
|
||||
esac
|
||||
done` || { (exit 1); exit 1; }
|
||||
sed "/^[ ]*VPATH[ ]*=/{
|
||||
s/:*\$(srcdir):*/:/;
|
||||
s/:*\${srcdir}:*/:/;
|
||||
s/:*@srcdir@:*/:/;
|
||||
s/^\([^=]*=[ ]*\):*/\1/;
|
||||
s/:*$//;
|
||||
s/^[^=]*=[ ]*$//;
|
||||
}
|
||||
|
||||
:t
|
||||
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
|
||||
s,@configure_input@,$configure_input,;t t
|
||||
s,@srcdir@,$ac_srcdir,;t t
|
||||
s,@abs_srcdir@,$ac_abs_srcdir,;t t
|
||||
s,@top_srcdir@,$ac_top_srcdir,;t t
|
||||
s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
|
||||
s,@builddir@,$ac_builddir,;t t
|
||||
s,@abs_builddir@,$ac_abs_builddir,;t t
|
||||
s,@top_builddir@,$ac_top_builddir,;t t
|
||||
s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
|
||||
s,@INSTALL@,$ac_INSTALL,;t t
|
||||
" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
|
||||
rm -f $tmp/stdin
|
||||
if test x"$ac_file" != x-; then
|
||||
mv $tmp/out $ac_file
|
||||
else
|
||||
cat $tmp/out
|
||||
rm -f $tmp/out
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#
|
||||
# CONFIG_HEADER section.
|
||||
#
|
||||
|
||||
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
|
||||
# NAME is the cpp macro being defined and VALUE is the value it is being given.
|
||||
#
|
||||
# ac_d sets the value in "#define NAME VALUE" lines.
|
||||
ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
|
||||
ac_dB='[ ].*$,\1#\2'
|
||||
ac_dC=' '
|
||||
ac_dD=',;t'
|
||||
# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
|
||||
ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
||||
ac_uB='$,\1#\2define\3'
|
||||
ac_uC=' '
|
||||
ac_uD=',;t'
|
||||
|
||||
for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
|
||||
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
|
||||
case $ac_file in
|
||||
- | *:- | *:-:* ) # input from stdin
|
||||
cat >$tmp/stdin
|
||||
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
* ) ac_file_in=$ac_file.in ;;
|
||||
esac
|
||||
|
||||
test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
|
||||
echo "$as_me: creating $ac_file" >&6;}
|
||||
|
||||
# First look for the input files in the build tree, otherwise in the
|
||||
# src tree.
|
||||
ac_file_inputs=`IFS=:
|
||||
for f in $ac_file_in; do
|
||||
case $f in
|
||||
-) echo $tmp/stdin ;;
|
||||
[\\/$]*)
|
||||
# Absolute (can't be DOS-style, as IFS=:)
|
||||
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
# Do quote $f, to prevent DOS paths from being IFS'd.
|
||||
echo "$f";;
|
||||
*) # Relative
|
||||
if test -f "$f"; then
|
||||
# Build tree
|
||||
echo "$f"
|
||||
elif test -f "$srcdir/$f"; then
|
||||
# Source tree
|
||||
echo "$srcdir/$f"
|
||||
else
|
||||
# /dev/null tree
|
||||
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi;;
|
||||
esac
|
||||
done` || { (exit 1); exit 1; }
|
||||
# Remove the trailing spaces.
|
||||
sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
|
||||
|
||||
# Handle all the #define templates only if necessary.
|
||||
if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then
|
||||
# If there are no defines, we may have an empty if/fi
|
||||
:
|
||||
cat >$tmp/defines.sed <<CEOF
|
||||
/^[ ]*#[ ]*define/!b
|
||||
t clr
|
||||
: clr
|
||||
${ac_dA}PACKAGE_NAME${ac_dB}PACKAGE_NAME${ac_dC}"libconfig"${ac_dD}
|
||||
${ac_dA}PACKAGE_TARNAME${ac_dB}PACKAGE_TARNAME${ac_dC}"libconfig"${ac_dD}
|
||||
${ac_dA}PACKAGE_VERSION${ac_dB}PACKAGE_VERSION${ac_dC}"0.1.16"${ac_dD}
|
||||
${ac_dA}PACKAGE_STRING${ac_dB}PACKAGE_STRING${ac_dC}"libconfig 0.1.16"${ac_dD}
|
||||
${ac_dA}PACKAGE_BUGREPORT${ac_dB}PACKAGE_BUGREPORT${ac_dC}""${ac_dD}
|
||||
${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_SYS_TYPES_H${ac_dB}HAVE_SYS_TYPES_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_SYS_STAT_H${ac_dB}HAVE_SYS_STAT_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_STDLIB_H${ac_dB}HAVE_STDLIB_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_STRING_H${ac_dB}HAVE_STRING_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_MEMORY_H${ac_dB}HAVE_MEMORY_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_STRINGS_H${ac_dB}HAVE_STRINGS_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_INTTYPES_H${ac_dB}HAVE_INTTYPES_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_STDINT_H${ac_dB}HAVE_STDINT_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}SIZEOF_LONG_LONG${ac_dB}SIZEOF_LONG_LONG${ac_dC}8${ac_dD}
|
||||
${ac_dA}SIZEOF_LONG${ac_dB}SIZEOF_LONG${ac_dC}8${ac_dD}
|
||||
${ac_dA}SIZEOF_INT${ac_dB}SIZEOF_INT${ac_dC}4${ac_dD}
|
||||
${ac_dA}SIZEOF_SHORT${ac_dB}SIZEOF_SHORT${ac_dC}2${ac_dD}
|
||||
${ac_dA}HAVE_CTYPE_H${ac_dB}HAVE_CTYPE_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_DIRENT_H${ac_dB}HAVE_DIRENT_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_PWD_H${ac_dB}HAVE_PWD_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_STDIO_H${ac_dB}HAVE_STDIO_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_STDLIB_H${ac_dB}HAVE_STDLIB_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_STRING_H${ac_dB}HAVE_STRING_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_SYS_STAT_H${ac_dB}HAVE_SYS_STAT_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_SYS_TIME_H${ac_dB}HAVE_SYS_TIME_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_SYS_TYPES_H${ac_dB}HAVE_SYS_TYPES_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_TIME_H${ac_dB}HAVE_TIME_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD}
|
||||
${ac_dA}TIME_WITH_SYS_TIME${ac_dB}TIME_WITH_SYS_TIME${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_STRSEP${ac_dB}HAVE_STRSEP${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_STRTOLL${ac_dB}HAVE_STRTOLL${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_GETUID${ac_dB}HAVE_GETUID${ac_dC}1${ac_dD}
|
||||
${ac_dA}HAVE_GETPWUID${ac_dB}HAVE_GETPWUID${ac_dC}1${ac_dD}
|
||||
CEOF
|
||||
sed -f $tmp/defines.sed $tmp/in >$tmp/out
|
||||
rm -f $tmp/in
|
||||
mv $tmp/out $tmp/in
|
||||
|
||||
fi # grep
|
||||
|
||||
# Handle all the #undef templates
|
||||
cat >$tmp/undefs.sed <<CEOF
|
||||
/^[ ]*#[ ]*undef/!b
|
||||
t clr
|
||||
: clr
|
||||
${ac_uA}PACKAGE_NAME${ac_uB}PACKAGE_NAME${ac_uC}"libconfig"${ac_uD}
|
||||
${ac_uA}PACKAGE_TARNAME${ac_uB}PACKAGE_TARNAME${ac_uC}"libconfig"${ac_uD}
|
||||
${ac_uA}PACKAGE_VERSION${ac_uB}PACKAGE_VERSION${ac_uC}"0.1.16"${ac_uD}
|
||||
${ac_uA}PACKAGE_STRING${ac_uB}PACKAGE_STRING${ac_uC}"libconfig 0.1.16"${ac_uD}
|
||||
${ac_uA}PACKAGE_BUGREPORT${ac_uB}PACKAGE_BUGREPORT${ac_uC}""${ac_uD}
|
||||
${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_SYS_TYPES_H${ac_uB}HAVE_SYS_TYPES_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_SYS_STAT_H${ac_uB}HAVE_SYS_STAT_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_STDLIB_H${ac_uB}HAVE_STDLIB_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_STRING_H${ac_uB}HAVE_STRING_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_MEMORY_H${ac_uB}HAVE_MEMORY_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_STRINGS_H${ac_uB}HAVE_STRINGS_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_INTTYPES_H${ac_uB}HAVE_INTTYPES_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_STDINT_H${ac_uB}HAVE_STDINT_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}SIZEOF_LONG_LONG${ac_uB}SIZEOF_LONG_LONG${ac_uC}8${ac_uD}
|
||||
${ac_uA}SIZEOF_LONG${ac_uB}SIZEOF_LONG${ac_uC}8${ac_uD}
|
||||
${ac_uA}SIZEOF_INT${ac_uB}SIZEOF_INT${ac_uC}4${ac_uD}
|
||||
${ac_uA}SIZEOF_SHORT${ac_uB}SIZEOF_SHORT${ac_uC}2${ac_uD}
|
||||
${ac_uA}HAVE_CTYPE_H${ac_uB}HAVE_CTYPE_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_DIRENT_H${ac_uB}HAVE_DIRENT_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_PWD_H${ac_uB}HAVE_PWD_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_STDIO_H${ac_uB}HAVE_STDIO_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_STDLIB_H${ac_uB}HAVE_STDLIB_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_STRING_H${ac_uB}HAVE_STRING_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_SYS_STAT_H${ac_uB}HAVE_SYS_STAT_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_SYS_TIME_H${ac_uB}HAVE_SYS_TIME_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_SYS_TYPES_H${ac_uB}HAVE_SYS_TYPES_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_TIME_H${ac_uB}HAVE_TIME_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD}
|
||||
${ac_uA}TIME_WITH_SYS_TIME${ac_uB}TIME_WITH_SYS_TIME${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_STRSEP${ac_uB}HAVE_STRSEP${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_STRTOLL${ac_uB}HAVE_STRTOLL${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_GETUID${ac_uB}HAVE_GETUID${ac_uC}1${ac_uD}
|
||||
${ac_uA}HAVE_GETPWUID${ac_uB}HAVE_GETPWUID${ac_uC}1${ac_uD}
|
||||
s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
|
||||
CEOF
|
||||
sed -f $tmp/undefs.sed $tmp/in >$tmp/out
|
||||
rm -f $tmp/in
|
||||
mv $tmp/out $tmp/in
|
||||
|
||||
# Let's still pretend it is `configure' which instantiates (i.e., don't
|
||||
# use $as_me), people would be surprised to read:
|
||||
# /* config.h. Generated by config.status. */
|
||||
if test x"$ac_file" = x-; then
|
||||
echo "/* Generated by configure. */" >$tmp/config.h
|
||||
else
|
||||
echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
|
||||
fi
|
||||
cat $tmp/in >>$tmp/config.h
|
||||
rm -f $tmp/in
|
||||
if test x"$ac_file" != x-; then
|
||||
if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
|
||||
{ echo "$as_me:$LINENO: $ac_file is unchanged" >&5
|
||||
echo "$as_me: $ac_file is unchanged" >&6;}
|
||||
else
|
||||
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
|
||||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$ac_file" : 'X\(//\)[^/]' \| \
|
||||
X"$ac_file" : 'X\(//\)$' \| \
|
||||
X"$ac_file" : 'X\(/\)' \| \
|
||||
. : '\(.\)' 2>/dev/null ||
|
||||
echo X"$ac_file" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
|
||||
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
|
||||
/^X\(\/\/\)$/{ s//\1/; q; }
|
||||
/^X\(\/\).*/{ s//\1/; q; }
|
||||
s/.*/./; q'`
|
||||
{ if $as_mkdir_p; then
|
||||
mkdir -p "$ac_dir"
|
||||
else
|
||||
as_dir="$ac_dir"
|
||||
as_dirs=
|
||||
while test ! -d "$as_dir"; do
|
||||
as_dirs="$as_dir $as_dirs"
|
||||
as_dir=`(dirname "$as_dir") 2>/dev/null ||
|
||||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$as_dir" : 'X\(//\)[^/]' \| \
|
||||
X"$as_dir" : 'X\(//\)$' \| \
|
||||
X"$as_dir" : 'X\(/\)' \| \
|
||||
. : '\(.\)' 2>/dev/null ||
|
||||
echo X"$as_dir" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
|
||||
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
|
||||
/^X\(\/\/\)$/{ s//\1/; q; }
|
||||
/^X\(\/\).*/{ s//\1/; q; }
|
||||
s/.*/./; q'`
|
||||
done
|
||||
test ! -n "$as_dirs" || mkdir $as_dirs
|
||||
fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
|
||||
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
|
||||
{ (exit 1); exit 1; }; }; }
|
||||
|
||||
rm -f $ac_file
|
||||
mv $tmp/config.h $ac_file
|
||||
fi
|
||||
else
|
||||
cat $tmp/config.h
|
||||
rm -f $tmp/config.h
|
||||
fi
|
||||
done
|
||||
|
||||
{ (exit 0); exit 0; }
|
1549
sftp_server/libconfig/config.sub
поставляемый
1549
sftp_server/libconfig/config.sub
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
18235
sftp_server/libconfig/configure
поставляемый
18235
sftp_server/libconfig/configure
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,46 +0,0 @@
|
||||
AC_REVISION($Revision $)
|
||||
AC_INIT(libconfig, 0.1.16)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Find out about the host OS
|
||||
DC_CHK_OS_INFO
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_RANLIB
|
||||
AC_AIX
|
||||
AC_CHECK_TOOL(AR, ar, true)
|
||||
|
||||
DC_DO_TYPE(uint64_t, unsigned, 8)
|
||||
DC_DO_TYPE(int64_t, signed, 8)
|
||||
DC_DO_TYPE(uint32_t, unsigned, 4)
|
||||
DC_DO_TYPE(int32_t, signed, 4)
|
||||
DC_DO_TYPE(uint16_t, unsigned, 2)
|
||||
DC_DO_TYPE(int16_t, signed, 2)
|
||||
|
||||
dnl This will cause optional libraries to be disabled even if they're
|
||||
dnl available and specified.
|
||||
DC_ASK_SMALL
|
||||
|
||||
dnl Checks for Win32 specific things.
|
||||
DC_DO_WIN32
|
||||
|
||||
dnl Get shared objects flags, calls DC_SYNC_SHLIBOBJS but if libobjs is
|
||||
dnl changed later (by AC_REPLACE_FUNCS, for example) you must call
|
||||
dnl DC_SYNC_SHLIBOBJS again.
|
||||
DC_GET_SHOBJFLAGS
|
||||
|
||||
dnl This stuff has to come after the shobjtest to verify that it is correct
|
||||
AC_CHECK_HEADERS(ctype.h dirent.h pwd.h stdio.h stdlib.h string.h sys/stat.h sys/time.h sys/types.h time.h unistd.h)
|
||||
AC_HEADER_TIME
|
||||
|
||||
AC_REPLACE_FUNCS(strsep strtoll getuid)
|
||||
AC_CHECK_FUNCS(getpwuid)
|
||||
|
||||
dnl This MUST be last.
|
||||
DC_SYNC_SHLIBOBJS
|
||||
|
||||
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)
|
@ -1,5 +0,0 @@
|
||||
#include "getuid.h"
|
||||
|
||||
uid_t getuid(void) {
|
||||
return(0);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#ifndef _LC_GETUID_H
|
||||
#define _LC_GETUID_H
|
||||
|
||||
typedef int uid_t;
|
||||
|
||||
uid_t getuid(void);
|
||||
|
||||
#endif
|
@ -1,251 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
@ -1,73 +0,0 @@
|
||||
.TH LC_GETERRNO 3 "25 Oct 04" "libconfig 0.1.16"
|
||||
.SH NAME
|
||||
lc_cleanup \- Clean up internal structures after processing data.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "void lc_cleanup(void);"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_cleanup (3)
|
||||
function cleans up the internal structures created by calling
|
||||
.BR lc_register_var (3)
|
||||
or
|
||||
.BR lc_register_callback (3)
|
||||
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.
|
||||
|
||||
After you call
|
||||
.BR lc_cleanup (3)
|
||||
calling
|
||||
.BR lc_process (3)
|
||||
or
|
||||
.BR lc_process_file (3)
|
||||
will generally cause errors since the registered variables and callbacks have been unregistered.
|
||||
|
||||
.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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_geterrstr (3),
|
||||
.BR lc_geterrno (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,73 +0,0 @@
|
||||
.TH LC_GETERRNO 3 "25 Oct 04" "@PACKAGE_STRING@"
|
||||
.SH NAME
|
||||
lc_cleanup \- Clean up internal structures after processing data.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "void lc_cleanup(void);"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_cleanup (3)
|
||||
function cleans up the internal structures created by calling
|
||||
.BR lc_register_var (3)
|
||||
or
|
||||
.BR lc_register_callback (3)
|
||||
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.
|
||||
|
||||
After you call
|
||||
.BR lc_cleanup (3)
|
||||
calling
|
||||
.BR lc_process (3)
|
||||
or
|
||||
.BR lc_process_file (3)
|
||||
will generally cause errors since the registered variables and callbacks have been unregistered.
|
||||
|
||||
.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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_geterrstr (3),
|
||||
.BR lc_geterrno (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,93 +0,0 @@
|
||||
.TH LC_GETERRNO 3 "25 Oct 04" "libconfig 0.1.16"
|
||||
.SH NAME
|
||||
lc_geterrno \- Retrieve a numeric error code.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "lc_err_t lc_geterrno(void);"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_geterrno (3)
|
||||
function returns the last numeric error code set as an
|
||||
.IR "lc_err_t"
|
||||
which is an enumerated type and can be cast to any integer type.
|
||||
|
||||
The
|
||||
.IR lc_err_t
|
||||
type specifies the following defined values:
|
||||
.TP
|
||||
LC_ERR_NONE
|
||||
No error was found. Success.
|
||||
.TP
|
||||
LC_ERR_INVCMD
|
||||
A command was specified for which there was no handler.
|
||||
.TP
|
||||
LC_ERR_INVSECTION
|
||||
A section was specified for which there was no handler.
|
||||
.TP
|
||||
LC_ERR_INVDATA
|
||||
A value that does not make sense was specified, such as a non-existant type to the
|
||||
.BR lc_process_file (3)
|
||||
function.
|
||||
.TP
|
||||
LC_ERR_BADFORMAT
|
||||
An invalid format was detected, such as no argument where on was expected, or a value passed to a boolean-specified variable whose value was not one of: enable, true, yes, on, y, 1, disable, false, off, no, n, 0.
|
||||
.TP
|
||||
LC_ERR_CANTOPEN
|
||||
Unable to open a specified file.
|
||||
.TP
|
||||
LC_ERR_CALLBACK
|
||||
A callback function returned an error (LC_CBRET_ERROR).
|
||||
.TP
|
||||
LC_ERR_ENOMEM
|
||||
Memory could not be allocated for internal structures.
|
||||
|
||||
.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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,93 +0,0 @@
|
||||
.TH LC_GETERRNO 3 "25 Oct 04" "@PACKAGE_STRING@"
|
||||
.SH NAME
|
||||
lc_geterrno \- Retrieve a numeric error code.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "lc_err_t lc_geterrno(void);"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_geterrno (3)
|
||||
function returns the last numeric error code set as an
|
||||
.IR "lc_err_t"
|
||||
which is an enumerated type and can be cast to any integer type.
|
||||
|
||||
The
|
||||
.IR lc_err_t
|
||||
type specifies the following defined values:
|
||||
.TP
|
||||
LC_ERR_NONE
|
||||
No error was found. Success.
|
||||
.TP
|
||||
LC_ERR_INVCMD
|
||||
A command was specified for which there was no handler.
|
||||
.TP
|
||||
LC_ERR_INVSECTION
|
||||
A section was specified for which there was no handler.
|
||||
.TP
|
||||
LC_ERR_INVDATA
|
||||
A value that does not make sense was specified, such as a non-existant type to the
|
||||
.BR lc_process_file (3)
|
||||
function.
|
||||
.TP
|
||||
LC_ERR_BADFORMAT
|
||||
An invalid format was detected, such as no argument where on was expected, or a value passed to a boolean-specified variable whose value was not one of: enable, true, yes, on, y, 1, disable, false, off, no, n, 0.
|
||||
.TP
|
||||
LC_ERR_CANTOPEN
|
||||
Unable to open a specified file.
|
||||
.TP
|
||||
LC_ERR_CALLBACK
|
||||
A callback function returned an error (LC_CBRET_ERROR).
|
||||
.TP
|
||||
LC_ERR_ENOMEM
|
||||
Memory could not be allocated for internal structures.
|
||||
|
||||
.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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,61 +0,0 @@
|
||||
.TH LC_GETERRSTR 3 "25 Oct 04" "libconfig 0.1.16"
|
||||
.SH NAME
|
||||
lc_geterrstr \- Retrieve a human readable error message.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "char *lc_geterrstr(void);"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_geterrstr (3)
|
||||
function returns a string describing the last error code set.
|
||||
|
||||
.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: %s.\\n",
|
||||
lc_geterrstr());
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
|
||||
NULL);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_geterrno (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,61 +0,0 @@
|
||||
.TH LC_GETERRSTR 3 "25 Oct 04" "@PACKAGE_STRING@"
|
||||
.SH NAME
|
||||
lc_geterrstr \- Retrieve a human readable error message.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "char *lc_geterrstr(void);"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_geterrstr (3)
|
||||
function returns a string describing the last error code set.
|
||||
|
||||
.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: %s.\\n",
|
||||
lc_geterrstr());
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
|
||||
NULL);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_geterrno (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,107 +0,0 @@
|
||||
.TH LC_PROCESS 3 "25 Oct 04" "libconfig 0.1.16"
|
||||
.SH NAME
|
||||
lc_process \- Begin processing configuration files.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "int lc_process(int " argc ", char **" argv ", const char *" appname ", lc_conf_type_t " type ", const char *" extra ");"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_process (3)
|
||||
function begins processing of the command line arguments, environment variables, and command line options.
|
||||
The
|
||||
.I argc
|
||||
and
|
||||
.I argv
|
||||
parameters should be in the same format as passed to the
|
||||
.B main
|
||||
function of your program.
|
||||
The
|
||||
.I appname
|
||||
parameter should be a reasonable form of the name of the application.
|
||||
The
|
||||
.I type
|
||||
parameter should describe the format of the configuration file (see below).
|
||||
The
|
||||
.I extra
|
||||
parameter should list any extra configuration files to process.
|
||||
|
||||
Valid type parameter values:
|
||||
.TP
|
||||
LC_CONF_SECTION
|
||||
This type of configuration file is similar to the Windows INI-file style.
|
||||
An example configuration file:
|
||||
.nf
|
||||
[section]
|
||||
variable = value
|
||||
.fi
|
||||
|
||||
.TP
|
||||
LC_CONF_APACHE
|
||||
This type of configuration file is similar to the Apache configuration file.
|
||||
An example configuration file:
|
||||
.nf
|
||||
<Section argument>
|
||||
variable value
|
||||
</Section>
|
||||
.fi
|
||||
|
||||
.TP
|
||||
LC_CONF_SPACE
|
||||
This is a simple, flat configuration file. It has no section headers.
|
||||
An example configuration file:
|
||||
.nf
|
||||
variable value
|
||||
.fi
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
On success 0 is returned, otherwise -1 is returned.
|
||||
|
||||
.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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_geterrno (3),
|
||||
.BR lc_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3)
|
@ -1,107 +0,0 @@
|
||||
.TH LC_PROCESS 3 "25 Oct 04" "@PACKAGE_STRING@"
|
||||
.SH NAME
|
||||
lc_process \- Begin processing configuration files.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "int lc_process(int " argc ", char **" argv ", const char *" appname ", lc_conf_type_t " type ", const char *" extra ");"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_process (3)
|
||||
function begins processing of the command line arguments, environment variables, and command line options.
|
||||
The
|
||||
.I argc
|
||||
and
|
||||
.I argv
|
||||
parameters should be in the same format as passed to the
|
||||
.B main
|
||||
function of your program.
|
||||
The
|
||||
.I appname
|
||||
parameter should be a reasonable form of the name of the application.
|
||||
The
|
||||
.I type
|
||||
parameter should describe the format of the configuration file (see below).
|
||||
The
|
||||
.I extra
|
||||
parameter should list any extra configuration files to process.
|
||||
|
||||
Valid type parameter values:
|
||||
.TP
|
||||
LC_CONF_SECTION
|
||||
This type of configuration file is similar to the Windows INI-file style.
|
||||
An example configuration file:
|
||||
.nf
|
||||
[section]
|
||||
variable = value
|
||||
.fi
|
||||
|
||||
.TP
|
||||
LC_CONF_APACHE
|
||||
This type of configuration file is similar to the Apache configuration file.
|
||||
An example configuration file:
|
||||
.nf
|
||||
<Section argument>
|
||||
variable value
|
||||
</Section>
|
||||
.fi
|
||||
|
||||
.TP
|
||||
LC_CONF_SPACE
|
||||
This is a simple, flat configuration file. It has no section headers.
|
||||
An example configuration file:
|
||||
.nf
|
||||
variable value
|
||||
.fi
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
On success 0 is returned, otherwise -1 is returned.
|
||||
|
||||
.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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_geterrno (3),
|
||||
.BR lc_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3)
|
@ -1,69 +0,0 @@
|
||||
.TH LC_PROCESS_FILE 3 "25 Oct 04" "libconfig 0.1.16"
|
||||
.SH NAME
|
||||
lc_process_file \- Process a specific file
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "int lc_process_file(const char *" appname ", const char *" pathname ", lc_conf_type_t " type ");"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_process_file (3)
|
||||
function processes exactly one configuration file. The file is specified by the
|
||||
.I pathname
|
||||
argument and should be in the format specified by the
|
||||
.I type
|
||||
argument. The
|
||||
.I appname
|
||||
argument should be a reasonable form of the name of the application.
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
On success 0 is returned, otherwise -1 is returned.
|
||||
|
||||
.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_file("example", "/data/extra.conf",
|
||||
LC_CONF_APACHE);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
if (lc_p_ret != 0) {
|
||||
fprintf(stderr, "Error processing configuration file: \\
|
||||
%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_geterrno (3),
|
||||
.BR lc_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process (3)
|
@ -1,69 +0,0 @@
|
||||
.TH LC_PROCESS_FILE 3 "25 Oct 04" "@PACKAGE_STRING@"
|
||||
.SH NAME
|
||||
lc_process_file \- Process a specific file
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "int lc_process_file(const char *" appname ", const char *" pathname ", lc_conf_type_t " type ");"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_process_file (3)
|
||||
function processes exactly one configuration file. The file is specified by the
|
||||
.I pathname
|
||||
argument and should be in the format specified by the
|
||||
.I type
|
||||
argument. The
|
||||
.I appname
|
||||
argument should be a reasonable form of the name of the application.
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
On success 0 is returned, otherwise -1 is returned.
|
||||
|
||||
.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_file("example", "/data/extra.conf",
|
||||
LC_CONF_APACHE);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
if (lc_p_ret != 0) {
|
||||
fprintf(stderr, "Error processing configuration file: \\
|
||||
%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_geterrno (3),
|
||||
.BR lc_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process (3)
|
@ -1,233 +0,0 @@
|
||||
.TH LC_REGISTER_CALLBACK 3 "25 Oct 04" "libconfig 0.1.16"
|
||||
.SH NAME
|
||||
lc_register_callback \- Register a function for callback in config processing.
|
||||
|
||||
.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 ");"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_register_callback (3)
|
||||
function registers a function to be called when
|
||||
.IR var
|
||||
is encounted in a configuration file, command line, or environment variable.
|
||||
The parameters are as follows:
|
||||
.TP
|
||||
.IR "const char *var"
|
||||
.RS
|
||||
The
|
||||
.IR var
|
||||
parameter indicates the name of the variable to register for a callback when encountered in a configuration file, the environment, or as a long option. The
|
||||
.IR var
|
||||
may be prefixed with "*." to indicate that the object can occur in any section or subsection.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.IR "const char opt"
|
||||
.RS
|
||||
The
|
||||
.IR opt
|
||||
parameter indicates the single charectar short option to use from the command line to invoke the register callback. A value of 0 indicates that no short option is acceptable.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.IR "lc_var_type_t type"
|
||||
.RS
|
||||
The
|
||||
.IR type
|
||||
parameter indicates the type of values that are acceptable for this callback. A value of LC_VAR_NONE means that the command will accept no arguments, while a value of LC_VAR_UNKNOWN indicates that it's not known whether or not an argument is applicable, this will also disable command line processing. Any other value is currently ignored.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.IR "int (*callback)(...)"
|
||||
.RS
|
||||
The
|
||||
.IR callback
|
||||
parameter indicates the name of the function to invoke when the above parameters are met. The specified function should take 6 parameters, see below for more information. This value may not be NULL.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.IR "void *extra"
|
||||
.RS
|
||||
The
|
||||
.IR extra
|
||||
parameter is a pointer that can be used to pass data to the callback upon invocation, it will not be mangled or examined by any function.
|
||||
.RE
|
||||
|
||||
The arguments to the function specified as
|
||||
.IR callback
|
||||
are as follows:
|
||||
.TP
|
||||
.I "const char *shortvar"
|
||||
.RS
|
||||
The
|
||||
.I shortvar
|
||||
parameter is the local variable name, provided as a convience. It is the portion of the variable name after the first "dot" (.) in the fully qualified variable name. The "dot" (.) value in the fully qualified variable name indicates a section or subsection that the variable belongs to.
|
||||
This may be
|
||||
.B NULL
|
||||
if the
|
||||
.IR var
|
||||
parameter to
|
||||
.BR lc_register_callback (3)
|
||||
was
|
||||
.B NULL
|
||||
too.
|
||||
.RE
|
||||
.TP
|
||||
.I "const char *var"
|
||||
.RS
|
||||
The
|
||||
.I var
|
||||
parameter is the fully qualified variable name. It includes in the prefix any sections and subsections that contain this variable.
|
||||
This may be
|
||||
.B NULL
|
||||
if the
|
||||
.IR var
|
||||
parameter to
|
||||
.BR lc_register_callback (3)
|
||||
was
|
||||
.B NULL
|
||||
too.
|
||||
.RE
|
||||
.TP
|
||||
.I "const char *arguments"
|
||||
.RS
|
||||
The
|
||||
.I arguments
|
||||
parameter provides the arguments passed to the variable, currently only sections may have arguments.
|
||||
This may be
|
||||
.B NULL
|
||||
if there were no arguments specified, or if arguments were not applicable.
|
||||
.RE
|
||||
.TP
|
||||
.I "const char *value"
|
||||
.RS
|
||||
The
|
||||
.I value
|
||||
parameter provides the value of the variable specified.
|
||||
This may be
|
||||
.B NULL
|
||||
if no value was specified. Values are required if the
|
||||
.IR type
|
||||
parameter to
|
||||
.BR lc_register_callback (3)
|
||||
was not specified as one of LC_VAR_NONE, LC_VAR_SECTION, LC_VAR_SECTIONSTART, or LC_VAR_SECTIONEND.
|
||||
.RE
|
||||
.TP
|
||||
.I "lc_flags_t flags"
|
||||
.RS
|
||||
The flags parameter provides information about the type of command being called. The valid values are:
|
||||
.IP LC_FLAGS_VAR
|
||||
To indicate a regular variable in a configuration file.
|
||||
.IP LC_FLAGS_CMDLINE
|
||||
To indicate a command line option has been used to invoke this option.
|
||||
.IP LC_FLAGS_SECTIONSTART
|
||||
To indicate that this command represents the beginning of a section.
|
||||
.IP LC_FLAGS_SECTIONEND
|
||||
To indicate that this command represents the end of a section.
|
||||
.RE
|
||||
.TP
|
||||
.I "void *extra"
|
||||
.RS
|
||||
The
|
||||
.I extra
|
||||
parameter is just a copy of the
|
||||
.IR extra
|
||||
parameter passed to
|
||||
.BR lc_register_callback (3)
|
||||
when the callback was registered.
|
||||
.RE
|
||||
|
||||
The
|
||||
.IR callback
|
||||
function should return one of three values:
|
||||
.TP
|
||||
LC_CBRET_IGNORESECTION
|
||||
Returning LC_CBRET_IGNORESECTION from a callback that begins a section causes the entire section to be ignored without generating an error.
|
||||
.TP
|
||||
LC_CBRET_OKAY
|
||||
Returning LC_CBRET_OKAY from a callback indicates that all went well and further processing may continue.
|
||||
.TP
|
||||
LC_CBRET_ERROR
|
||||
Returnning LC_CBRET_ERROR from a callback indicates that the command failed for some reason, the error will be passed back down the chain back to the
|
||||
.BR lc_process (3)
|
||||
call that began processing the configuration data. If LC_CBRET_ERROR is returned from a callback that begins a section, the entire section is ignored.
|
||||
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
On success 0 is returned, otherwise -1 is returned.
|
||||
|
||||
.SH EXAMPLE
|
||||
.nf
|
||||
#include <libconfig.h>
|
||||
#include <strings.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int callback_ifmodule(const char *shortvar, const char *var,
|
||||
const char *arguments, const char *value,
|
||||
lc_flags_t flags, void *extra) {
|
||||
if (flags == LC_FLAGS_SECTIONEND) {
|
||||
return(LC_CBRET_OKAY);
|
||||
}
|
||||
|
||||
if (flags != LC_FLAGS_SECTIONSTART) {
|
||||
fprintf(stderr, "IfModule can only be used as a \\
|
||||
section.\\n");
|
||||
return(LC_CBRET_ERROR);
|
||||
}
|
||||
if (arguments == NULL) {
|
||||
fprintf(stderr, "You must specify an argument to \\
|
||||
IfModule.\\n");
|
||||
return(LC_CBRET_ERROR);
|
||||
}
|
||||
|
||||
printf("IfModule %s\\n", arguments);
|
||||
|
||||
if (strcasecmp(arguments, "MyModule") == 0) {
|
||||
return(LC_CBRET_IGNORESECTION);
|
||||
}
|
||||
|
||||
return(LC_CBRET_OKAY);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int lc_rc_ret = 0, lc_p_ret;
|
||||
|
||||
lc_rc_ret = lc_register_callback("*.IfModule", 0, LC_VAR_NONE,
|
||||
callback_ifmodule, NULL);
|
||||
|
||||
if (lc_rc_ret != 0) {
|
||||
fprintf(stderr, "Error registering callback.\\n");
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
|
||||
NULL);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
if (lc_p_ret != 0) {
|
||||
fprintf(stderr, "Error processing configuration: \\
|
||||
%s\\n", lc_geterrstr());
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
.fi
|
||||
|
||||
.SH ERRORS
|
||||
.TP
|
||||
.B ENOMEM
|
||||
Memory could not be allocated to create the needed internal structures.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR lc_register_var (3),
|
||||
.BR lc_geterrno (3),
|
||||
.BR lc_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,233 +0,0 @@
|
||||
.TH LC_REGISTER_CALLBACK 3 "25 Oct 04" "@PACKAGE_STRING@"
|
||||
.SH NAME
|
||||
lc_register_callback \- Register a function for callback in config processing.
|
||||
|
||||
.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 ");"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_register_callback (3)
|
||||
function registers a function to be called when
|
||||
.IR var
|
||||
is encounted in a configuration file, command line, or environment variable.
|
||||
The parameters are as follows:
|
||||
.TP
|
||||
.IR "const char *var"
|
||||
.RS
|
||||
The
|
||||
.IR var
|
||||
parameter indicates the name of the variable to register for a callback when encountered in a configuration file, the environment, or as a long option. The
|
||||
.IR var
|
||||
may be prefixed with "*." to indicate that the object can occur in any section or subsection.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.IR "const char opt"
|
||||
.RS
|
||||
The
|
||||
.IR opt
|
||||
parameter indicates the single charectar short option to use from the command line to invoke the register callback. A value of 0 indicates that no short option is acceptable.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.IR "lc_var_type_t type"
|
||||
.RS
|
||||
The
|
||||
.IR type
|
||||
parameter indicates the type of values that are acceptable for this callback. A value of LC_VAR_NONE means that the command will accept no arguments, while a value of LC_VAR_UNKNOWN indicates that it's not known whether or not an argument is applicable, this will also disable command line processing. Any other value is currently ignored.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.IR "int (*callback)(...)"
|
||||
.RS
|
||||
The
|
||||
.IR callback
|
||||
parameter indicates the name of the function to invoke when the above parameters are met. The specified function should take 6 parameters, see below for more information. This value may not be NULL.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.IR "void *extra"
|
||||
.RS
|
||||
The
|
||||
.IR extra
|
||||
parameter is a pointer that can be used to pass data to the callback upon invocation, it will not be mangled or examined by any function.
|
||||
.RE
|
||||
|
||||
The arguments to the function specified as
|
||||
.IR callback
|
||||
are as follows:
|
||||
.TP
|
||||
.I "const char *shortvar"
|
||||
.RS
|
||||
The
|
||||
.I shortvar
|
||||
parameter is the local variable name, provided as a convience. It is the portion of the variable name after the first "dot" (.) in the fully qualified variable name. The "dot" (.) value in the fully qualified variable name indicates a section or subsection that the variable belongs to.
|
||||
This may be
|
||||
.B NULL
|
||||
if the
|
||||
.IR var
|
||||
parameter to
|
||||
.BR lc_register_callback (3)
|
||||
was
|
||||
.B NULL
|
||||
too.
|
||||
.RE
|
||||
.TP
|
||||
.I "const char *var"
|
||||
.RS
|
||||
The
|
||||
.I var
|
||||
parameter is the fully qualified variable name. It includes in the prefix any sections and subsections that contain this variable.
|
||||
This may be
|
||||
.B NULL
|
||||
if the
|
||||
.IR var
|
||||
parameter to
|
||||
.BR lc_register_callback (3)
|
||||
was
|
||||
.B NULL
|
||||
too.
|
||||
.RE
|
||||
.TP
|
||||
.I "const char *arguments"
|
||||
.RS
|
||||
The
|
||||
.I arguments
|
||||
parameter provides the arguments passed to the variable, currently only sections may have arguments.
|
||||
This may be
|
||||
.B NULL
|
||||
if there were no arguments specified, or if arguments were not applicable.
|
||||
.RE
|
||||
.TP
|
||||
.I "const char *value"
|
||||
.RS
|
||||
The
|
||||
.I value
|
||||
parameter provides the value of the variable specified.
|
||||
This may be
|
||||
.B NULL
|
||||
if no value was specified. Values are required if the
|
||||
.IR type
|
||||
parameter to
|
||||
.BR lc_register_callback (3)
|
||||
was not specified as one of LC_VAR_NONE, LC_VAR_SECTION, LC_VAR_SECTIONSTART, or LC_VAR_SECTIONEND.
|
||||
.RE
|
||||
.TP
|
||||
.I "lc_flags_t flags"
|
||||
.RS
|
||||
The flags parameter provides information about the type of command being called. The valid values are:
|
||||
.IP LC_FLAGS_VAR
|
||||
To indicate a regular variable in a configuration file.
|
||||
.IP LC_FLAGS_CMDLINE
|
||||
To indicate a command line option has been used to invoke this option.
|
||||
.IP LC_FLAGS_SECTIONSTART
|
||||
To indicate that this command represents the beginning of a section.
|
||||
.IP LC_FLAGS_SECTIONEND
|
||||
To indicate that this command represents the end of a section.
|
||||
.RE
|
||||
.TP
|
||||
.I "void *extra"
|
||||
.RS
|
||||
The
|
||||
.I extra
|
||||
parameter is just a copy of the
|
||||
.IR extra
|
||||
parameter passed to
|
||||
.BR lc_register_callback (3)
|
||||
when the callback was registered.
|
||||
.RE
|
||||
|
||||
The
|
||||
.IR callback
|
||||
function should return one of three values:
|
||||
.TP
|
||||
LC_CBRET_IGNORESECTION
|
||||
Returning LC_CBRET_IGNORESECTION from a callback that begins a section causes the entire section to be ignored without generating an error.
|
||||
.TP
|
||||
LC_CBRET_OKAY
|
||||
Returning LC_CBRET_OKAY from a callback indicates that all went well and further processing may continue.
|
||||
.TP
|
||||
LC_CBRET_ERROR
|
||||
Returnning LC_CBRET_ERROR from a callback indicates that the command failed for some reason, the error will be passed back down the chain back to the
|
||||
.BR lc_process (3)
|
||||
call that began processing the configuration data. If LC_CBRET_ERROR is returned from a callback that begins a section, the entire section is ignored.
|
||||
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
On success 0 is returned, otherwise -1 is returned.
|
||||
|
||||
.SH EXAMPLE
|
||||
.nf
|
||||
#include <libconfig.h>
|
||||
#include <strings.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int callback_ifmodule(const char *shortvar, const char *var,
|
||||
const char *arguments, const char *value,
|
||||
lc_flags_t flags, void *extra) {
|
||||
if (flags == LC_FLAGS_SECTIONEND) {
|
||||
return(LC_CBRET_OKAY);
|
||||
}
|
||||
|
||||
if (flags != LC_FLAGS_SECTIONSTART) {
|
||||
fprintf(stderr, "IfModule can only be used as a \\
|
||||
section.\\n");
|
||||
return(LC_CBRET_ERROR);
|
||||
}
|
||||
if (arguments == NULL) {
|
||||
fprintf(stderr, "You must specify an argument to \\
|
||||
IfModule.\\n");
|
||||
return(LC_CBRET_ERROR);
|
||||
}
|
||||
|
||||
printf("IfModule %s\\n", arguments);
|
||||
|
||||
if (strcasecmp(arguments, "MyModule") == 0) {
|
||||
return(LC_CBRET_IGNORESECTION);
|
||||
}
|
||||
|
||||
return(LC_CBRET_OKAY);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int lc_rc_ret = 0, lc_p_ret;
|
||||
|
||||
lc_rc_ret = lc_register_callback("*.IfModule", 0, LC_VAR_NONE,
|
||||
callback_ifmodule, NULL);
|
||||
|
||||
if (lc_rc_ret != 0) {
|
||||
fprintf(stderr, "Error registering callback.\\n");
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
|
||||
NULL);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
if (lc_p_ret != 0) {
|
||||
fprintf(stderr, "Error processing configuration: \\
|
||||
%s\\n", lc_geterrstr());
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
.fi
|
||||
|
||||
.SH ERRORS
|
||||
.TP
|
||||
.B ENOMEM
|
||||
Memory could not be allocated to create the needed internal structures.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR lc_register_var (3),
|
||||
.BR lc_geterrno (3),
|
||||
.BR lc_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,154 +0,0 @@
|
||||
.TH LC_REGISTER_VAR 3 "25 Oct 04" "libconfig 0.1.16"
|
||||
.SH NAME
|
||||
lc_register_var \- Register a variable for automatic processing.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "int lc_register_var(const char *" var ", lc_var_type_t " type ", void *" data ", char " opt ");"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_register_var (3)
|
||||
function registers a variable for automatic processing.
|
||||
The
|
||||
.IR var
|
||||
parameter specifies the variable name for processing. This name can exist in a configuration file, an environment variable, or on the command line.
|
||||
The
|
||||
.IR opt
|
||||
parameter specifies the single letter short option that can be specified on the command line to change the value of the variable specified by the
|
||||
.IR data
|
||||
parameter. A value of '\0' can be specified for no short option.
|
||||
|
||||
The
|
||||
.IR type
|
||||
parameter is of type
|
||||
.IR lc_var_type_t
|
||||
which specifies the type of the
|
||||
.IR data
|
||||
parameter.
|
||||
Valid values for
|
||||
.IR type
|
||||
are:
|
||||
.TP
|
||||
LC_VAR_STRING
|
||||
For a string type variable. The data passed should be of type "char **". The data will be set to a region of memory that has been allocated with malloc() and can be released be free()'d.
|
||||
.TP
|
||||
LC_VAR_LONG_LONG
|
||||
For a "long long" integer type variable. The data passed should be of type "long long *".
|
||||
.TP
|
||||
LC_VAR_LONG
|
||||
For a "long" integer type variable. The data passed should be of type "long *".
|
||||
.TP
|
||||
LC_VAR_INT
|
||||
For a "int" integer type variable. The data passed should be of type "int *".
|
||||
.TP
|
||||
LC_VAR_SHORT
|
||||
For a "short" integer type variable. The data passed should be of type "short *".
|
||||
.TP
|
||||
LC_VAR_BOOL
|
||||
For a boolean type variable. The data passed should be of type "int *". When a true value is specified the variable is set to 1. When a false value is specified the variable is set to 0. Any other value sets the variable to -1. Valid true values are: enable, true, yes, on, y, and 1. Valid false values are: disable, false, off, no, n, and 0.
|
||||
.TP
|
||||
LC_VAR_FILENAME
|
||||
Not implemented.
|
||||
.TP
|
||||
LC_VAR_DIRECTORY
|
||||
Not implemented.
|
||||
.TP
|
||||
LC_VAR_SIZE_LONG_LONG
|
||||
For a "long long" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "long long *".
|
||||
.TP
|
||||
LC_VAR_SIZE_LONG
|
||||
For a "long" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "long *".
|
||||
.TP
|
||||
LC_VAR_SIZE_INT
|
||||
For a "int" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "int *".
|
||||
.TP
|
||||
LC_VAR_SIZE_SHORT
|
||||
For a "short" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "short *".
|
||||
.TP
|
||||
LC_VAR_SIZE_SIZE_T
|
||||
For a "size_t" data type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "size_t *".
|
||||
.TP
|
||||
LC_VAR_TIME
|
||||
Not implemented.
|
||||
.TP
|
||||
LC_VAR_DATE
|
||||
Not implemented.
|
||||
.TP
|
||||
LC_VAR_BOOL_BY_EXISTANCE
|
||||
This type of variable takes no arguments, it is set to true (1) by its existance in a configuration file, environment variable, or on the command line. If it is not specified, the value of the data passed is not changed. The data passed should be of type "int *".
|
||||
.TP
|
||||
LC_VAR_CIDR
|
||||
This type of variable accepts a CIDR format netmask and IP. This is not yet implemented. (XXX)
|
||||
.TP
|
||||
LC_VAR_IP
|
||||
This type of variable accepts an IP address in decimal-dot format. The value is stored in a uint32_t.
|
||||
.TP
|
||||
LC_VAR_ADDR
|
||||
This type of variable accepts an address in either host or decimal-dot format. The value is stored in a uint32_t. This is not yet implemented. (XXX)
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
On success 0 is returned, otherwise -1 is returned.
|
||||
|
||||
.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;
|
||||
long int counter = -1;
|
||||
|
||||
lc_rv_ret = lc_register_var("Begin", LC_VAR_LONG,
|
||||
&counter, 'c');
|
||||
if (lc_rv_ret != 0) {
|
||||
fprintf(stderr, "Error registering variable: %i.\\n",
|
||||
lc_geterrno());
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
if (counter != -1) {
|
||||
printf("Counter was specified as: %ld\\n", counter);
|
||||
} else {
|
||||
printf("Counter was not specified.\\n");
|
||||
}
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
.fi
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR lc_register_callback (3),
|
||||
.BR lc_geterrno (3),
|
||||
.BR lc_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,154 +0,0 @@
|
||||
.TH LC_REGISTER_VAR 3 "25 Oct 04" "@PACKAGE_STRING@"
|
||||
.SH NAME
|
||||
lc_register_var \- Register a variable for automatic processing.
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B #include <libconfig.h>
|
||||
.sp
|
||||
.BI "int lc_register_var(const char *" var ", lc_var_type_t " type ", void *" data ", char " opt ");"
|
||||
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.BR lc_register_var (3)
|
||||
function registers a variable for automatic processing.
|
||||
The
|
||||
.IR var
|
||||
parameter specifies the variable name for processing. This name can exist in a configuration file, an environment variable, or on the command line.
|
||||
The
|
||||
.IR opt
|
||||
parameter specifies the single letter short option that can be specified on the command line to change the value of the variable specified by the
|
||||
.IR data
|
||||
parameter. A value of '\0' can be specified for no short option.
|
||||
|
||||
The
|
||||
.IR type
|
||||
parameter is of type
|
||||
.IR lc_var_type_t
|
||||
which specifies the type of the
|
||||
.IR data
|
||||
parameter.
|
||||
Valid values for
|
||||
.IR type
|
||||
are:
|
||||
.TP
|
||||
LC_VAR_STRING
|
||||
For a string type variable. The data passed should be of type "char **". The data will be set to a region of memory that has been allocated with malloc() and can be released be free()'d.
|
||||
.TP
|
||||
LC_VAR_LONG_LONG
|
||||
For a "long long" integer type variable. The data passed should be of type "long long *".
|
||||
.TP
|
||||
LC_VAR_LONG
|
||||
For a "long" integer type variable. The data passed should be of type "long *".
|
||||
.TP
|
||||
LC_VAR_INT
|
||||
For a "int" integer type variable. The data passed should be of type "int *".
|
||||
.TP
|
||||
LC_VAR_SHORT
|
||||
For a "short" integer type variable. The data passed should be of type "short *".
|
||||
.TP
|
||||
LC_VAR_BOOL
|
||||
For a boolean type variable. The data passed should be of type "int *". When a true value is specified the variable is set to 1. When a false value is specified the variable is set to 0. Any other value sets the variable to -1. Valid true values are: enable, true, yes, on, y, and 1. Valid false values are: disable, false, off, no, n, and 0.
|
||||
.TP
|
||||
LC_VAR_FILENAME
|
||||
Not implemented.
|
||||
.TP
|
||||
LC_VAR_DIRECTORY
|
||||
Not implemented.
|
||||
.TP
|
||||
LC_VAR_SIZE_LONG_LONG
|
||||
For a "long long" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "long long *".
|
||||
.TP
|
||||
LC_VAR_SIZE_LONG
|
||||
For a "long" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "long *".
|
||||
.TP
|
||||
LC_VAR_SIZE_INT
|
||||
For a "int" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "int *".
|
||||
.TP
|
||||
LC_VAR_SIZE_SHORT
|
||||
For a "short" integer type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "short *".
|
||||
.TP
|
||||
LC_VAR_SIZE_SIZE_T
|
||||
For a "size_t" data type that can have size modifiers, such as 'G' or gigabytes, 'M' for megabytes, 'K' for kilobytes. The data passed should be of type "size_t *".
|
||||
.TP
|
||||
LC_VAR_TIME
|
||||
Not implemented.
|
||||
.TP
|
||||
LC_VAR_DATE
|
||||
Not implemented.
|
||||
.TP
|
||||
LC_VAR_BOOL_BY_EXISTANCE
|
||||
This type of variable takes no arguments, it is set to true (1) by its existance in a configuration file, environment variable, or on the command line. If it is not specified, the value of the data passed is not changed. The data passed should be of type "int *".
|
||||
.TP
|
||||
LC_VAR_CIDR
|
||||
This type of variable accepts a CIDR format netmask and IP. This is not yet implemented. (XXX)
|
||||
.TP
|
||||
LC_VAR_IP
|
||||
This type of variable accepts an IP address in decimal-dot format. The value is stored in a uint32_t.
|
||||
.TP
|
||||
LC_VAR_ADDR
|
||||
This type of variable accepts an address in either host or decimal-dot format. The value is stored in a uint32_t. This is not yet implemented. (XXX)
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
On success 0 is returned, otherwise -1 is returned.
|
||||
|
||||
.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;
|
||||
long int counter = -1;
|
||||
|
||||
lc_rv_ret = lc_register_var("Begin", LC_VAR_LONG,
|
||||
&counter, 'c');
|
||||
if (lc_rv_ret != 0) {
|
||||
fprintf(stderr, "Error registering variable: %i.\\n",
|
||||
lc_geterrno());
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
if (counter != -1) {
|
||||
printf("Counter was specified as: %ld\\n", counter);
|
||||
} else {
|
||||
printf("Counter was not specified.\\n");
|
||||
}
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
.fi
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR lc_register_callback (3),
|
||||
.BR lc_geterrno (3),
|
||||
.BR lc_geterrstr (3),
|
||||
.BR lc_cleanup (3),
|
||||
.BR lc_process_file (3),
|
||||
.BR lc_process (3)
|
@ -1,82 +0,0 @@
|
||||
.TH LIBCONFIG 3 "25 Oct 04" "libconfig 0.1.16"
|
||||
.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. Variables (registered through
|
||||
.BR lc_register_var (3)
|
||||
or
|
||||
.BR lc_register_callback (3))
|
||||
are processed with the
|
||||
.BR lc_process (3)
|
||||
and
|
||||
.BR lc_process_file (3)
|
||||
functions. Errors can be examined through
|
||||
.BR lc_geterrno (3)
|
||||
and
|
||||
.BR lc_geterrstr (3).
|
||||
Clean-up may be performed using the
|
||||
.BR lc_cleanup (3)
|
||||
function.
|
||||
|
||||
.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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_cleanup (3),
|
||||
.BR lc_process (3),
|
||||
.BR lc_process_file (3)
|
@ -1,82 +0,0 @@
|
||||
.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. Variables (registered through
|
||||
.BR lc_register_var (3)
|
||||
or
|
||||
.BR lc_register_callback (3))
|
||||
are processed with the
|
||||
.BR lc_process (3)
|
||||
and
|
||||
.BR lc_process_file (3)
|
||||
functions. Errors can be examined through
|
||||
.BR lc_geterrno (3)
|
||||
and
|
||||
.BR lc_geterrstr (3).
|
||||
Clean-up may be performed using the
|
||||
.BR lc_cleanup (3)
|
||||
function.
|
||||
|
||||
.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);
|
||||
|
||||
lc_cleanup();
|
||||
|
||||
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_cleanup (3),
|
||||
.BR lc_process (3),
|
||||
.BR lc_process_file (3)
|
@ -1,954 +0,0 @@
|
||||
#include "compat.h"
|
||||
#include "libconfig.h"
|
||||
#include "libconfig_private.h"
|
||||
#include "conf_section.h"
|
||||
#include "conf_apache.h"
|
||||
#include "conf_colon.h"
|
||||
#include "conf_equal.h"
|
||||
#include "conf_space.h"
|
||||
#include "conf_xml.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
struct lc_varhandler_st *varhandlers = NULL;
|
||||
lc_err_t lc_errno = LC_ERR_NONE;
|
||||
int lc_optind = 0;
|
||||
|
||||
extern char **environ;
|
||||
|
||||
static int lc_process_var_string(void *data, const char *value) {
|
||||
char **dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = strdup(value);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_cidr(void *data, const char *value) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_ip(void *data, const char *value) {
|
||||
uint32_t *dataval = NULL, retval = 0;
|
||||
const char *dotptr = NULL;
|
||||
int tmpval = -1;
|
||||
|
||||
dataval = data;
|
||||
|
||||
dotptr = value;
|
||||
|
||||
while (1) {
|
||||
tmpval = atoi(dotptr);
|
||||
if (tmpval < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
retval <<= 8;
|
||||
retval |= tmpval;
|
||||
|
||||
dotptr = strpbrk(dotptr, "./ \t");
|
||||
if (dotptr == NULL) {
|
||||
break;
|
||||
}
|
||||
if (*dotptr != '.') {
|
||||
break;
|
||||
}
|
||||
dotptr++;
|
||||
}
|
||||
|
||||
*dataval = retval;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_longlong(void *data, const char *value) {
|
||||
long long *dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = strtoll(value, NULL, 10);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_long(void *data, const char *value) {
|
||||
long *dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = strtoll(value, NULL, 10);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_int(void *data, const char *value) {
|
||||
int *dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = strtoll(value, NULL, 10);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_short(void *data, const char *value) {
|
||||
short *dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = strtoll(value, NULL, 10);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_bool_byexistance(void *data, const char *value) {
|
||||
int *dataval;
|
||||
|
||||
dataval = data;
|
||||
|
||||
*dataval = 1;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_bool(void *data, const char *value) {
|
||||
int *dataval;
|
||||
|
||||
dataval = data;
|
||||
|
||||
*dataval = -1;
|
||||
|
||||
if (strcasecmp(value, "enable") == 0 ||
|
||||
strcasecmp(value, "true") == 0 ||
|
||||
strcasecmp(value, "yes") == 0 ||
|
||||
strcasecmp(value, "on") == 0 ||
|
||||
strcasecmp(value, "y") == 0 ||
|
||||
strcasecmp(value, "1") == 0) {
|
||||
*dataval = 1;
|
||||
return(0);
|
||||
} else if (strcasecmp(value, "disable") == 0 ||
|
||||
strcasecmp(value, "false") == 0 ||
|
||||
strcasecmp(value, "off") == 0 ||
|
||||
strcasecmp(value, "no") == 0 ||
|
||||
strcasecmp(value, "n") == 0 ||
|
||||
strcasecmp(value, "0") == 0) {
|
||||
*dataval = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
lc_errno = LC_ERR_BADFORMAT;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
static long long lc_process_size(const char *value) {
|
||||
long long retval = -1;
|
||||
char *mult = NULL;
|
||||
|
||||
retval = strtoll(value, &mult, 10);
|
||||
if (mult != NULL) {
|
||||
switch (tolower(mult[0])) {
|
||||
case 'p':
|
||||
retval *= 1125899906842624LLU;
|
||||
break;
|
||||
case 't':
|
||||
retval *= 1958505086976LLU;
|
||||
break;
|
||||
case 'g':
|
||||
retval *= 1073741824;
|
||||
break;
|
||||
case 'm':
|
||||
retval *= 1048576;
|
||||
break;
|
||||
case 'k':
|
||||
retval *= 1024;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
||||
static int lc_process_var_sizelonglong(void *data, const char *value) {
|
||||
long long *dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = lc_process_size(value);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_sizelong(void *data, const char *value) {
|
||||
long *dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = lc_process_size(value);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_sizeint(void *data, const char *value) {
|
||||
int *dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = lc_process_size(value);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_sizeshort(void *data, const char *value) {
|
||||
short *dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = lc_process_size(value);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_var_sizesizet(void *data, const char *value) {
|
||||
size_t *dataval;
|
||||
|
||||
dataval = data;
|
||||
*dataval = lc_process_size(value);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static int lc_handle_type(lc_var_type_t type, const char *value, void *data) {
|
||||
switch (type) {
|
||||
case LC_VAR_STRING:
|
||||
return(lc_process_var_string(data, value));
|
||||
break;
|
||||
case LC_VAR_LONG_LONG:
|
||||
return(lc_process_var_longlong(data, value));
|
||||
break;
|
||||
case LC_VAR_LONG:
|
||||
return(lc_process_var_long(data, value));
|
||||
break;
|
||||
case LC_VAR_INT:
|
||||
return(lc_process_var_int(data, value));
|
||||
break;
|
||||
case LC_VAR_SHORT:
|
||||
return(lc_process_var_short(data, value));
|
||||
break;
|
||||
case LC_VAR_BOOL:
|
||||
return(lc_process_var_bool(data, value));
|
||||
break;
|
||||
case LC_VAR_SIZE_LONG_LONG:
|
||||
return(lc_process_var_sizelonglong(data, value));
|
||||
break;
|
||||
case LC_VAR_SIZE_LONG:
|
||||
return(lc_process_var_sizelong(data, value));
|
||||
break;
|
||||
case LC_VAR_SIZE_INT:
|
||||
return(lc_process_var_sizeint(data, value));
|
||||
break;
|
||||
case LC_VAR_SIZE_SHORT:
|
||||
return(lc_process_var_sizeshort(data, value));
|
||||
break;
|
||||
case LC_VAR_BOOL_BY_EXISTANCE:
|
||||
return(lc_process_var_bool_byexistance(data, value));
|
||||
break;
|
||||
case LC_VAR_SIZE_SIZE_T:
|
||||
return(lc_process_var_sizesizet(data, value));
|
||||
break;
|
||||
case LC_VAR_IP:
|
||||
return(lc_process_var_ip(data, value));
|
||||
break;
|
||||
case LC_VAR_CIDR:
|
||||
return(lc_process_var_cidr(data, value));
|
||||
break;
|
||||
case LC_VAR_TIME:
|
||||
case LC_VAR_DATE:
|
||||
case LC_VAR_FILENAME:
|
||||
case LC_VAR_DIRECTORY:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Not implemented yet!\n");
|
||||
#endif
|
||||
return(-1);
|
||||
case LC_VAR_NONE:
|
||||
case LC_VAR_UNKNOWN:
|
||||
case LC_VAR_SECTION:
|
||||
case LC_VAR_SECTIONSTART:
|
||||
case LC_VAR_SECTIONEND:
|
||||
return(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
static int lc_handle(struct lc_varhandler_st *handler, const char *var, const char *varargs, const char *value, lc_flags_t flags) {
|
||||
const char *localvar = NULL;
|
||||
int retval;
|
||||
|
||||
if (var != NULL) {
|
||||
localvar = strrchr(var, '.');
|
||||
if (localvar == NULL) {
|
||||
localvar = var;
|
||||
} else {
|
||||
localvar++;
|
||||
}
|
||||
} else {
|
||||
localvar = NULL;
|
||||
}
|
||||
|
||||
switch (handler->mode) {
|
||||
case LC_MODE_CALLBACK:
|
||||
if (handler->callback != NULL) {
|
||||
retval = handler->callback(localvar, var, varargs, value, flags, handler->extra);
|
||||
if (retval < 0) {
|
||||
lc_errno = LC_ERR_CALLBACK;
|
||||
}
|
||||
return(retval);
|
||||
}
|
||||
break;
|
||||
case LC_MODE_VAR:
|
||||
return(lc_handle_type(handler->type, value, handler->data));
|
||||
break;
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
static int lc_process_environment(const char *appname) {
|
||||
#ifndef ENABLE_SMALL
|
||||
struct lc_varhandler_st *handler = NULL;
|
||||
size_t appnamelen = 0;
|
||||
char varnamebuf[128] = {0};
|
||||
char **currvar;
|
||||
char *sep = NULL, *value = NULL, *cmd = NULL;
|
||||
char *ucase_appname = NULL, *ucase_appname_itr = NULL;
|
||||
char *lastcomponent_handler = NULL;
|
||||
int varnamelen = 0;
|
||||
|
||||
/* Make sure we have an environment to screw with, if not,
|
||||
no arguments were found to be in error */
|
||||
if (environ == NULL || appname == NULL) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Allocate and create our uppercase appname. */
|
||||
ucase_appname = strdup(appname);
|
||||
if (ucase_appname == NULL) {
|
||||
lc_errno = LC_ERR_ENOMEM;
|
||||
return(-1);
|
||||
}
|
||||
for (ucase_appname_itr = ucase_appname; *ucase_appname_itr != '\0'; ucase_appname_itr++) {
|
||||
*ucase_appname_itr = toupper(*ucase_appname_itr);
|
||||
}
|
||||
|
||||
appnamelen = strlen(ucase_appname);
|
||||
|
||||
for (currvar = environ; *currvar != NULL; currvar++) {
|
||||
/* If it doesn't begin with our appname ignore it completely. */
|
||||
if (strncmp(*currvar, ucase_appname, appnamelen) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find our seperator. */
|
||||
sep = strchr(*currvar, '=');
|
||||
if (sep == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
varnamelen = sep - *currvar;
|
||||
|
||||
/* Skip variables that would overflow our buffer. */
|
||||
if (varnamelen >= sizeof(varnamebuf)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
strncpy(varnamebuf, *currvar, varnamelen);
|
||||
|
||||
varnamebuf[varnamelen] = '\0';
|
||||
value = sep + 1;
|
||||
|
||||
/* We ignore APPNAME by itself. */
|
||||
if (strlen(varnamebuf) <= appnamelen) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Further it must be <APPNAME>_ */
|
||||
if (varnamebuf[appnamelen] != '_') {
|
||||
continue;
|
||||
}
|
||||
|
||||
cmd = varnamebuf + appnamelen + 1;
|
||||
|
||||
/* We don't allow section specifiers, for reasons see notes in
|
||||
the cmdline processor (below). */
|
||||
if (strchr(cmd, '.') != NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (handler = varhandlers; handler != NULL; handler = handler->_next) {
|
||||
if (handler->var == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Skip handlers which don't agree with being
|
||||
processed outside a config file */
|
||||
if (handler->type == LC_VAR_SECTION ||
|
||||
handler->type == LC_VAR_SECTIONSTART ||
|
||||
handler->type == LC_VAR_SECTIONEND ||
|
||||
handler->type == LC_VAR_UNKNOWN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find the last part of the variable and compare it with
|
||||
the option being processed, if a wildcard is given. */
|
||||
if (handler->var[0] == '*' && handler->var[1] == '.') {
|
||||
lastcomponent_handler = strrchr(handler->var, '.');
|
||||
if (lastcomponent_handler == NULL) {
|
||||
lastcomponent_handler = handler->var;
|
||||
} else {
|
||||
lastcomponent_handler++;
|
||||
}
|
||||
} else {
|
||||
lastcomponent_handler = handler->var;
|
||||
}
|
||||
|
||||
/* Ignore this handler if they don't match. */
|
||||
if (strcasecmp(lastcomponent_handler, cmd) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (handler->type == LC_VAR_NONE || handler->type == LC_VAR_BOOL_BY_EXISTANCE) {
|
||||
value = NULL;
|
||||
}
|
||||
|
||||
/* We ignore errors from the environment variables,
|
||||
they're mostly insignificant. */
|
||||
lc_handle(handler, cmd, NULL, value, LC_FLAGS_ENVIRON);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(ucase_appname);
|
||||
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int lc_process_cmdline(int argc, char **argv) {
|
||||
struct lc_varhandler_st *handler = NULL;
|
||||
char *cmdarg = NULL, *cmdoptarg = NULL;
|
||||
char *lastcomponent_handler = NULL;
|
||||
char **newargv = NULL;
|
||||
char *usedargv = NULL;
|
||||
int cmdargidx = 0;
|
||||
int newargvidx = 0;
|
||||
int retval = 0, chkretval = 0;
|
||||
int ch = 0;
|
||||
|
||||
/* Allocate "argc + 1" (+1 for the NULL terminator) elements. */
|
||||
newargv = malloc((argc + 1) * sizeof(*newargv));
|
||||
if (newargv == NULL) {
|
||||
lc_errno = LC_ERR_ENOMEM;
|
||||
return(-1);
|
||||
}
|
||||
newargv[newargvidx++] = argv[0];
|
||||
newargv[argc] = NULL;
|
||||
|
||||
/* Allocate space to indicate which arguments have been used. */
|
||||
usedargv = malloc(argc * sizeof(*usedargv));
|
||||
if (usedargv == NULL) {
|
||||
lc_errno = LC_ERR_ENOMEM;
|
||||
free(newargv);
|
||||
return(-1);
|
||||
}
|
||||
for (cmdargidx = 0; cmdargidx < argc; cmdargidx++) {
|
||||
usedargv[cmdargidx] = 0;
|
||||
}
|
||||
|
||||
for (cmdargidx = 1; cmdargidx < argc; cmdargidx++) {
|
||||
cmdarg = argv[cmdargidx];
|
||||
|
||||
/* Make sure we have an argument here. */
|
||||
if (cmdarg == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* If the argument isn't an option, abort. */
|
||||
if (cmdarg[0] != '-') {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Setup a pointer in the new array for the actual argument. */
|
||||
newargv[newargvidx++] = cmdarg;
|
||||
usedargv[cmdargidx] = 1;
|
||||
|
||||
/* Then shift the argument past the '-' so we can ignore it. */
|
||||
cmdarg++;
|
||||
|
||||
/* Handle long options. */
|
||||
if (cmdarg[0] == '-') {
|
||||
cmdarg++;
|
||||
|
||||
/* Don't process arguments after the '--' option. */
|
||||
if (cmdarg[0] == '\0') {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Look for a variable name that matches */
|
||||
for (handler = varhandlers; handler != NULL; handler = handler->_next) {
|
||||
/* Skip handlers with no variable name. */
|
||||
if (handler->var == NULL) {
|
||||
continue;
|
||||
}
|
||||
/* Skip handlers which don't agree with being
|
||||
processed on the command line. */
|
||||
if (handler->type == LC_VAR_SECTION ||
|
||||
handler->type == LC_VAR_SECTIONSTART ||
|
||||
handler->type == LC_VAR_SECTIONEND ||
|
||||
handler->type == LC_VAR_UNKNOWN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find the last part of the variable and compare it with
|
||||
the option being processed, if a wildcard is given. */
|
||||
if (handler->var[0] == '*' && handler->var[1] == '.') {
|
||||
lastcomponent_handler = strrchr(handler->var, '.');
|
||||
if (lastcomponent_handler == NULL) {
|
||||
lastcomponent_handler = handler->var;
|
||||
} else {
|
||||
lastcomponent_handler++;
|
||||
}
|
||||
} else {
|
||||
/* Disallow use of the fully qualified name
|
||||
since there was no sectionstart portion
|
||||
we cannot allow it to handle children of it. */
|
||||
if (strchr(cmdarg, '.') != NULL) {
|
||||
continue;
|
||||
}
|
||||
lastcomponent_handler = handler->var;
|
||||
}
|
||||
|
||||
/* Ignore this handler if they don't match. */
|
||||
if (strcasecmp(lastcomponent_handler, cmdarg) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (handler->type == LC_VAR_NONE || handler->type == LC_VAR_BOOL_BY_EXISTANCE) {
|
||||
cmdoptarg = NULL;
|
||||
} else {
|
||||
cmdargidx++;
|
||||
if (cmdargidx >= argc) {
|
||||
fprintf(stderr, "Argument required.\n");
|
||||
lc_errno = LC_ERR_BADFORMAT;
|
||||
free(usedargv);
|
||||
free(newargv);
|
||||
return(-1);
|
||||
}
|
||||
cmdoptarg = argv[cmdargidx];
|
||||
newargv[newargvidx++] = cmdoptarg;
|
||||
usedargv[cmdargidx] = 1;
|
||||
}
|
||||
|
||||
chkretval = lc_handle(handler, handler->var, NULL, cmdoptarg, LC_FLAGS_CMDLINE);
|
||||
if (chkretval < 0) {
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (handler == NULL) {
|
||||
fprintf(stderr, "Unknown option: --%s\n", cmdarg);
|
||||
lc_errno = LC_ERR_INVCMD;
|
||||
free(usedargv);
|
||||
free(newargv);
|
||||
return(-1);
|
||||
}
|
||||
} else {
|
||||
for (; *cmdarg != '\0'; cmdarg++) {
|
||||
ch = *cmdarg;
|
||||
|
||||
for (handler = varhandlers; handler != NULL; handler = handler->_next) {
|
||||
if (handler->opt != ch || handler->opt == '\0') {
|
||||
continue;
|
||||
}
|
||||
/* Skip handlers which don't agree with being
|
||||
processed on the command line. */
|
||||
if (handler->type == LC_VAR_SECTION ||
|
||||
handler->type == LC_VAR_SECTIONSTART ||
|
||||
handler->type == LC_VAR_SECTIONEND ||
|
||||
handler->type == LC_VAR_UNKNOWN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (handler->type == LC_VAR_NONE || handler->type == LC_VAR_BOOL_BY_EXISTANCE) {
|
||||
cmdoptarg = NULL;
|
||||
} else {
|
||||
cmdargidx++;
|
||||
if (cmdargidx >= argc) {
|
||||
fprintf(stderr, "Argument required.\n");
|
||||
lc_errno = LC_ERR_BADFORMAT;
|
||||
free(usedargv);
|
||||
free(newargv);
|
||||
return(-1);
|
||||
}
|
||||
cmdoptarg = argv[cmdargidx];
|
||||
newargv[newargvidx++] = cmdoptarg;
|
||||
usedargv[cmdargidx] = 1;
|
||||
}
|
||||
|
||||
chkretval = lc_handle(handler, handler->var, NULL, cmdoptarg, LC_FLAGS_CMDLINE);
|
||||
if (chkretval < 0) {
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (handler == NULL) {
|
||||
fprintf(stderr, "Unknown option: -%c\n", ch);
|
||||
lc_errno = LC_ERR_INVCMD;
|
||||
free(usedargv);
|
||||
free(newargv);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (retval >= 0) {
|
||||
lc_optind = newargvidx;
|
||||
for (cmdargidx = 1; cmdargidx < argc; cmdargidx++) {
|
||||
if (usedargv[cmdargidx] != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cmdarg = argv[cmdargidx];
|
||||
|
||||
newargv[newargvidx++] = cmdarg;
|
||||
}
|
||||
for (cmdargidx = 1; cmdargidx < argc; cmdargidx++) {
|
||||
argv[cmdargidx] = newargv[cmdargidx];
|
||||
}
|
||||
}
|
||||
|
||||
free(usedargv);
|
||||
free(newargv);
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
||||
|
||||
int lc_process_var(const char *var, const char *varargs, const char *value, lc_flags_t flags) {
|
||||
struct lc_varhandler_st *handler = NULL;
|
||||
const char *lastcomponent_handler = NULL, *lastcomponent_var = NULL;
|
||||
|
||||
lastcomponent_var = strrchr(var, '.');
|
||||
if (lastcomponent_var == NULL) {
|
||||
lastcomponent_var = var;
|
||||
} else {
|
||||
lastcomponent_var++;
|
||||
}
|
||||
|
||||
for (handler = varhandlers; handler != NULL; handler = handler->_next) {
|
||||
/* If either handler->var or var is NULL, skip, unless both are NULL. */
|
||||
if (handler->var != var && (handler->var == NULL || var == NULL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If both are not-NULL, compare them. */
|
||||
if (handler->var != NULL) {
|
||||
/* Wild-card-ish match. */
|
||||
if (handler->var[0] == '*' && handler->var[1] == '.') {
|
||||
/* Only compare the last components */
|
||||
|
||||
lastcomponent_handler = strrchr(handler->var, '.') + 1; /* strrchr() won't return NULL, because we already checked it. */
|
||||
|
||||
if (strcasecmp(lastcomponent_handler, lastcomponent_var) != 0) {
|
||||
continue;
|
||||
}
|
||||
} else if (strcasecmp(handler->var, var) != 0) {
|
||||
/* Exact (case-insensitive comparison) failed. */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (value == NULL &&
|
||||
handler->type != LC_VAR_NONE &&
|
||||
handler->type != LC_VAR_BOOL_BY_EXISTANCE &&
|
||||
handler->type != LC_VAR_SECTION &&
|
||||
handler->type != LC_VAR_SECTIONSTART &&
|
||||
handler->type != LC_VAR_SECTIONEND) {
|
||||
lc_errno = LC_ERR_BADFORMAT;
|
||||
break;
|
||||
}
|
||||
|
||||
return(lc_handle(handler, var, varargs, value, flags));
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
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) {
|
||||
struct lc_varhandler_st *newhandler = NULL;
|
||||
|
||||
newhandler = malloc(sizeof(*newhandler));
|
||||
|
||||
if (newhandler == NULL) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (var == NULL) {
|
||||
newhandler->var = NULL;
|
||||
} else {
|
||||
newhandler->var = strdup(var);
|
||||
}
|
||||
newhandler->mode = LC_MODE_CALLBACK;
|
||||
newhandler->type = type;
|
||||
newhandler->callback = callback;
|
||||
newhandler->opt = opt;
|
||||
newhandler->extra = extra;
|
||||
newhandler->_next = varhandlers;
|
||||
|
||||
varhandlers = newhandler;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt) {
|
||||
struct lc_varhandler_st *newhandler = NULL;
|
||||
|
||||
newhandler = malloc(sizeof(*newhandler));
|
||||
|
||||
if (newhandler == NULL) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (var == NULL) {
|
||||
newhandler->var = NULL;
|
||||
} else {
|
||||
newhandler->var = strdup(var);
|
||||
}
|
||||
newhandler->mode = LC_MODE_VAR;
|
||||
newhandler->type = type;
|
||||
newhandler->data = data;
|
||||
newhandler->opt = opt;
|
||||
newhandler->extra = NULL;
|
||||
newhandler->_next = varhandlers;
|
||||
|
||||
varhandlers = newhandler;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type) {
|
||||
int chkretval = 0;
|
||||
|
||||
switch (type) {
|
||||
case LC_CONF_SECTION:
|
||||
chkretval = lc_process_conf_section(appname, pathname);
|
||||
break;
|
||||
case LC_CONF_APACHE:
|
||||
chkretval = lc_process_conf_apache(appname, pathname);
|
||||
break;
|
||||
case LC_CONF_COLON:
|
||||
chkretval = lc_process_conf_colon(appname, pathname);
|
||||
break;
|
||||
case LC_CONF_EQUAL:
|
||||
chkretval = lc_process_conf_equal(appname, pathname);
|
||||
break;
|
||||
case LC_CONF_SPACE:
|
||||
chkretval = lc_process_conf_space(appname, pathname);
|
||||
break;
|
||||
case LC_CONF_XML:
|
||||
chkretval = lc_process_conf_xml(appname, pathname);
|
||||
break;
|
||||
default:
|
||||
chkretval = -1;
|
||||
lc_errno = LC_ERR_INVDATA;
|
||||
break;
|
||||
}
|
||||
|
||||
return(chkretval);
|
||||
}
|
||||
|
||||
static int lc_process_files(const char *appname, lc_conf_type_t type, const char *extraconfig) {
|
||||
#ifdef HAVE_GETPWUID
|
||||
struct passwd *pwinfo = NULL;
|
||||
#endif
|
||||
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");
|
||||
#ifdef HAVE_GETPWUID
|
||||
if (homedir == NULL) {
|
||||
pwinfo = getpwuid(getuid());
|
||||
if (pwinfo != NULL) {
|
||||
homedir = pwinfo->pw_dir;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (homedir != NULL) {
|
||||
if (strcmp(homedir, "/") != 0 && access(homedir, R_OK|W_OK|X_OK) == 0) {
|
||||
snprintf(configfiles[2][0], sizeof(**configfiles) - 1, "%s/.%src", homedir, appname);
|
||||
snprintf(configfiles[2][1], sizeof(**configfiles) - 1, "%s/.%s.cfg", homedir, appname);
|
||||
snprintf(configfiles[2][2], sizeof(**configfiles) - 1, "%s/.%s.conf", homedir, appname);
|
||||
snprintf(configfiles[2][3], sizeof(**configfiles) - 1, "%s/.%s/%s.cfg", homedir, appname, appname);
|
||||
snprintf(configfiles[2][4], sizeof(**configfiles) - 1, "%s/.%s/%s.conf", homedir, appname, appname);
|
||||
snprintf(configfiles[2][5], sizeof(**configfiles) - 1, "%s/.%s/config", homedir, appname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (configsetidx = 0; configsetidx < 3; configsetidx++) {
|
||||
for (configidx = 0; configidx < 13; configidx++) {
|
||||
configfile = configfiles[configsetidx][configidx];
|
||||
if (configfile[0] == '\0') {
|
||||
break;
|
||||
}
|
||||
if (access(configfile, R_OK) == 0) {
|
||||
chkretval = lc_process_file(appname, configfile, type);
|
||||
if (chkretval < 0) {
|
||||
retval = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
||||
void lc_cleanup(void) {
|
||||
struct lc_varhandler_st *handler = NULL, *next = NULL;
|
||||
|
||||
handler = varhandlers;
|
||||
while (handler != NULL) {
|
||||
if (handler->var != NULL) {
|
||||
free(handler->var);
|
||||
}
|
||||
|
||||
next = handler->_next;
|
||||
|
||||
free(handler);
|
||||
|
||||
handler = next;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int lc_process(int argc, char **argv, const char *appname, lc_conf_type_t type, const char *extra) {
|
||||
int retval = 0, chkretval = 0;
|
||||
|
||||
/* Handle config files. */
|
||||
chkretval = lc_process_files(appname, type, extra);
|
||||
if (chkretval < 0) {
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
/* Handle environment variables.*/
|
||||
chkretval = lc_process_environment(appname);
|
||||
if (chkretval < 0) {
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
/* Handle command line arguments */
|
||||
chkretval = lc_process_cmdline(argc, argv);
|
||||
if (chkretval < 0) {
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
||||
|
||||
lc_err_t lc_geterrno(void) {
|
||||
lc_err_t retval;
|
||||
|
||||
retval = lc_errno;
|
||||
|
||||
lc_errno = LC_ERR_NONE;
|
||||
|
||||
return(retval);
|
||||
}
|
||||
|
||||
char *lc_geterrstr(void) {
|
||||
char *retval = NULL;
|
||||
|
||||
switch (lc_errno) {
|
||||
case LC_ERR_NONE:
|
||||
retval = "Success";
|
||||
break;
|
||||
case LC_ERR_INVCMD:
|
||||
retval = "Invalid command";
|
||||
break;
|
||||
case LC_ERR_INVSECTION:
|
||||
retval = "Invalid section";
|
||||
break;
|
||||
case LC_ERR_INVDATA:
|
||||
retval = "Invalid application data (internal error)";
|
||||
break;
|
||||
case LC_ERR_BADFORMAT:
|
||||
retval = "Bad data specified or incorrect format.";
|
||||
break;
|
||||
case LC_ERR_CANTOPEN:
|
||||
retval = "Can't open file.";
|
||||
break;
|
||||
case LC_ERR_CALLBACK:
|
||||
retval = "Error return from application handler.";
|
||||
break;
|
||||
case LC_ERR_ENOMEM:
|
||||
retval = "Insuffcient memory.";
|
||||
break;
|
||||
}
|
||||
|
||||
lc_errno = LC_ERR_NONE;
|
||||
|
||||
if (retval != NULL) {
|
||||
return(retval);
|
||||
}
|
||||
return("Unknown error");
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
!ifndef _RSK_LIBCONFIG_H
|
||||
!define _RSK_LIBCONFIG_H
|
||||
|
||||
!ifdef __cplusplus
|
||||
extern "C" {
|
||||
!endif
|
||||
__BLANK_LINE__
|
||||
|
||||
typedef enum {
|
||||
LC_CONF_SECTION,
|
||||
LC_CONF_APACHE,
|
||||
LC_CONF_COLON,
|
||||
LC_CONF_EQUAL,
|
||||
LC_CONF_SPACE,
|
||||
LC_CONF_XML
|
||||
} lc_conf_type_t;
|
||||
|
||||
__BLANK_LINE__
|
||||
|
||||
typedef enum {
|
||||
LC_VAR_UNKNOWN,
|
||||
LC_VAR_NONE,
|
||||
LC_VAR_STRING,
|
||||
LC_VAR_LONG_LONG,
|
||||
LC_VAR_LONG,
|
||||
LC_VAR_INT,
|
||||
LC_VAR_SHORT,
|
||||
LC_VAR_BOOL,
|
||||
LC_VAR_FILENAME,
|
||||
LC_VAR_DIRECTORY,
|
||||
LC_VAR_SIZE_LONG_LONG,
|
||||
LC_VAR_SIZE_LONG,
|
||||
LC_VAR_SIZE_INT,
|
||||
LC_VAR_SIZE_SHORT,
|
||||
LC_VAR_TIME,
|
||||
LC_VAR_DATE,
|
||||
LC_VAR_SECTION,
|
||||
LC_VAR_SECTIONSTART,
|
||||
LC_VAR_SECTIONEND,
|
||||
LC_VAR_BOOL_BY_EXISTANCE,
|
||||
LC_VAR_SIZE_SIZE_T,
|
||||
LC_VAR_CIDR,
|
||||
LC_VAR_IP,
|
||||
} lc_var_type_t;
|
||||
|
||||
__BLANK_LINE__
|
||||
|
||||
typedef enum {
|
||||
LC_FLAGS_VAR,
|
||||
LC_FLAGS_CMDLINE,
|
||||
LC_FLAGS_ENVIRON,
|
||||
LC_FLAGS_SECTIONSTART,
|
||||
LC_FLAGS_SECTIONEND
|
||||
} lc_flags_t;
|
||||
|
||||
__BLANK_LINE__
|
||||
|
||||
typedef enum {
|
||||
LC_ERR_NONE,
|
||||
LC_ERR_INVCMD,
|
||||
LC_ERR_INVSECTION,
|
||||
LC_ERR_INVDATA,
|
||||
LC_ERR_BADFORMAT,
|
||||
LC_ERR_CANTOPEN,
|
||||
LC_ERR_CALLBACK,
|
||||
LC_ERR_ENOMEM
|
||||
} lc_err_t;
|
||||
|
||||
__BLANK_LINE__
|
||||
|
||||
int lc_process(int argc, char **argv, const char *appname, lc_conf_type_t type, const char *extra);
|
||||
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);
|
||||
int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt);
|
||||
lc_err_t lc_geterrno(void);
|
||||
char *lc_geterrstr(void);
|
||||
int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type);
|
||||
void lc_cleanup(void);
|
||||
|
||||
__BLANK_LINE__
|
||||
|
||||
!define LC_CBRET_IGNORESECTION (255)
|
||||
!define LC_CBRET_OKAY (0)
|
||||
!define LC_CBRET_ERROR (-1)
|
||||
|
||||
__BLANK_LINE__
|
||||
|
||||
extern int lc_optind;
|
||||
|
||||
__BLANK_LINE__
|
||||
!ifdef __cplusplus
|
||||
}
|
||||
!endif
|
||||
|
||||
!endif
|
@ -1,42 +0,0 @@
|
||||
# RPM Spec file for "libconfig"
|
||||
Summary: Common configuration file parsing library.
|
||||
Name: libconfig
|
||||
Version: 0.1.16
|
||||
Release: 1
|
||||
Copyright: MIT
|
||||
Group: System Environment/Libraries
|
||||
Source: http://www.rkeene.org/files/oss/libconfig/devel/libconfig-0.1.16.tar.gz
|
||||
URL: http://www.rkeene.org/oss/libconfig/
|
||||
Vendor: Keene Enterprises
|
||||
Packager: Roy Keene <libconfig@rkeene.org>
|
||||
|
||||
%description
|
||||
libconfig is common configuration file parsing library.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var || exit 1
|
||||
make
|
||||
|
||||
%install
|
||||
make install
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc README
|
||||
%doc AUTHORS
|
||||
/usr/lib/libconfig.a
|
||||
/usr/lib/libconfig.so
|
||||
/usr/lib/libconfig.so.0.1.16
|
||||
/usr/lib/libconfig.so.0
|
||||
/usr/include/libconfig.h
|
||||
/usr/man/man3/lc_register_callback.3
|
||||
/usr/man/man3/lc_register_var.3
|
||||
/usr/man/man3/lc_process_file.3
|
||||
/usr/man/man3/lc_geterrstr.3
|
||||
/usr/man/man3/lc_geterrno.3
|
||||
/usr/man/man3/lc_process.3
|
||||
/usr/man/man3/lc_cleanup.3
|
||||
/usr/man/man3/libconfig.3
|
@ -1,26 +0,0 @@
|
||||
#ifndef _RSK_LIBCONFIG_PRIVATE_H
|
||||
#define _RSK_LIBCONFIG_PRIVATE_H
|
||||
|
||||
#include "libconfig.h"
|
||||
|
||||
extern lc_err_t lc_errno;
|
||||
|
||||
int lc_process_var(const char *var, const char *varargs, const char *value, lc_flags_t flags);
|
||||
|
||||
struct lc_varhandler_st;
|
||||
|
||||
struct lc_varhandler_st {
|
||||
struct lc_varhandler_st *_next;
|
||||
char *var;
|
||||
char opt;
|
||||
lc_var_type_t type;
|
||||
enum {
|
||||
LC_MODE_CALLBACK,
|
||||
LC_MODE_VAR
|
||||
} mode;
|
||||
int (*callback)();
|
||||
void *data;
|
||||
void *extra;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2001, 2002, and 2003 Roy Keene
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* email: libconfig@rkeene.org
|
||||
*/
|
||||
|
||||
/* Compliments of Jay Freeman <saurik@saurik.com> */
|
||||
|
||||
#include <string.h>
|
||||
#include "strsep.h"
|
||||
|
||||
char *strsep(char **stringp, const char *delim) {
|
||||
char *ret = *stringp;
|
||||
if (ret == NULL) return(NULL); /* grrr */
|
||||
if ((*stringp = strpbrk(*stringp, delim)) != NULL) {
|
||||
*((*stringp)++) = '\0';
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2001, 2002, and 2003 Roy Keene
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* email: libconfig@rkeene.org
|
||||
*/
|
||||
|
||||
/* Compliments of Jay Freeman <saurik@saurik.com> */
|
||||
|
||||
#ifndef _RSK_STRSEP_H
|
||||
#define _RSK_STRSEP_H
|
||||
|
||||
/* This is safe, because we're only included when there's no real strsep
|
||||
available. */
|
||||
#define strsep(x,y) lc_strsep(x,y)
|
||||
|
||||
char *strsep(char **stringp, const char *delim);
|
||||
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* We only handle base 10. */
|
||||
long long int strtoll(const char *nptr, char **endptr, int base) {
|
||||
long long int retval = 0;
|
||||
const char **endptrd = (const char **) endptr;
|
||||
const char *idx = NULL;
|
||||
int allowspace = 1;
|
||||
|
||||
idx = nptr;
|
||||
while (1) {
|
||||
if (*idx == '\0') {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isdigit(*idx)) {
|
||||
if (*idx == '-') {
|
||||
retval *= -1;
|
||||
continue;
|
||||
}
|
||||
if ((*idx == ' ' || *idx == '\t') && allowspace) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
retval *= 10;
|
||||
retval += (*idx - '0');
|
||||
|
||||
allowspace = 0;
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (endptrd != NULL) {
|
||||
*endptrd = idx;
|
||||
}
|
||||
|
||||
return(retval);
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
#ifndef _RSK_STRTOLL_H
|
||||
#define _RSK_STRTOLL_H
|
||||
|
||||
long long int strtoll(const char *nptr, char **endptr, int base);
|
||||
|
||||
#endif
|
@ -1,73 +0,0 @@
|
||||
#include "compat.h"
|
||||
#include "libconfig.h"
|
||||
|
||||
int help_cmd(const char *partarg, const char *arg, const char *argarg, const char *val, lc_flags_t flags, void *extra) {
|
||||
printf("Usage info goes here\n");
|
||||
printf("\n");
|
||||
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
int sally_cmd(const char *partarg, const char *arg, const char *argarg, const char *val, lc_flags_t flags, void *extra) {
|
||||
fprintf(stderr, "%s sets value: \"%s\" (flags=%i)\n", arg, val, flags);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int cmd_ifmodule(const char *partarg, const char *arg, const char *argarg, const char *val, lc_flags_t flags, void *extra) {
|
||||
if (flags == LC_FLAGS_SECTIONEND) {
|
||||
return(LC_CBRET_OKAY);
|
||||
}
|
||||
if (flags != LC_FLAGS_SECTIONSTART) {
|
||||
fprintf(stderr, "IfModule can only be used as a section.\n");
|
||||
return(LC_CBRET_ERROR);
|
||||
}
|
||||
if (argarg == NULL) {
|
||||
fprintf(stderr, "You must specify an argument to IfModule.\n");
|
||||
return(LC_CBRET_ERROR);
|
||||
}
|
||||
|
||||
fprintf(stderr, "IfModule (%s)\n", argarg);
|
||||
return(LC_CBRET_IGNORESECTION);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char *joeval = NULL;
|
||||
size_t xval = -1;
|
||||
int onoff = -1;
|
||||
int lcpret = -1;
|
||||
int i = 0;
|
||||
int onoff2 = 0;
|
||||
uint32_t ipaddr;
|
||||
|
||||
lc_register_var("Section", LC_VAR_SECTION, NULL, 0);
|
||||
lc_register_var("Somesection", LC_VAR_SECTION, NULL, 0);
|
||||
lc_register_var("Section.Test", LC_VAR_STRING, &joeval, 'j');
|
||||
lc_register_var("bob", LC_VAR_SIZE_SIZE_T, &xval, 's');
|
||||
lc_register_var("Somesection.Free", LC_VAR_BOOL, &onoff, 0);
|
||||
lc_register_var("long", LC_VAR_BOOL_BY_EXISTANCE, &onoff2, 'l');
|
||||
lc_register_var("ipaddr", LC_VAR_IP, &ipaddr, 'i');
|
||||
lc_register_callback("sally", 0, LC_VAR_STRING, sally_cmd, NULL);
|
||||
lc_register_callback("HELP", 'h', LC_VAR_NONE, help_cmd, NULL);
|
||||
lc_register_callback("*.ifmodule", 0, LC_VAR_NONE, cmd_ifmodule, NULL);
|
||||
lcpret = lc_process_file("testapp", "http://10.8.0.2/test.conf", LC_CONF_APACHE);
|
||||
lcpret = lc_process(argc, argv, "testapp", LC_CONF_APACHE, "test.cfg");
|
||||
lc_cleanup();
|
||||
if (lcpret < 0) {
|
||||
fprintf(stderr, "Error processing config file: %s\n", lc_geterrstr());
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (joeval != NULL) {
|
||||
fprintf(stderr, "joeval = \"%s\"\n", joeval);
|
||||
} else {
|
||||
fprintf(stderr, "joeval = \"(null)\"\n");
|
||||
}
|
||||
fprintf(stderr, "xval = %llu\n", (unsigned long long) xval);
|
||||
fprintf(stderr, "onoff = %i\n", onoff);
|
||||
fprintf(stderr, "long = %i\n", onoff2);
|
||||
fprintf(stderr, "ip = %08lx\n", (unsigned long) ipaddr);
|
||||
for (i = lc_optind; i < argc; i++) {
|
||||
fprintf(stderr, "argv[%i] = \"%s\"\n", i, argv[i]);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
#if !defined(_LOCAL_WIN32_H) && defined(__WIN32__) && !defined(__CYGWIN__)
|
||||
#define _LOCAL_WIN32_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
/* MingW32 specific stuff here. */
|
||||
# if defined(HAVE_WINSOCK2_H) && defined(HAVE_LIBWSOCK32)
|
||||
/* We have to override the detected configuration
|
||||
because it can't detect the network libraries. */
|
||||
# define HAVE_GETHOSTBYNAME 1
|
||||
# define HAVE_INET_ADDR 1
|
||||
# define HAVE_SOCKET 1
|
||||
# endif
|
||||
# define sleep(x) Sleep((x) * 1000)
|
||||
#else
|
||||
/* MSVC++ configuration follows */
|
||||
# undef HAVE_UNISTD_H
|
||||
# define HAVE_STDLIB_H 1
|
||||
# define HAVE_WINDOWS_H 1
|
||||
# define HAVE_STDARG_H 1
|
||||
# define HAVE_WINSVC_H 1
|
||||
# define HAVE_WINSOCK2_H 1
|
||||
# define HAVE_WINDOWSX_H 1
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#ifdef HAVE_WINDOWSX_H
|
||||
# include <windowsx.h>
|
||||
#endif
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
#ifdef HAVE_WINSVC_H
|
||||
# include <winsvc.h>
|
||||
#endif
|
||||
|
||||
#define _USE_WIN32_ 1
|
||||
|
||||
#endif /* _LOCAL_WIN32_H */
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
Copyright 2005 Aris Adamantiadis
|
||||
|
||||
This file is part of the SSH Library
|
||||
|
||||
The SSH 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.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The SSH 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 the SSH Library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA. */
|
||||
|
||||
#include "server.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
list *list_add(list *ptr, const char *key, void *data){
|
||||
list *new=malloc(sizeof(list));
|
||||
new->next=ptr;
|
||||
new->data=data;
|
||||
new->key=strdup(key);
|
||||
return new;
|
||||
}
|
||||
|
||||
void *list_find(list *ptr, const char *key){
|
||||
while(ptr){
|
||||
if(!strcmp(key,ptr->key))
|
||||
return ptr->data;
|
||||
ptr=ptr->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void list_set(list *ptr, const char *key, void *data){
|
||||
while(ptr){
|
||||
if(!strcmp(key,ptr->key)){
|
||||
ptr->data=data;
|
||||
return;
|
||||
}
|
||||
ptr=ptr->next;
|
||||
}
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
/* main.c */
|
||||
/* Core of the sftp server */
|
||||
/*
|
||||
Copyright 2005 Aris Adamantiadis
|
||||
|
||||
This file is part of the SSH Library
|
||||
|
||||
The SSH 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.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The SSH 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 the SSH Library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA. */
|
||||
|
||||
#include <libssh/libssh.h>
|
||||
#include <libssh/server.h>
|
||||
#include <libssh/sftp.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "server.h"
|
||||
|
||||
|
||||
CHANNEL *recv_channel(SSH_SESSION *session){
|
||||
CHANNEL *chan=NULL;
|
||||
SSH_MESSAGE *message;
|
||||
int sftp=0;
|
||||
do {
|
||||
message=ssh_message_get(session);
|
||||
if(message){
|
||||
switch(ssh_message_type(message)){
|
||||
case SSH_CHANNEL_REQUEST_OPEN:
|
||||
if(ssh_message_subtype(message)==SSH_CHANNEL_SESSION){
|
||||
chan=ssh_message_channel_request_open_reply_accept(message);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ssh_message_reply_default(message);
|
||||
}
|
||||
ssh_message_free(message);
|
||||
}
|
||||
} while(message && !chan);
|
||||
if(!chan)
|
||||
return NULL;
|
||||
do {
|
||||
message=ssh_message_get(session);
|
||||
if(message && ssh_message_type(message)==SSH_CHANNEL_REQUEST &&
|
||||
ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_SUBSYSTEM){
|
||||
if(!strcmp(ssh_message_channel_request_subsystem(message),"sftp")){
|
||||
sftp=1;
|
||||
ssh_message_channel_request_reply_success(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!sftp){
|
||||
ssh_message_reply_default(message);
|
||||
}
|
||||
ssh_message_free(message);
|
||||
} while (message && !sftp);
|
||||
if(!message)
|
||||
return NULL;
|
||||
return chan;
|
||||
}
|
||||
|
||||
void usage(char *prog){
|
||||
fprintf(stderr,"Usage : %s [-vD] [-f config]\n",prog);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv){
|
||||
SSH_OPTIONS *options=ssh_options_new();
|
||||
SSH_SESSION *session;
|
||||
SSH_BIND *ssh_bind;
|
||||
CHANNEL *chan=NULL;
|
||||
SFTP_SESSION *sftp=NULL;
|
||||
int ret;
|
||||
int donotfork=0;
|
||||
char *config="mercurius.conf";
|
||||
ssh_options_getopt(options,&argc,argv);
|
||||
while((ret=getopt(argc, argv, "Df:"))!=-1){
|
||||
switch(ret){
|
||||
case 'D':
|
||||
donotfork=1;
|
||||
break;
|
||||
case 'f':
|
||||
config=strdup(optarg);
|
||||
break;
|
||||
case '?':
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if(optind<argc) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
ret=parse_config(config);
|
||||
if(ret != 0){
|
||||
printf("Error parsing configuration file\n");
|
||||
return 1;
|
||||
}
|
||||
if(!rsa && !dsa){
|
||||
printf("There must be at least one RSA or DSA host key\n");
|
||||
return 1;
|
||||
}
|
||||
if(dsa)
|
||||
ssh_options_set_dsa_server_key(options,dsa);
|
||||
if(rsa)
|
||||
ssh_options_set_rsa_server_key(options,rsa);
|
||||
//printf("port : %d\n",port);
|
||||
if(port!=0)
|
||||
ssh_options_set_port(options,port);
|
||||
ssh_bind=ssh_bind_new();
|
||||
ssh_bind_set_options(ssh_bind,options);
|
||||
if(ssh_bind_listen(ssh_bind)<0){
|
||||
printf("Error listening to socket: %s\n",ssh_get_error(ssh_bind));
|
||||
return 1;
|
||||
}
|
||||
signal(SIGCHLD,SIG_IGN);
|
||||
if(!donotfork){
|
||||
ssh_say(1,"Going into background...\n");
|
||||
if(fork()){
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
while(1){
|
||||
session=ssh_bind_accept(ssh_bind);
|
||||
if(!session){
|
||||
printf("error accepting a connection : %s\n",ssh_get_error(ssh_bind));
|
||||
return 1;
|
||||
}
|
||||
if(fork()==0){
|
||||
break;
|
||||
}
|
||||
ssh_silent_disconnect(session);
|
||||
}
|
||||
ssh_bind_free(ssh_bind);
|
||||
|
||||
//printf("Socket connected : %d\n",ssh_get_fd(session));
|
||||
if(ssh_accept(session)){
|
||||
printf("ssh_accept : %s\n",ssh_get_error(session));
|
||||
return 1;
|
||||
}
|
||||
if(do_auth(session)<0){
|
||||
printf("error : %s\n",ssh_get_error(session));
|
||||
return 1;
|
||||
}
|
||||
ssh_say(1,"user authenticated\n");
|
||||
chan=recv_channel(session);
|
||||
if(!chan){
|
||||
printf("error : %s\n",ssh_get_error(session));
|
||||
return 1;
|
||||
}
|
||||
sftp=sftp_server_new(session,chan);
|
||||
if(sftp_server_init(sftp)){
|
||||
printf("error : %s\n",ssh_get_error(session));
|
||||
return 1;
|
||||
}
|
||||
ssh_say(1,"Sftp session open by client\n");
|
||||
sftploop(session,sftp);
|
||||
ssh_say(1,"Client disconnected\n");
|
||||
ssh_disconnect(session);
|
||||
return 0;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
Port 4444
|
||||
Hostkeyrsa /etc/ssh/ssh_host_rsa_key
|
||||
Hostkeydsa /etc/ssh/ssh_host_dsa_key
|
||||
#the group wheel has 4 users. They are regular
|
||||
#users of the system because they are authenticating
|
||||
#through the normal way (pam)
|
||||
<group wheel>
|
||||
user root, admin, webmaster
|
||||
user aris
|
||||
</group>
|
||||
|
||||
#they are virtual users using the uid of the user "ftp"
|
||||
#they don't need a password and their home dir is
|
||||
#chrooted to /home/ftp
|
||||
<group anonymous>
|
||||
user ftp, anonymous, anon
|
||||
uid ftp
|
||||
nopassword
|
||||
chroot /home/ftp
|
||||
</group>
|
||||
|
||||
#the users group log in normaly but are restricted to
|
||||
#their own home dir.
|
||||
#here, aris is both in wheel group : he has the properties
|
||||
#of wheel users and "users" users.
|
||||
#BUT he cannot have two conflicting properties.
|
||||
<group users>
|
||||
user test
|
||||
user aris
|
||||
chroot $HOME/
|
||||
</group>
|
||||
|
||||
#everybody should be in world, at your convenance.
|
||||
|
||||
#it is no problem to have different users with different
|
||||
#properties in the same group, as far as the group
|
||||
#doesn't define new conflicting properties
|
||||
<group world>
|
||||
group wheel, anonymous, users
|
||||
</group>
|
||||
|
||||
#not implemented yet
|
||||
#<dir />
|
||||
# list world
|
||||
# read world
|
||||
# write wheel
|
||||
#</dir>
|
@ -1,5 +0,0 @@
|
||||
sftp auth required pam_unix.so try_first_pass
|
||||
sftp account required pam_unix.so
|
||||
sftp password required pam_permit.so
|
||||
sftp session required pam_permit.so
|
||||
|
@ -1,8 +0,0 @@
|
||||
#%PAM-1.0
|
||||
auth required /lib/security/pam_unix.so shadow nodelay
|
||||
auth required /lib/security/pam_nologin.so
|
||||
account required /lib/security/pam_unix.so
|
||||
password required /lib/security/pam_cracklib.so
|
||||
password required /lib/security/pam_unix.so shadow nullok use_authtok
|
||||
session required /lib/security/pam_unix.so
|
||||
session required /lib/security/pam_limits.so
|
@ -1,6 +0,0 @@
|
||||
#%PAM-1.0
|
||||
|
||||
auth include system-auth
|
||||
account include system-auth
|
||||
password include system-auth
|
||||
|
@ -1,416 +0,0 @@
|
||||
/* protocol dependant part of Mercurius */
|
||||
/*
|
||||
Copyright 2005 Aris Adamantiadis
|
||||
|
||||
This file is part of the SSH Library
|
||||
|
||||
The SSH 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.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The SSH 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 the SSH Library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA. */
|
||||
|
||||
#include <libssh/libssh.h>
|
||||
#include <libssh/sftp.h>
|
||||
#include <libssh/server.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include "server.h"
|
||||
|
||||
#define TYPE_DIR 1
|
||||
#define TYPE_FILE 1
|
||||
struct sftp_handle {
|
||||
int type;
|
||||
int offset;
|
||||
char *name;
|
||||
int eof;
|
||||
DIR *dir;
|
||||
FILE *file;
|
||||
};
|
||||
|
||||
int reply_status(SFTP_CLIENT_MESSAGE *msg){
|
||||
switch(errno){
|
||||
case EACCES:
|
||||
return sftp_reply_status(msg,SSH_FX_PERMISSION_DENIED,
|
||||
"permission denied");
|
||||
case ENOENT:
|
||||
return sftp_reply_status(msg,SSH_FX_NO_SUCH_FILE,
|
||||
"no such file or directory");
|
||||
case ENOTDIR:
|
||||
return sftp_reply_status(msg,SSH_FX_FAILURE,
|
||||
"not a directory");
|
||||
default:
|
||||
return sftp_reply_status(msg,SSH_FX_FAILURE,NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void handle_opendir(SFTP_CLIENT_MESSAGE *msg){
|
||||
DIR *dir=opendir(msg->filename);
|
||||
struct sftp_handle *hdl;
|
||||
STRING *handle;
|
||||
if(!dir){
|
||||
reply_status(msg);
|
||||
return;
|
||||
}
|
||||
hdl=malloc(sizeof(struct sftp_handle));
|
||||
memset(hdl,0,sizeof(struct sftp_handle));
|
||||
hdl->type=TYPE_DIR;
|
||||
hdl->offset=0;
|
||||
hdl->dir=dir;
|
||||
hdl->name=strdup(msg->filename);
|
||||
handle=sftp_handle_alloc(msg->sftp,hdl);
|
||||
sftp_reply_handle(msg,handle);
|
||||
free(handle);
|
||||
}
|
||||
|
||||
SFTP_ATTRIBUTES *attr_from_stat(struct stat *statbuf){
|
||||
SFTP_ATTRIBUTES *attr=malloc(sizeof(SFTP_ATTRIBUTES));
|
||||
memset(attr,0,sizeof(*attr));
|
||||
attr->size=statbuf->st_size;
|
||||
attr->uid=statbuf->st_uid;
|
||||
attr->gid=statbuf->st_gid;
|
||||
attr->permissions=statbuf->st_mode;
|
||||
attr->atime=statbuf->st_atime;
|
||||
attr->mtime=statbuf->st_mtime;
|
||||
attr->flags=SSH_FILEXFER_ATTR_SIZE | SSH_FILEXFER_ATTR_UIDGID
|
||||
| SSH_FILEXFER_ATTR_PERMISSIONS | SSH_FILEXFER_ATTR_ACMODTIME;
|
||||
return attr;
|
||||
}
|
||||
|
||||
int handle_stat(SFTP_CLIENT_MESSAGE *msg,int follow){
|
||||
struct stat statbuf;
|
||||
SFTP_ATTRIBUTES *attr;
|
||||
int ret;
|
||||
if(follow)
|
||||
ret=stat(msg->filename,&statbuf);
|
||||
else
|
||||
ret=lstat(msg->filename,&statbuf);
|
||||
if(ret<0){
|
||||
reply_status(msg);
|
||||
return 0;
|
||||
}
|
||||
attr=attr_from_stat(&statbuf);
|
||||
sftp_reply_attr(msg, attr);
|
||||
sftp_attributes_free(attr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *long_name(char *file, struct stat *statbuf){
|
||||
static char buf[256];
|
||||
char buf2[100];
|
||||
int mode=statbuf->st_mode;
|
||||
char *time,*ptr;
|
||||
strcpy(buf,"");
|
||||
switch(mode & S_IFMT){
|
||||
case S_IFDIR:
|
||||
strcat(buf,"d");
|
||||
break;
|
||||
default:
|
||||
strcat(buf,"-");
|
||||
break;
|
||||
}
|
||||
/* user */
|
||||
if(mode & 0400)
|
||||
strcat(buf,"r");
|
||||
else
|
||||
strcat(buf,"-");
|
||||
if(mode & 0200)
|
||||
strcat(buf,"w");
|
||||
else
|
||||
strcat(buf,"-");
|
||||
if(mode & 0100){
|
||||
if(mode & S_ISUID)
|
||||
strcat(buf,"s");
|
||||
else
|
||||
strcat(buf,"x");
|
||||
} else
|
||||
strcat(buf,"-");
|
||||
/*group*/
|
||||
if(mode & 040)
|
||||
strcat(buf,"r");
|
||||
else
|
||||
strcat(buf,"-");
|
||||
if(mode & 020)
|
||||
strcat(buf,"w");
|
||||
else
|
||||
strcat(buf,"-");
|
||||
if(mode & 010)
|
||||
strcat(buf,"x");
|
||||
else
|
||||
strcat(buf,"-");
|
||||
/* other */
|
||||
if(mode & 04)
|
||||
strcat(buf,"r");
|
||||
else
|
||||
strcat(buf,"-");
|
||||
if(mode & 02)
|
||||
strcat(buf,"w");
|
||||
else
|
||||
strcat(buf,"-");
|
||||
if(mode & 01)
|
||||
strcat(buf,"x");
|
||||
else
|
||||
strcat(buf,"-");
|
||||
strcat(buf," ");
|
||||
snprintf(buf2,sizeof(buf2),"%3d %d %d %d",(int)statbuf->st_nlink,
|
||||
(int)statbuf->st_uid,(int)statbuf->st_gid,(int)statbuf->st_size);
|
||||
strcat(buf,buf2);
|
||||
time=ctime(&statbuf->st_mtime)+4;
|
||||
if((ptr=strchr(time,'\n')))
|
||||
*ptr=0;
|
||||
snprintf(buf2,sizeof(buf2)," %s %s",time,file);
|
||||
// +4 to remove the "WED "
|
||||
strcat(buf,buf2);
|
||||
return buf;
|
||||
}
|
||||
|
||||
int handle_readdir(SFTP_CLIENT_MESSAGE *msg){
|
||||
struct sftp_handle *handle=sftp_handle(msg->sftp,msg->handle);
|
||||
SFTP_ATTRIBUTES *attr;
|
||||
struct dirent *dir;
|
||||
char *longname;
|
||||
struct stat statbuf;
|
||||
char file[1024];
|
||||
int i;
|
||||
if(!handle || handle->type!=TYPE_DIR){
|
||||
sftp_reply_status(msg,SSH_FX_BAD_MESSAGE,"invalid handle");
|
||||
return 0;
|
||||
}
|
||||
for(i=0; !handle->eof && i<50;++i){
|
||||
dir=readdir(handle->dir);
|
||||
if(!dir){
|
||||
handle->eof=1;
|
||||
break;
|
||||
}
|
||||
snprintf(file,sizeof(file),"%s/%s",handle->name,
|
||||
dir->d_name);
|
||||
if(lstat(file,&statbuf)){
|
||||
memset(&statbuf,0,sizeof(statbuf));
|
||||
}
|
||||
attr=attr_from_stat(&statbuf);
|
||||
longname=long_name(dir->d_name,&statbuf);
|
||||
sftp_reply_names_add(msg,dir->d_name,longname,attr);
|
||||
sftp_attributes_free(attr);
|
||||
}
|
||||
/* if there was at least one file, don't send the eof yet */
|
||||
if(i==0 && handle->eof){
|
||||
sftp_reply_status(msg,SSH_FX_EOF,NULL);
|
||||
return 0;
|
||||
}
|
||||
sftp_reply_names(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handle_read(SFTP_CLIENT_MESSAGE *msg){
|
||||
struct sftp_handle *handle=sftp_handle(msg->sftp,msg->handle);
|
||||
u32 len=msg->len;
|
||||
void *data;
|
||||
int r;
|
||||
if(!handle || handle->type!=TYPE_FILE){
|
||||
sftp_reply_status(msg,SSH_FX_BAD_MESSAGE,"invalid handle");
|
||||
return 0;
|
||||
}
|
||||
if(len>(2<<15)){
|
||||
/* 32000 */
|
||||
len=2<<15;
|
||||
}
|
||||
data=malloc(len);
|
||||
fseeko(handle->file,msg->offset,SEEK_SET);
|
||||
r=fread(data,1,len,handle->file);
|
||||
ssh_say(2,"read %d bytes\n",r);
|
||||
if(r<=0 && (len>0)){
|
||||
if(feof(handle->file)){
|
||||
sftp_reply_status(msg,SSH_FX_EOF,"End of file");
|
||||
} else {
|
||||
reply_status(msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
sftp_reply_data(msg,data,r);
|
||||
free(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handle_write(SFTP_CLIENT_MESSAGE *msg){
|
||||
struct sftp_handle *handle=sftp_handle(msg->sftp,msg->handle);
|
||||
u32 len=string_len(msg->data);
|
||||
int r;
|
||||
if(!handle || handle->type!=TYPE_FILE){
|
||||
sftp_reply_status(msg,SSH_FX_BAD_MESSAGE,"invalid handle");
|
||||
return 0;
|
||||
}
|
||||
fseeko(handle->file,msg->offset,SEEK_SET);
|
||||
do {
|
||||
r=fwrite(string_data(msg->data),1,len,handle->file);
|
||||
ssh_say(2,"wrote %d bytes\n",r);
|
||||
if(r<=0 && (msg->data>0)){
|
||||
reply_status(msg);
|
||||
return 0;
|
||||
}
|
||||
len-=r;
|
||||
} while (len>0);
|
||||
sftp_reply_status(msg,SSH_FX_OK,"");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handle_close(SFTP_CLIENT_MESSAGE *msg){
|
||||
struct sftp_handle *handle=sftp_handle(msg->sftp,msg->handle);
|
||||
if(!handle){
|
||||
sftp_reply_status(msg,SSH_FX_BAD_MESSAGE,"invalid handle");
|
||||
return 0;
|
||||
}
|
||||
sftp_handle_remove(msg->sftp,handle);
|
||||
if(handle->type==TYPE_DIR){
|
||||
closedir(handle->dir);
|
||||
} else {
|
||||
fclose(handle->file);
|
||||
}
|
||||
if(handle->name)
|
||||
free(handle->name);
|
||||
free(handle);
|
||||
sftp_reply_status(msg,SSH_FX_OK,NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int handle_open(SFTP_CLIENT_MESSAGE *msg){
|
||||
int flags=0;
|
||||
int fd;
|
||||
FILE *file;
|
||||
char *mode="r";
|
||||
struct sftp_handle *hdl;
|
||||
STRING *handle;
|
||||
if(msg->flags & SSH_FXF_READ)
|
||||
flags |= O_RDONLY;
|
||||
if(msg->flags & SSH_FXF_WRITE)
|
||||
flags |= O_WRONLY;
|
||||
if(msg->flags & SSH_FXF_APPEND)
|
||||
flags |= O_APPEND;
|
||||
if(msg->flags & SSH_FXF_TRUNC)
|
||||
flags |= O_TRUNC;
|
||||
if(msg->flags & SSH_FXF_EXCL)
|
||||
flags |= O_EXCL;
|
||||
if(msg->flags & SSH_FXF_CREAT)
|
||||
flags |= O_CREAT;
|
||||
fd=open(msg->filename,flags,msg->attr->permissions);
|
||||
if(fd<0){
|
||||
reply_status(msg);
|
||||
return 0;
|
||||
}
|
||||
switch(flags& (O_RDONLY | O_WRONLY | O_APPEND | O_TRUNC)){
|
||||
case O_RDONLY:
|
||||
mode="r";
|
||||
break;
|
||||
case (O_WRONLY|O_RDONLY):
|
||||
mode="r+";
|
||||
break;
|
||||
case (O_WRONLY|O_TRUNC):
|
||||
mode="w";
|
||||
break;
|
||||
case (O_WRONLY | O_RDONLY | O_APPEND):
|
||||
mode="a+";
|
||||
break;
|
||||
default:
|
||||
switch(flags & (O_RDONLY | O_WRONLY)){
|
||||
case O_RDONLY:
|
||||
mode="r";
|
||||
break;
|
||||
case O_WRONLY:
|
||||
mode="w";
|
||||
break;
|
||||
}
|
||||
}
|
||||
file=fdopen(fd,mode);
|
||||
hdl=malloc(sizeof(struct sftp_handle));
|
||||
memset(hdl,0,sizeof(struct sftp_handle));
|
||||
hdl->type=TYPE_FILE;
|
||||
hdl->offset=0;
|
||||
hdl->file=file;
|
||||
hdl->name=strdup(msg->filename);
|
||||
handle=sftp_handle_alloc(msg->sftp,hdl);
|
||||
sftp_reply_handle(msg,handle);
|
||||
free(handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sftploop(SSH_SESSION *session, SFTP_SESSION *sftp){
|
||||
SFTP_CLIENT_MESSAGE *msg;
|
||||
char buffer[PATH_MAX];
|
||||
do {
|
||||
msg=sftp_get_client_message(sftp);
|
||||
if(!msg)
|
||||
break;
|
||||
switch(msg->type){
|
||||
case SFTP_REALPATH:
|
||||
ssh_say(1,"client realpath : %s\n",msg->filename);
|
||||
realpath(msg->filename,buffer);
|
||||
ssh_say(2,"responding %s\n",buffer);
|
||||
sftp_reply_name(msg, buffer, NULL);
|
||||
break;
|
||||
case SFTP_OPENDIR:
|
||||
ssh_say(1,"client opendir(%s)\n",msg->filename);
|
||||
handle_opendir(msg);
|
||||
break;
|
||||
case SFTP_LSTAT:
|
||||
case SFTP_STAT:
|
||||
ssh_say(1,"client stat(%s)\n",msg->filename);
|
||||
handle_stat(msg,msg->type==SFTP_STAT);
|
||||
break;
|
||||
case SFTP_READDIR:
|
||||
ssh_say(1,"client readdir\n");
|
||||
handle_readdir(msg);
|
||||
break;
|
||||
case SFTP_CLOSE:
|
||||
ssh_say(1,"client close\n");
|
||||
handle_close(msg);
|
||||
break;
|
||||
case SFTP_OPEN:
|
||||
ssh_say(1,"client open(%s)\n",msg->filename);
|
||||
handle_open(msg);
|
||||
break;
|
||||
case SFTP_READ:
|
||||
ssh_say(1,"client read(off=%lld,len=%d)\n",msg->offset,msg->len);
|
||||
handle_read(msg);
|
||||
break;
|
||||
case SFTP_WRITE:
|
||||
ssh_say(1,"client write(off=%lld len=%d)\n)\n",msg->offset,string_len(msg->data));
|
||||
handle_write(msg);
|
||||
break;
|
||||
case SFTP_SETSTAT:
|
||||
case SFTP_FSETSTAT:
|
||||
case SFTP_REMOVE:
|
||||
case SFTP_MKDIR:
|
||||
case SFTP_RMDIR:
|
||||
case SFTP_FSTAT:
|
||||
case SFTP_RENAME:
|
||||
case SFTP_READLINK:
|
||||
case SFTP_SYMLINK:
|
||||
default:
|
||||
ssh_say(1,"Unknown message %d\n",msg->type);
|
||||
sftp_reply_status(msg,SSH_FX_OP_UNSUPPORTED,"Unsupported message");
|
||||
}
|
||||
sftp_client_message_free(msg);
|
||||
} while (1);
|
||||
if(!msg)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
#include <libssh/libssh.h>
|
||||
#include <libssh/sftp.h>
|
||||
/* server.h */
|
||||
/* headers for the sftp server project */
|
||||
int parse_config(char *file);
|
||||
char *user_chroot(char *user);
|
||||
char *user_uid(char *user);
|
||||
int user_nopassword(char *user);
|
||||
|
||||
/* userauth.c */
|
||||
int do_auth(SSH_SESSION *session);
|
||||
|
||||
/* protocol.c */
|
||||
|
||||
int sftploop(SSH_SESSION *session, SFTP_SESSION *sftp);
|
||||
|
||||
/* list.c */
|
||||
typedef struct list_struct {
|
||||
struct list_struct *next;
|
||||
char *key;
|
||||
void *data;
|
||||
} list;
|
||||
|
||||
list *list_add(list *ptr, const char *key, void *data);
|
||||
void *list_find(list *ptr, const char *key);
|
||||
void list_set(list *ptr, const char *key, void *data);
|
||||
/* config.c */
|
||||
extern int port;
|
||||
extern char *dsa;
|
||||
extern char *rsa;
|
||||
struct group {
|
||||
list *users;
|
||||
char *chroot;
|
||||
char *uid;
|
||||
char *gid;
|
||||
int nopassword;
|
||||
};
|
||||
|
||||
struct dir {
|
||||
char *name;
|
||||
list *subdir;
|
||||
list *List;
|
||||
list *Read;
|
||||
list *Write;
|
||||
};
|
||||
|
||||
/* acl_* functions returns this : */
|
||||
/* 1 : operation allowed */
|
||||
/* 0 : operation denied */
|
||||
int acl_open(char *file, int mode);
|
||||
int acl_opendir(char *dir);
|
||||
int acl_stat(char *file);
|
||||
int acl_rm(char *file);
|
||||
int acl_rmdir(char *dir);
|
||||
int acl_mv(char *from, char *to);
|
||||
int acl_mkdir(char *dir);
|
||||
int acl_symlink(char *from, char *to);
|
||||
int acl_setstat(char *file);
|
||||
|
||||
/* still experimental */
|
||||
|
||||
#define BLOCKLEN 65536
|
||||
|
||||
/* here is how it works : */
|
||||
/* the buffer is BLOCKLEN long. */
|
||||
/* Bytes is the number of valid bytes into the buffer. these valid bytes */
|
||||
/* begin at &buffer[0] */
|
||||
/* buffer+start is mapped at offset. */
|
||||
/* thus, there are (bytes-start) bytes ready to be read. */
|
||||
|
||||
struct file {
|
||||
int fd;
|
||||
u64 offset;
|
||||
unsigned char buffer[BLOCKLEN];
|
||||
int bytes;
|
||||
int start; // number of the first byte pointed by offset
|
||||
int mode;
|
||||
int eof;
|
||||
int delayed_write; /* there are data into the buffer to be read */
|
||||
int write_end; /* end of data, relative to buffer[0] */
|
||||
int write_start; /* begining of data */
|
||||
};
|
||||
|
||||
|
||||
struct file *file_open(char *filename, int mode);
|
||||
int file_sync(struct file *file);
|
||||
int file_close(struct file *file);
|
||||
|
||||
|
@ -1,233 +0,0 @@
|
||||
/* userauth.c */
|
||||
/* handle the authentication of the client */
|
||||
/*
|
||||
Copyright 2005 Aris Adamantiadis
|
||||
|
||||
This file is part of the SSH Library
|
||||
|
||||
The SSH 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.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The SSH 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 the SSH Library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA. */
|
||||
|
||||
#include <libssh/libssh.h>
|
||||
#include <libssh/server.h>
|
||||
//#include <libssh/sftp.h>
|
||||
#ifdef HAVE_SECURITY_PAM_APPL_H
|
||||
#include <security/pam_appl.h>
|
||||
#else
|
||||
#ifdef HAVE_PAM_PAM_APPL_H
|
||||
#include <pam/pam_appl.h>
|
||||
#else
|
||||
#error "your system has'nt PAM development files installed"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "server.h"
|
||||
|
||||
#define SERVICE "sftp"
|
||||
|
||||
char *user_password;
|
||||
int password_conv(int num_msg, const struct pam_message **msg,
|
||||
struct pam_response **resp, void *appdata)
|
||||
{
|
||||
int i=0;
|
||||
for(i=0;i<num_msg;++i){
|
||||
resp[i]=malloc(sizeof (struct pam_response));
|
||||
resp[i]->resp_retcode=0;
|
||||
switch(msg[i]->msg_style){
|
||||
case PAM_PROMPT_ECHO_ON:
|
||||
//printf("PAM: %s",msg[i]->msg);
|
||||
resp[i]->resp=strdup(user_password);
|
||||
break;
|
||||
case PAM_PROMPT_ECHO_OFF:
|
||||
//printf("PAM: %s",msg[i]->msg);
|
||||
resp[i]->resp=strdup(user_password);
|
||||
break;
|
||||
case PAM_ERROR_MSG:
|
||||
//printf("PAM_ERROR: %s",msg[i]->msg);
|
||||
break;
|
||||
case PAM_TEXT_INFO:
|
||||
//printf("PAM TEXT: %s",msg[i]->msg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return PAM_SUCCESS;
|
||||
}
|
||||
|
||||
/* postauth_conf returns -1 on error, else 0 */
|
||||
int postauth_conf(char *user){
|
||||
/* first, find a chroot if any */
|
||||
char *root,*ptr;
|
||||
char *char_uid;
|
||||
char buffer[256];
|
||||
int uid;
|
||||
struct passwd *pw=getpwnam(user);
|
||||
root=user_chroot(user);
|
||||
if(root){
|
||||
if((ptr=strstr(root,"$HOME"))){
|
||||
if(!pw){
|
||||
ssh_say(1,"Postauth failed : no home directory for user %s\n",user);
|
||||
return -1; // this user has no user directory
|
||||
}
|
||||
*ptr=0;
|
||||
snprintf(buffer,sizeof(buffer),"%s%s/%s",
|
||||
root,pw->pw_dir,ptr+strlen("$HOME"));
|
||||
}
|
||||
else
|
||||
snprintf(buffer,sizeof(buffer),"%s",root);
|
||||
}
|
||||
/* we don't chroot right now because we still need getpwnam() */
|
||||
char_uid=user_uid(user);
|
||||
if(!char_uid){
|
||||
if(!pw){
|
||||
ssh_say(1,"postauth failed : user %s doesn't exist(try to set the uid setting)\n",user);
|
||||
return -1; // user doesn't exist !
|
||||
}
|
||||
char_uid=user;
|
||||
}
|
||||
uid=atoi(char_uid);
|
||||
if(uid==0 && char_uid[0]!=0){
|
||||
pw=getpwnam(char_uid);
|
||||
if(!pw){
|
||||
ssh_say(1,"postauth failed : user %s does not exist\n",char_uid);
|
||||
return -1;
|
||||
}
|
||||
uid=pw->pw_uid;
|
||||
}
|
||||
if(root && chroot(buffer)){
|
||||
ssh_say(1,"Postauth failed : chroot failed (%s)\n",strerror(errno));
|
||||
return -1; // cannot chroot
|
||||
}
|
||||
if(root){
|
||||
chdir("/");
|
||||
} else {
|
||||
if(pw)
|
||||
chdir(pw->pw_dir);
|
||||
else
|
||||
chdir("/");
|
||||
}
|
||||
if(setuid(uid)){
|
||||
ssh_say(1,"Postauth failed : cannot set uid (%)\n",strerror(errno));
|
||||
return -1; // cannot setuid
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
struct pam_conv pam_conv ={ password_conv, NULL };
|
||||
/* returns 1 if authenticated, 0 if failed,
|
||||
-1 if you must leave */
|
||||
int auth_password(char *user, char *password){
|
||||
pam_handle_t *pamh;
|
||||
int ret;
|
||||
static int tries=0;
|
||||
if(tries>3)
|
||||
return -1;
|
||||
tries++;
|
||||
user_password=password;
|
||||
ret=pam_start(SERVICE,user,&pam_conv,&pamh);
|
||||
if(ret==PAM_SUCCESS)
|
||||
ret=pam_authenticate(pamh,0);
|
||||
if(ret==PAM_SUCCESS)
|
||||
ret=pam_acct_mgmt(pamh,0);
|
||||
memset(password,0,strlen(password));
|
||||
if(ret==PAM_SUCCESS){
|
||||
pam_end(pamh,PAM_SUCCESS);
|
||||
if(postauth_conf(user))
|
||||
return -1;
|
||||
return 1;
|
||||
} else {
|
||||
ssh_say(1,"password auth failed for user %s\n",user);
|
||||
pam_end(pamh,PAM_AUTH_ERR);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int do_auth(SSH_SESSION *session){
|
||||
SSH_MESSAGE *message;
|
||||
int auth=-1;
|
||||
do {
|
||||
message=ssh_message_get(session);
|
||||
if(!message)
|
||||
break;
|
||||
switch(ssh_message_type(message)){
|
||||
case SSH_AUTH_REQUEST:
|
||||
switch(ssh_message_subtype(message)){
|
||||
case SSH_AUTH_PASSWORD:
|
||||
ssh_say(1,"User %s wants to auth by password\n",
|
||||
ssh_message_auth_user(message));
|
||||
auth=auth_password(ssh_message_auth_user(message),
|
||||
ssh_message_auth_password(message));
|
||||
switch(auth){
|
||||
case 1:
|
||||
ssh_say(1,"Authentication success\n");
|
||||
ssh_message_auth_reply_success(message,0);
|
||||
break;
|
||||
case -1:
|
||||
ssh_say(1,"Too much tries\n");
|
||||
// too much auth tried
|
||||
ssh_disconnect(session);
|
||||
exit(1);
|
||||
case 0:
|
||||
ssh_say(1,"Auth refused\n");
|
||||
break;
|
||||
}
|
||||
if(auth==1){
|
||||
break;
|
||||
} else {
|
||||
ssh_message_auth_set_methods(message,SSH_AUTH_PASSWORD);
|
||||
ssh_message_reply_default(message);
|
||||
}
|
||||
break;
|
||||
// not authenticated, send default message
|
||||
case SSH_AUTH_NONE:
|
||||
if(user_nopassword(ssh_message_auth_user(message))){
|
||||
if(postauth_conf(ssh_message_auth_user(message))==0){
|
||||
ssh_message_auth_reply_success(message,0);
|
||||
auth=1;
|
||||
ssh_say(1,"Authentication success for %s(no password)\n",
|
||||
ssh_message_auth_user(message));
|
||||
break;
|
||||
} else {
|
||||
ssh_say(1,"Post-auth failed\n");
|
||||
ssh_message_auth_set_methods(message,SSH_AUTH_PASSWORD);
|
||||
ssh_message_reply_default(message);
|
||||
}
|
||||
} else {
|
||||
ssh_message_auth_set_methods(message,SSH_AUTH_PASSWORD);
|
||||
ssh_message_reply_default(message);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ssh_message_auth_set_methods(message,SSH_AUTH_PASSWORD);
|
||||
ssh_message_reply_default(message);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ssh_message_reply_default(message);
|
||||
}
|
||||
ssh_message_free(message);
|
||||
} while (auth!=1);
|
||||
return auth;
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user