gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3383 - in GNUnet/src: applications/datastore applications/


From: durner
Subject: [GNUnet-SVN] r3383 - in GNUnet/src: applications/datastore applications/fs/collection applications/fs/namespace applications/rpc applications/template server setup
Date: Sat, 9 Sep 2006 14:45:51 -0700 (PDT)

Author: durner
Date: 2006-09-09 14:45:39 -0700 (Sat, 09 Sep 2006)
New Revision: 3383

Modified:
   GNUnet/src/applications/datastore/Makefile.am
   GNUnet/src/applications/fs/collection/Makefile.am
   GNUnet/src/applications/fs/namespace/Makefile.am
   GNUnet/src/applications/rpc/Makefile.am
   GNUnet/src/applications/template/Makefile.am
   GNUnet/src/server/gnunetd.c
   GNUnet/src/setup/Makefile.am
   GNUnet/src/setup/gnunet-win-tool.c
Log:
fix MinGW

Modified: GNUnet/src/applications/datastore/Makefile.am
===================================================================
--- GNUnet/src/applications/datastore/Makefile.am       2006-09-09 19:49:20 UTC 
(rev 3382)
+++ GNUnet/src/applications/datastore/Makefile.am       2006-09-09 21:45:39 UTC 
(rev 3383)
@@ -14,5 +14,6 @@
 libgnunetmodule_datastore_la_LIBADD = \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/util/cron/libgnunetutil_cron.la \
+ $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la \
  $(top_builddir)/src/util/containers/libgnunetutil_containers.la 
 

Modified: GNUnet/src/applications/fs/collection/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/collection/Makefile.am   2006-09-09 19:49:20 UTC 
(rev 3382)
+++ GNUnet/src/applications/fs/collection/Makefile.am   2006-09-09 21:45:39 UTC 
(rev 3383)
@@ -8,6 +8,7 @@
 libgnunetcollection_la_LIBADD = \
  $(top_builddir)/src/applications/fs/namespace/libgnunetnamespace.la \
  $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
+ $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la \
  $(top_builddir)/src/util/libgnunetutil.la 
 
 

Modified: GNUnet/src/applications/fs/namespace/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/namespace/Makefile.am    2006-09-09 19:49:20 UTC 
(rev 3382)
+++ GNUnet/src/applications/fs/namespace/Makefile.am    2006-09-09 21:45:39 UTC 
(rev 3383)
@@ -7,6 +7,7 @@
   namespace_info.c 
 libgnunetnamespace_la_LIBADD = \
  $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
+  $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la \
  $(top_builddir)/src/util/libgnunetutil.la 
 
 check_PROGRAMS = \

Modified: GNUnet/src/applications/rpc/Makefile.am
===================================================================
--- GNUnet/src/applications/rpc/Makefile.am     2006-09-09 19:49:20 UTC (rev 
3382)
+++ GNUnet/src/applications/rpc/Makefile.am     2006-09-09 21:45:39 UTC (rev 
3383)
@@ -14,6 +14,7 @@
 libgnunetmodule_rpc_la_LIBADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/util/cron/libgnunetutil_cron.la \
+  $(top_builddir)/src/util/containers/libgnunetutil_containers.la \
   $(top_builddir)/src/applications/rpc/libgnunetmodule_rpc_util.la
 
 libgnunetmodule_rpc_la_LDFLAGS = \

Modified: GNUnet/src/applications/template/Makefile.am
===================================================================
--- GNUnet/src/applications/template/Makefile.am        2006-09-09 19:49:20 UTC 
(rev 3382)
+++ GNUnet/src/applications/template/Makefile.am        2006-09-09 21:45:39 UTC 
(rev 3383)
@@ -22,6 +22,7 @@
   template.c 
 libgnunetmodule_template_la_LDFLAGS = \
   -export-dynamic -avoid-version -module \
+  $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/util/network_client/libgnunetutil_network_client.la 
 
 

Modified: GNUnet/src/server/gnunetd.c
===================================================================
--- GNUnet/src/server/gnunetd.c 2006-09-09 19:49:20 UTC (rev 3382)
+++ GNUnet/src/server/gnunetd.c 2006-09-09 21:45:39 UTC (rev 3383)
@@ -48,6 +48,7 @@
 
 static int debug_flag;
 
+#ifndef WINDOWS
 /**
  * Cron job that triggers re-reading of the configuration.
  */
@@ -68,6 +69,7 @@
               0,
               NULL);
 }
+#endif
 
 /**
  * Park main thread until shutdown has been signaled.
@@ -108,16 +110,20 @@
   cron = cron_create(ectx);
   GE_ASSERT(ectx,
            cron != NULL);
+#ifndef WINDOWS
   shc_hup = signal_handler_install(SIGHUP, &reread_config);
+#endif
   if (OK != initCore(ectx,
                     cfg,
                     cron,
                     mon)) {
     cron_destroy(cron);
     os_network_monitor_destroy(mon);
+#ifndef WINDOWS
     signal_handler_uninstall(SIGHUP, 
                             &reread_config,
                             shc_hup);
+#endif
     if (NO == debug_flag)
       os_terminal_detach_complete(ectx,
                                  filedes,
@@ -142,9 +148,11 @@
   doneConnection(); 
   doneCore();
   os_network_monitor_destroy(mon);
+#ifndef WINDOWS
   signal_handler_uninstall(SIGHUP, 
                           &reread_config,
                           shc_hup);
+#endif
   cron_destroy(cron);
   return OK;
 }

Modified: GNUnet/src/setup/Makefile.am
===================================================================
--- GNUnet/src/setup/Makefile.am        2006-09-09 19:49:20 UTC (rev 3382)
+++ GNUnet/src/setup/Makefile.am        2006-09-09 21:45:39 UTC (rev 3383)
@@ -7,7 +7,11 @@
  curses_dir = ncurses
 endif
 
-SUBDIRS = lib text . $(curses_dir)
+if !MINGW
+ textdir=text
+endif
+
+SUBDIRS = lib $(textdir) . $(curses_dir)
 # $(gtk_dir) .
 
 plugindir = $(libdir)/GNUnet
@@ -38,4 +42,5 @@
 gnunet_win_tool_LDADD = \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/util/loggers/libgnunetutil_logging.la \
+ $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la \
  $(top_builddir)/src/util/config_impl/libgnunetutil_config.la 

Modified: GNUnet/src/setup/gnunet-win-tool.c
===================================================================
--- GNUnet/src/setup/gnunet-win-tool.c  2006-09-09 19:49:20 UTC (rev 3382)
+++ GNUnet/src/setup/gnunet-win-tool.c  2006-09-09 21:45:39 UTC (rev 3383)
@@ -25,39 +25,51 @@
  */
 
 #include "platform.h"
+#include "gnunet_util_os.h"
+#include "gnunet_util_crypto.h"
+#include "gnunet_util_error_loggers.h"
+
 #include <conio.h>
 
 #define WINTOOL_VERSION "0.1.0"
 
-static int bPrintAdapters, bInstall, bUninstall, bConn;
-static char *hashFile;
 static char chunk1[] = {0x62, 0x13, 0x06, 0x00};
 static char chunk2[] = {0xFE, 0xFF, 0xFF, 0x00};
 static char chunk3[] = {0xBC, 0x28, 0x06, 0x00};
 static char chunk4[] = {0xCF, 0x47, 0x06, 0x00};
 
 /**
- * Prints the usage information for this command if the user errs.
- * Aborts the program.
+ * configuration
  */
-static void printhelp() {
-  static Help help[] = {
-    HELP_CONFIG,
-    HELP_HELP,
-    HELP_LOGLEVEL,
-    { 'n', "netadapters", NULL, "list all network adapters" },
-    { 'i', "install", NULL, "install GNUnet as Windows service" },
-    { 'u', "uninstall", NULL, "uninstall GNUnet service" },
-    { 'C', "increase-connections", NULL, "increase the maximum number of 
TCP/IP connections"},
-    HELP_VERSION,
-    HELP_END,
-  };
-  formatHelp("gnunet-win-tool [OPTIONS]",
-            "Tool for Windows specific tasks.",
-            help);
-}
+static unsigned int bPrintAdapters = 0, bInstall = 0, bUninstall = 0, bConn = 
0;
+static char *hashFile = NULL;
 
+static struct GE_Context * ectx;
+
 /**
+ * All gnunet-win-tool command line options
+ */
+static struct CommandLineOption gnunetwinOptions[] = {
+  { 'n', "netadapters", "network adapters",
+    gettext_noop("list all network adapters"),
+    0, &gnunet_getopt_configure_set_uint, &bPrintAdapters },
+  { 'i', "install", "install service",
+    gettext_noop("install GNUnet as Windows service"),
+    0, &gnunet_getopt_configure_set_uint, &bInstall },
+  { 'u', "uninstall", "uninstall service",
+    gettext_noop("uninstall GNUnet service"),
+    0, &gnunet_getopt_configure_set_uint, &bUninstall },
+  { 'C', "increase-connections", "increase connections",
+    gettext_noop("increase the maximum number of TCP/IP connections"),
+    0, &gnunet_getopt_configure_set_uint, &bConn },
+  { 'R', "filehash", "hash",
+    gettext_noop("display a file's hash value"),
+    1, &gnunet_getopt_configure_set_string, &hashFile },
+  COMMAND_LINE_OPTION_VERSION(WINTOOL_VERSION), /* -v */
+    COMMAND_LINE_OPTION_END,
+};
+
+/**
  * Print all network adapters with their index number
  */
 void PrintAdapters()
@@ -296,9 +308,9 @@
   EncName hex;
   char *c;
 
-  getFileHash(hashFile, &code);
+  getFileHash(ectx, hashFile, &code);
   hash2enc(&code, &hex);
-  printf("RIPEMD160(%s)= ", hashFile);
+  printf("SHA512(%s)= ", hashFile);
 
   /* Flip byte order */
   c = (char *) hex.encoding;
@@ -314,83 +326,6 @@
 }
 
 /**
- * Parse the options.
- *
- * @param argc the number of options
- * @param argv the option list (including keywords)
- * @return SYSERR if we should abort, OK to continue
- */
-static int parseOptions(int argc, char ** argv) {
-  int option_index;
-  int c;
-  BOOL bPrintHelp = TRUE;
-
-  while (1) {
-    static struct GNoption long_options[] = {
-      { "netadapters",          0, 0, 'n' },
-      { "install",              0, 0, 'i' },
-      { "uninstall",            0, 0, 'u' },
-      { "increase-connections", 0, 0, 'C' },
-      { "filehash",             1, 0, 'R' },
-      LONG_DEFAULT_OPTIONS,
-      { 0,0,0,0 }
-    };
-    option_index = 0;
-    c = GNgetopt_long(argc,
-                     argv,
-                     "vhdc:L:H:niuCR:",
-                     long_options,
-                     &option_index);
-    if (c == -1)
-      break;  /* No more flags to process */
-
-    bPrintHelp = FALSE;
-
-    if (YES == parseDefaultOptions(c, GNoptarg))
-      continue;
-    switch(c) {
-      case 'v':
-        printf("GNUnet v%s, gnunet-win-tool v%s\n",
-             VERSION, WINTOOL_VERSION);
-        return SYSERR;
-      case 'h':
-        printhelp();
-        return SYSERR;
-      case 'n':
-        bPrintAdapters = YES;
-        break;
-      case 'i':
-        bInstall = YES;
-        break;
-      case 'u':
-        bUninstall = YES;
-        break;
-      case 'C':
-        bConn = YES;
-        break;
-      case 'R':
-        hashFile = MALLOC(strlen(GNoptarg) + 1);
-        strcpy(hashFile, GNoptarg);
-        break;
-      default:
-        GE_LOG(ectx, GE_ERROR | GE_IMMEDIATE | GE_USER,
-                 "Unknown option %c. Aborting.\n"\
-                 "Use --help to get a list of options.\n",
-         c);
-        return -1;
-    } /* end of parsing commandline */
-  } /* while (1) */
-
-  if (bPrintHelp) {
-    printhelp();
-
-    return SYSERR;
-  }
-
-  return OK;
-}
-
-/**
  * The main function.
  *
  * @param argc number of arguments from the command line
@@ -401,11 +336,23 @@
   int res;
 
   res = OK;
-  hashFile = NULL;
-  bPrintAdapters = bInstall = bUninstall = bConn = NO;
 
-  if (SYSERR == initUtil(argc, argv, &parseOptions))
-    return 0;
+  /* startup */
+  ectx = GE_create_context_stderr(NO, 
+          GE_WARNING | GE_ERROR | GE_FATAL |
+          GE_USER | GE_ADMIN | GE_DEVELOPER |
+          GE_IMMEDIATE | GE_BULK);
+  res = gnunet_parse_options("gnunet-win-tool [OPTIONS] [KEYWORDS]",
+         ectx,
+         NULL,
+         gnunetwinOptions,
+         (unsigned int) argc,
+         argv);
+  if (res == SYSERR)
+  {
+    GE_free_context(ectx);
+    return -1;  
+  }
 
   if (bPrintAdapters)
     PrintAdapters();
@@ -418,7 +365,7 @@
   if (hashFile)
     doHash();
 
-  doneUtil();
+  GE_free_context(ectx);
 
   return (res == OK) ? 0 : 1;
 }





reply via email to

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