Changeset - e736dd843da3
[Not reviewed]
default
0 4 0
Nathan Brink (binki) - 16 years ago 2009-05-24 22:36:28
ohnobinki@ohnopublishing.net
moved some options code from distren.c to libdistren
4 files changed with 39 insertions and 25 deletions:
0 comments (0 inline, 0 general)
src/client/Makefile.am
Show inline comments
 
bin_PROGRAMS = distren
 
distren_SOURCES = distren.c
 
distren_LDADD = @DISTLIBS_LIBS@ @top_builddir@/src/common/libdistrencommon.la libdistren.la @XML_LIBS@
 
distren_CFLAGS = @DISTLIBS_CFLAGS@ -I@top_srcdir@/src/common @XML_CPPFLAGS@
 
distren_LDADD = @DISTLIBS_LIBS@libdistren.la
 
distren_CFLAGS = @DISTLIBS_CFLAGS@
 

	
 

	
 
include_HEADERS = distren.h
 
@@ -13,8 +13,8 @@ lib_LTLIBRARIES = libdistren.la
 

	
 
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@
 
libdistren_la_LIBADD = @DISTLIBS_LIBS@ @top_builddir@/src/common/libdistrencommon.la @XML_LIBS@
 
libdistren_la_CFLAGS = @DISTLIBS_CFLAGS@ -I@top_srcdir@/src/common @XML_CPPFLAGS@
 

	
 
#see http://sources.redhat.com/autobook/autobook/autobook_91.html
 
# either increase the revision number or the interface number each release!
src/client/distren.c
Show inline comments
 
@@ -26,7 +26,6 @@
 
 */
 

	
 

	
 
#include "options.h"
 
#include "execio.h"
 

	
 
#include <distren.h>
 
@@ -51,18 +50,7 @@ int main(int argc, char *argv[])
 
  distren_t distren;
 
  distren_job_t distren_job;
 

	
 
  struct options_common *options;
 

	
 
  cfg_t *cfg;
 

	
 
  cfg_opt_t cfg_opts[] =
 
    {
 
      CFG_STR_LIST("render_types", NULL, 0),
 
      CFG_STR("username", NULL, 0),
 
      CFG_STR("name", NULL, 0),
 
      CFG_STR("email", NULL, 0),
 
      CFG_END()
 
    };
 

	
 
  input = NULL;
 
  output = NULL;
 
@@ -100,14 +88,6 @@ int main(int argc, char *argv[])
 
      else if(curopt == 'o')
 
	output = strdup(optarg);
 
    } 
 
  /*
 
    parse the config file after the arguments so we can intercept -h for help
 
  */  
 
  if(options_init(argc, argv, &cfg, cfg_opts, "client", &options))
 
    {
 
      fprintf(stderr, "error getting configuration\n");
 
      //return 1;
 
    }
 

	
 
  /* 
 
     give this error after the general arguments parsing so that
 
@@ -176,7 +156,7 @@ int main(int argc, char *argv[])
 
  // We need some code to ssh, and if the SSH fails, tell the user to register.
 
  // Killed the user reg code, as the php interface will take care of this. Although it should check for users...
 

	
 
  options_free(options);
 
  
 
  return 0;
 
};
 

	
src/client/libdistren.h
Show inline comments
 
@@ -27,6 +27,7 @@ struct distren
 
{
 
  distren_malloc_t malloc;
 
  distren_free_t free;
 
  struct options_common *options; /*< use a pointer just to avoid #include "options.h"? */
 
};
 

	
 
struct distren_job
 
@@ -62,3 +63,8 @@ void _free(distren_t distren, void *tofr
 
   DISTREN_CONFIG or the built-in default config file location.
 
 */
 
int _distren_getoptions(distren_t handle);
 

	
 
/**
 
   Unsets-up the distren handle with options loadable from a config file.
 
 */
 
int _distren_loseoptions(distren_t handle);
src/client/libdistren_config.c
Show inline comments
 
@@ -22,11 +22,39 @@
 
 */
 

	
 
#include <libdistren.h>
 
#include "options.h"
 

	
 
/**
 
@todo Stub
 
 */
 
int _distren_getoptions(distren_t handle)
 
{
 
  cfg_t *cfg;
 

	
 
  cfg_opt_t cfg_opts[] =
 
    {
 
      CFG_STR_LIST("render_types", NULL, 0),
 
      CFG_STR("username", NULL, 0),
 
      CFG_STR("name", NULL, 0),
 
      CFG_STR("email", NULL, 0),
 
      CFG_END()
 
    };
 
  
 
  if(options_init(0, NULL, &cfg, cfg_opts, "client", &handle->options))
 
    {
 
      fprintf(stderr, "error getting configuration\n");
 
      return 1;
 
    }
 
  
 
  return 1;
 
}
 

	
 
/**
 
@todo stubish
 
 */
 
int _distren_loseoptions(distren_t handle)
 
{
 
  options_free(handle->options);
 
  
 
  return 0;
 
}
0 comments (0 inline, 0 general)