# HG changeset patch # User Binki # Date 2009-05-23 23:06:35 # Node ID 52937ad805aea38c38bf44984bb10d45093fce2d # Parent b647e12afd512c0795fdd8c3fd04c4cb95217312 started implementing libdistren configuration diff --git a/src/client/Makefile.am b/src/client/Makefile.am --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -11,7 +11,7 @@ include_HEADERS = distren.h lib_LTLIBRARIES = libdistren.la -libdistren_la_SOURCES = distren.h libdistren.h libdistren.c libdistren_job.c libdistren_unbias.c +libdistren_la_SOURCES = distren.h libdistren.h libdistren.c libdistren_job.c libdistren_unbias.c libdistren_config.c #evidently the following should not be LDADD, but LDFLAGS because automake doesn't like the idea of LDADD for libraries for some reason... or I am very confused libdistren_la_LIBADD = @DISTLIBS_LIBS@ libdistren_la_CXXFLAGS = @DISTLIBS_CFLAGS@ diff --git a/src/client/libdistren.c b/src/client/libdistren.c --- a/src/client/libdistren.c +++ b/src/client/libdistren.c @@ -45,6 +45,19 @@ int distren_init_mf(distren_t *handle, d (*handle)->malloc = mymalloc; (*handle)->free = myfree; + + /* now the environment is ready for general use */ + if(_distren_getoptions(*handle)) + { + fprintf(stderr, "error getting configuration\n"); + distren_free(*handle); + return 1; + } + + /** + @todo open a connection to the server now and return error if we can't + connect. + */ return 0; } diff --git a/src/client/libdistren.h b/src/client/libdistren.h --- a/src/client/libdistren.h +++ b/src/client/libdistren.h @@ -55,3 +55,10 @@ void *_malloc(distren_t distren, size_t All of libdisren should use this instead of malloc.h's free() */ void _free(distren_t distren, void *tofree); + +/** + Sets up the distren handle with information garnered from + configuration files, etc. Uses the environment variable + DISTREN_CONFIG or the built-in default config file location. + */ +int _distren_getoptions(distren_t handle); diff --git a/src/client/libdistren_config.c b/src/client/libdistren_config.c new file mode 100644 --- /dev/null +++ b/src/client/libdistren_config.c @@ -0,0 +1,29 @@ +/* + Copyright 2008 Nathan Phillip Brink, Ethan Zonca, Matt Orlando + + This file is a part of DistRen. + + DistRen is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + DistRen 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with DistRen. If not, see . +*/ + +/* + Functions and code for retrieving the client's configuration information. + */ + +#include + +int _distren_getoptions(distren_t handle) +{ + +}