Changeset - 7df3f36d8160
[Not reviewed]
default
0 6 3
ohnobinki@localhost - 17 years ago 2009-02-10 22:46:28

added /src/common and Makefile rules to build a library of stuff shared between the client/server
9 files changed with 96 insertions and 39 deletions:
0 comments (0 inline, 0 general)
configure.ac
Show inline comments
 
@@ -22,9 +22,15 @@ AC_CONFIG_SRCDIR([src/server/distrend.c]
 
AM_INIT_AUTOMAKE
 

	
 
AC_PROG_CC
 
AC_PROG_LIBTOOL
 

	
 
PKG_PROG_PKG_CONFIG(0.17.2)
 

	
 
PKG_CHECK_MODULES(DISTLIBS, libconfuse >= 2.6)
 

	
 
AC_CONFIG_FILES([Makefile
 
src/Makefile
 
src/common/Makefile
 
src/server/Makefile
 
src/client/Makefile
 
])
src/Makefile.am
Show inline comments
 
SUBDIRS = server client
 
SUBDIRS = common server client
src/client/Makefile.am
Show inline comments
 
bin_PROGRAMS = distren
 
distrend_SORUCES = distren.c
 
distren_SOURCES = distren.c
 
distren_LDADD = @DISTLIBS_LIBS@ @top_builddir@/src/common/libdistren.la
 
distren_CXXFLAGS = @DISTLIBS_CFLAGS@ -I@top_srcdir@/src/common
src/client/distren.c
Show inline comments
 
#include <stdio.h>
 
#include <confuse.h>
 

	
 
/*
 
  Copyright 2008 Nathan Phillip Brink, Ethan Zonca
 

	
 
@@ -20,22 +17,9 @@
 
  along with distren.  If not, see <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include <stdio.h>
 

	
 
int main(int argc, char *argv[])
 
{
 

	
 
  /* Conf File Parser */
 
    cfg_opt_t opts[] =
 
    {
 
        CFG_STR("test", "mneh", CFGF_NONE),
 
        CFG_END()
 
     };
 
       cfg_t *cfg;
 
       cfg = cfg_init(opts, CFGF_NONE);
 
       if(cfg_parse(cfg, "distren.conf") == CFG_PARSE_ERROR)
 
           return 1;
 
/* End Conf File Parser */
 

	
 

	
 
  cfg_free(cfg); 
 
  return 0;
 
}
src/common/Makefile.am
Show inline comments
 
new file 100644
 
pkglib_LTLIBRARIES = libdistren.la
 

	
 
libdistren_la_SOURCES = options.c options.h
 
#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@
src/common/options.c
Show inline comments
 
new file 100644
 
/*
 
  Copyright 2008 Nathan Phillip Brink, Ethan Zonca
 

	
 
  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 <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include "options.h"
 

	
 
#include <confuse.h>
 

	
 
int genericfunc() 
 
{
 
  
 
  /* Conf File Parser */
 
    cfg_opt_t opts[] =
 
    {
 
        CFG_STR("test", "mneh", CFGF_NONE),
 
        CFG_END()
 
     };
 
       cfg_t *cfg;
 
       cfg = cfg_init(opts, CFGF_NONE);
 
       if(cfg_parse(cfg, "distren.conf") == CFG_PARSE_ERROR)
 
           return 1;
 
/* End Conf File Parser */
 

	
 

	
 
  cfg_free(cfg); 
 

	
 
       cfg = cfg_init(opts, CFGF_NONE);
 
       if(cfg_parse(cfg, "distrend.conf") == CFG_PARSE_ERROR)
 
           return 1;
 
/* End Conf File Parser */
 

	
 
printf("Conf File Test", cfg_getstr(cfg, "test"));
 

	
 

	
 
  cfg_free(cfg); 
 

	
 
}
src/common/options.h
Show inline comments
 
new file 100644
 
/*
 
  Copyright 2008 Nathan Phillip Brink, Ethan Zonca
 

	
 
  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 <http://www.gnu.org/licenses/>.
 
*/
 

	
src/server/Makefile.am
Show inline comments
 
bin_PROGRAMS = distrend
 
distrend_SORUCES = distrend.c
 
distrend_SOURCES = distrend.c
 
distrend_LDADD = @DISTLIBS_LIBS@ @top_builddir@/src/common/libdistren.la
 
distrend_CXXFLAGS = @DISTLIBS_CFLAGS@ -I@top_srcdir@/src/common
src/server/distrend.c
Show inline comments
 
#include <stdio.h>
 
#include <confuse.h>
 
/*
 
  Copyright 2008 Nathan Phillip Brink, Ethan Zonca
 

	
 
@@ -19,24 +17,12 @@
 
  along with distren.  If not, see <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include <stdio.h>
 

	
 

	
 

	
 
int main(int argc, char *argv[])
 
{
 

	
 
/* Conf File Parser */
 
    cfg_opt_t opts[] =
 
    {
 
        CFG_STR("test", "mneh", CFGF_NONE),
 
        CFG_END()
 
     };
 
       cfg_t *cfg;
 
       cfg = cfg_init(opts, CFGF_NONE);
 
       if(cfg_parse(cfg, "distrend.conf") == CFG_PARSE_ERROR)
 
           return 1;
 
/* End Conf File Parser */
 

	
 
printf("Conf File Test", cfg_getstr(cfg, "test"));
 

	
 

	
 
  cfg_free(cfg); 
 
  return 0;
 
}
0 comments (0 inline, 0 general)