gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r778 - in GNUnet: contrib src/conf src/util


From: durner
Subject: [GNUnet-SVN] r778 - in GNUnet: contrib src/conf src/util
Date: Thu, 12 May 2005 12:35:28 -0700 (PDT)

Author: durner
Date: 2005-05-12 12:32:53 -0700 (Thu, 12 May 2005)
New Revision: 778

Modified:
   GNUnet/contrib/config.in
   GNUnet/src/conf/gnunet-setup.c
   GNUnet/src/conf/lex.zconf.c
   GNUnet/src/conf/menu.c
   GNUnet/src/conf/zconf.l
   GNUnet/src/util/configuration.c
Log:
fix loading of templates

Modified: GNUnet/contrib/config.in
===================================================================
--- GNUnet/contrib/config.in    2005-05-12 18:45:31 UTC (rev 777)
+++ GNUnet/contrib/config.in    2005-05-12 19:32:53 UTC (rev 778)
@@ -1,4 +1,4 @@
 mainmenu "GNUnet user configuration"
 
-source "$DATADIR/config.in"
-source "$DATADIR/config-user.in"
+source "$DATADIR/config-daemon.in"
+source "$DATADIR/config-client.in"

Modified: GNUnet/src/conf/gnunet-setup.c
===================================================================
--- GNUnet/src/conf/gnunet-setup.c      2005-05-12 18:45:31 UTC (rev 777)
+++ GNUnet/src/conf/gnunet-setup.c      2005-05-12 19:32:53 UTC (rev 778)
@@ -47,10 +47,6 @@
 #endif
 
 int conf_main(int ac, char **av);
-#ifdef MINGW
-void InitWinEnv();
-void ShutdownWinEnv();
-#endif
 
 int main(int argc,
         char *argv[]) {
@@ -59,9 +55,7 @@
     return 0;
   }
 
-#ifdef MINGW
-  InitWinEnv();
-#endif
+  initUtil(NULL, 0, NULL);
 
   if (strncmp(argv[1], "config", 6) == 0)
     conf_main(argc - 1, &argv[1]);
@@ -90,9 +84,7 @@
     help();
   }
 
-#ifdef MINGW
-  ShutdownWinEnv();
-#endif
+  doneUtil();
 
   return 0;
 }

Modified: GNUnet/src/conf/lex.zconf.c
===================================================================
--- GNUnet/src/conf/lex.zconf.c 2005-05-12 18:45:31 UTC (rev 777)
+++ GNUnet/src/conf/lex.zconf.c 2005-05-12 19:32:53 UTC (rev 778)
@@ -3627,32 +3627,44 @@
 
 void zconf_nextfile(const char *name)
 {
-       struct file *file = file_lookup(name);
-       struct buffer *buf = malloc(sizeof(*buf));
-       memset(buf, 0, sizeof(*buf));
+  char *realfn;
+  struct file *file;
+  struct buffer *buf;
+  
+  realfn = expandDollar("Meta", STRDUP(name));
+  if (strlen(realfn) == 0) {
+    FREE(realfn);
+    realfn = STRDUP(name);
+  }
 
-       current_buf->state = YY_CURRENT_BUFFER;
-       zconfin = zconf_fopen(name);
-       if (!zconfin) {
-               printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), 
zconf_lineno(), name);
-               exit(1);
-       }
-       zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
-       buf->parent = current_buf;
-       current_buf = buf;
+  file = file_lookup(name);
+  buf = malloc(sizeof(*buf));
+  memset(buf, 0, sizeof(*buf));
 
-       if (file->flags & FILE_BUSY) {
-               printf("recursive scan (%s)?\n", name);
-               exit(1);
-       }
-       if (file->flags & FILE_SCANNED) {
-               printf("file %s already scanned?\n", name);
-               exit(1);
-       }
-       file->flags |= FILE_BUSY;
-       file->lineno = 1;
-       file->parent = current_file;
-       current_file = file;
+  current_buf->state = YY_CURRENT_BUFFER;
+  zconfin = zconf_fopen(realfn);
+  if (!zconfin) {
+    printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), 
realfn);
+    exit(1);
+  }
+  zconf_switch_to_buffer(zconf_create_buffer(zconfin, YY_BUF_SIZE));
+  buf->parent = current_buf;
+  current_buf = buf;
+
+  if (file->flags & FILE_BUSY) {
+    printf("recursive scan (%s)?\n", realfn);
+    exit(1);
+  }
+  if (file->flags & FILE_SCANNED) {
+    printf("file %s already scanned?\n", realfn);
+    exit(1);
+  }
+  file->flags |= FILE_BUSY;
+  file->lineno = 1;
+  file->parent = current_file;
+  current_file = file;
+  
+  FREE(realfn);
 }
 
 static struct buffer *zconf_endfile(void)

Modified: GNUnet/src/conf/menu.c
===================================================================
--- GNUnet/src/conf/menu.c      2005-05-12 18:45:31 UTC (rev 777)
+++ GNUnet/src/conf/menu.c      2005-05-12 19:32:53 UTC (rev 778)
@@ -380,19 +380,18 @@
 struct file *file_lookup(const char *name)
 {
        struct file *file;
-       char *realfn;
-       
-       realfn = expandDollar("", name);
-
+  
        for (file = file_list; file; file = file->next) {
-               if (!strcmp(realfn, file->name))
+               if (!strcmp(name, file->name)) {
                        return file;
+    }
        }
 
        file = malloc(sizeof(*file));
        memset(file, 0, sizeof(*file));
-       file->name = realfn;
+       file->name = name;
        file->next = file_list;
        file_list = file;
+  
        return file;
 }

Modified: GNUnet/src/conf/zconf.l
===================================================================
--- GNUnet/src/conf/zconf.l     2005-05-12 18:45:31 UTC (rev 777)
+++ GNUnet/src/conf/zconf.l     2005-05-12 19:32:53 UTC (rev 778)
@@ -304,14 +304,24 @@
 
 void zconf_nextfile(const char *name)
 {
-       struct file *file = file_lookup(name);
-       struct buffer *buf = malloc(sizeof(*buf));
+  char *realfn;
+       struct file *file;
+       struct buffer *buf;
+  
+  realfn = expandDollar("Meta", STRDUP(name));
+  if (strlen(realfn) == 0) {
+    FREE(realfn);
+    realfn = STRDUP(name);
+  }
+
+       file = file_lookup(name);
+       buf = malloc(sizeof(*buf));
        memset(buf, 0, sizeof(*buf));
 
        current_buf->state = YY_CURRENT_BUFFER;
-       yyin = zconf_fopen(name);
+       yyin = zconf_fopen(realfn);
        if (!yyin) {
-               printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), 
zconf_lineno(), name);
+               printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), 
zconf_lineno(), realfn);
                exit(1);
        }
        yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
@@ -319,17 +329,19 @@
        current_buf = buf;
 
        if (file->flags & FILE_BUSY) {
-               printf("recursive scan (%s)?\n", name);
+               printf("recursive scan (%s)?\n", realfn);
                exit(1);
        }
        if (file->flags & FILE_SCANNED) {
-               printf("file %s already scanned?\n", name);
+               printf("file %s already scanned?\n", realfn);
                exit(1);
        }
        file->flags |= FILE_BUSY;
        file->lineno = 1;
        file->parent = current_file;
        current_file = file;
+       
+       FREE(realfn);
 }
 
 static struct buffer *zconf_endfile(void)

Modified: GNUnet/src/util/configuration.c
===================================================================
--- GNUnet/src/util/configuration.c     2005-05-12 18:45:31 UTC (rev 777)
+++ GNUnet/src/util/configuration.c     2005-05-12 19:32:53 UTC (rev 778)
@@ -486,7 +486,7 @@
            configuration_filename);
   parseConfigInit = YES;
   
-  setConfigurationString("", "DATADIR", DATADIR);
+  setConfigurationString("Meta", "DATADIR", DATADIR);
   
   MUTEX_UNLOCK(&configLock);
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]