gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1100 - GNUnet/src/conf


From: durner
Subject: [GNUnet-SVN] r1100 - GNUnet/src/conf
Date: Mon, 27 Jun 2005 13:25:01 -0700 (PDT)

Author: durner
Date: 2005-06-27 13:24:56 -0700 (Mon, 27 Jun 2005)
New Revision: 1100

Modified:
   GNUnet/src/conf/gnunet-setup.c
   GNUnet/src/conf/recreate.c
   GNUnet/src/conf/symbol.c
Log:
fix (re)creation of configuration files

Modified: GNUnet/src/conf/gnunet-setup.c
===================================================================
--- GNUnet/src/conf/gnunet-setup.c      2005-06-27 18:58:38 UTC (rev 1099)
+++ GNUnet/src/conf/gnunet-setup.c      2005-06-27 20:24:56 UTC (rev 1100)
@@ -93,6 +93,11 @@
 #endif
   }
   else if (strncmp(argv[1], "recreate", 7) == 0) {
+       if (argc < 3) {
+               puts(_("Please specify a path where the configuration files 
will be "
+                       "stored."));
+               return 1;
+       }
        recreate_main(argc - 1, &argv[1]);
   }
        else {

Modified: GNUnet/src/conf/recreate.c
===================================================================
--- GNUnet/src/conf/recreate.c  2005-06-27 18:58:38 UTC (rev 1099)
+++ GNUnet/src/conf/recreate.c  2005-06-27 20:24:56 UTC (rev 1100)
@@ -32,7 +32,15 @@
 
 int recreate_main(int ac, char **av) {
        struct symbol *sym;
+       const char *dstDir;
+       int dirLen;
        
+       dirLen = strlen(av[1]);
+       dstDir = MALLOC(dirLen + 2);
+       strcpy(dstDir, av[1]);
+       if (dstDir[dirLen - 1] != DIR_SEPARATOR)
+               strcat(dstDir, DIR_SEPARATOR_STR);
+       
        conf_parse(DATADIR"/config.in");
 
        /* we are setting advanced/rare settings below */
@@ -45,24 +53,28 @@
 
        /* save new config files to DATADIR */
   sym = sym_find("config-daemon.in_CONF_DEF_DIR", "Meta");
-       sym_set_string_value(sym, DATADIR"/");
+       sym_set_string_value(sym, dstDir);
 
   sym = sym_find("config-daemon.in_CONF_DEF_FILE", "Meta");
        sym_set_string_value(sym, "gnunet.root");
 
   sym = sym_find("config-client.in_CONF_DEF_DIR", "Meta");
-       sym_set_string_value(sym, DATADIR"/");
+       sym_set_string_value(sym, dstDir);
 
   sym = sym_find("config-client.in_CONF_DEF_FILE", "Meta");
        sym_set_string_value(sym, "gnunet.user");
+       
+       FREE(dstDir);
 
        /* Write defaults */
-       if (!conf_write()) {
-               printf(_("Unable to save configuration files to %s.\n"), 
DATADIR);
+       if (conf_write()) {
+               printf(_("Unable to save configuration files: %s.\n"), 
STRERROR(errno));
                return 1;
        }
-       else
+       else {
+               puts(_("Configuration files (re)created.\n"));
                return 0;
+       }
 }
 
 /* end of silent.c */

Modified: GNUnet/src/conf/symbol.c
===================================================================
--- GNUnet/src/conf/symbol.c    2005-06-27 18:58:38 UTC (rev 1099)
+++ GNUnet/src/conf/symbol.c    2005-06-27 20:24:56 UTC (rev 1100)
@@ -316,7 +316,7 @@
        case S_STRING:
        case S_HEX:
        case S_INT:
-               if (sym->visible != no) {
+               if (sym->visible != no || returnInv) {
                        sym->flags |= SYMBOL_WRITE;
                        if (sym_has_value(sym)) {
                                newval.val = sym->user.val;





reply via email to

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