[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r11395: Fix compilation of ntmain.c. (tor/trunk/src/or)
Author: nickm
Date: 2007-09-06 14:19:09 -0400 (Thu, 06 Sep 2007)
New Revision: 11395
Modified:
tor/trunk/src/or/main.c
tor/trunk/src/or/ntmain.c
tor/trunk/src/or/or.h
Log:
Fix compilation of ntmain.c.
Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c 2007-09-06 18:17:52 UTC (rev 11394)
+++ tor/trunk/src/or/main.c 2007-09-06 18:19:09 UTC (rev 11395)
@@ -12,6 +12,7 @@
* connections, implements main loop, and drives scheduled events.
**/
+#define MAIN_PRIVATE
#include "or.h"
#ifdef USE_DMALLOC
#include <dmalloc.h>
@@ -1302,7 +1303,7 @@
}
/** Tor main loop. */
-static int
+/* static */ int
do_main_loop(void)
{
int loop_result;
@@ -1697,7 +1698,7 @@
/** Main entry point for the Tor command-line client.
*/
-static int
+/* static */ int
tor_init(int argc, char *argv[])
{
char buf[256];
@@ -1834,7 +1835,7 @@
}
/** Read/create keys as needed, and echo our fingerprint to stdout. */
-static int
+/* static */ int
do_list_fingerprint(void)
{
char buf[FINGERPRINT_LEN+1];
@@ -1864,7 +1865,7 @@
/** Entry point for password hashing: take the desired password from
* the command line, and print its salted hash to stdout. **/
-static void
+/* static */ void
do_hash_password(void)
{
@@ -1902,8 +1903,11 @@
log_notice(LD_CONFIG, "Set up dmalloc; returned %d", r);
#endif
#ifdef NT_SERVICE
- if ((result = nt_service_parse_options(argv, argc)))
- return result;
+ {
+ int done = 0;
+ result = nt_service_parse_options(argc, argv, &done);
+ if (done) return result;
+ }
#endif
if (tor_init(argc, argv)<0)
return -1;
Modified: tor/trunk/src/or/ntmain.c
===================================================================
--- tor/trunk/src/or/ntmain.c 2007-09-06 18:17:52 UTC (rev 11394)
+++ tor/trunk/src/or/ntmain.c 2007-09-06 18:19:09 UTC (rev 11395)
@@ -4,6 +4,7 @@
/* See LICENSE for licensing information */
/* $Id$ */
+#define MAIN_PRIVATE
#include "or.h"
const char ntmain_c_id[] =
@@ -194,7 +195,7 @@
}
/** DOCDOC */
-int
+void
nt_service_set_state(DWORD state)
{
service_status.dwCurrentState = state;
@@ -708,13 +709,13 @@
(LPSTR)&msgbuf, 0, NULL);
return msgbuf;
}
-#endif
int
-nt_service_parse_options(int argc, char **argv)
+nt_service_parse_options(int argc, char **argv, int *should_exit)
{
backup_argv = argv;
backup_argc = argc;
+ *should_exit = 0;
if ((argc >= 3) &&
(!strcmp(argv[1], "-service") || !strcmp(argv[1], "--service"))) {
@@ -728,13 +729,15 @@
if (!strcmp(argv[2], "stop"))
return nt_service_cmd_stop();
printf("Unrecognized service command '%s'\n", argv[2]);
- return -1;
+ *should_exit = 1;
+ return 1;
}
if (argc >= 2) {
if (!strcmp(argv[1], "-nt-service") || !strcmp(argv[1], "--nt-service")) {
nt_service_loadlibrary();
nt_service_main();
- return ;
+ *should_exit = 1;
+ return 0;
}
// These values have been deprecated since 0.1.1.2-alpha; we've warned
// about them since 0.1.2.7-alpha.
@@ -743,6 +746,7 @@
fprintf(stderr,
"The %s option is deprecated; use \"--service install\" instead.",
argv[1]);
+ *should_exit = 1;
return nt_service_install(argc, argv);
}
if (!strcmp(argv[1], "-remove") || !strcmp(argv[1], "--remove")) {
@@ -750,8 +754,11 @@
fprintf(stderr,
"The %s option is deprecated; use \"--service remove\" instead.",
argv[1]);
+ *should_exit = 1;
return nt_service_remove();
}
}
+ *should_exit = 0;
+ return 0;
}
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-09-06 18:17:52 UTC (rev 11394)
+++ tor/trunk/src/or/or.h 2007-09-06 18:19:09 UTC (rev 11395)
@@ -3018,13 +3018,20 @@
int tor_main(int argc, char *argv[]);
+#ifdef MAIN_PRIVATE
+int do_main_loop(void);
+int do_list_fingerprint(void);
+void do_hash_password(void);
+int tor_init(int argc, char **argv);
+#endif
+
/********************************* ntmain.c ***************************/
#ifdef MS_WINDOWS
#define NT_SERVICE
#endif
#ifdef NT_SERVICE
-int nt_service_parse_options(int argc, char **argv);
+int nt_service_parse_options(int argc, char **argv, int *should_exit);
int nt_service_is_stopping(void);
void nt_service_set_state(DWORD state);
#else