diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-09-06 18:19:09 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-09-06 18:19:09 +0000 |
commit | 1c8bd05c7086d9023faed011fa11737ced7fa4fb (patch) | |
tree | 0c8b7fc92527c26e77464dccab1926abf28250f9 /src/or | |
parent | 4c4280e249a6eec386bc8160c6d89d78e58eba8c (diff) | |
download | tor-1c8bd05c7086d9023faed011fa11737ced7fa4fb.tar.gz tor-1c8bd05c7086d9023faed011fa11737ced7fa4fb.zip |
Fix compilation of ntmain.c.
svn:r11395
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/main.c | 16 | ||||
-rw-r--r-- | src/or/ntmain.c | 17 | ||||
-rw-r--r-- | src/or/or.h | 9 |
3 files changed, 30 insertions, 12 deletions
diff --git a/src/or/main.c b/src/or/main.c index 651b46f077..e6e45ecb97 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -12,6 +12,7 @@ const char main_c_id[] = * connections, implements main loop, and drives scheduled events. **/ +#define MAIN_PRIVATE #include "or.h" #ifdef USE_DMALLOC #include <dmalloc.h> @@ -1302,7 +1303,7 @@ do_hup(void) } /** Tor main loop. */ -static int +/* static */ int do_main_loop(void) { int loop_result; @@ -1697,7 +1698,7 @@ handle_signals(int is_parent) /** 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 @@ tor_cleanup(void) } /** 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 @@ do_list_fingerprint(void) /** 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 @@ tor_main(int argc, char *argv[]) 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; diff --git a/src/or/ntmain.c b/src/or/ntmain.c index da149298ba..e460582e1f 100644 --- a/src/or/ntmain.c +++ b/src/or/ntmain.c @@ -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 @@ nt_service_is_stopping(void) } /** DOCDOC */ -int +void nt_service_set_state(DWORD state) { service_status.dwCurrentState = state; @@ -708,13 +709,13 @@ nt_strerror(uint32_t errnum) (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 @@ nt_service_parse_options(int argc, char **argv) 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 @@ nt_service_parse_options(int argc, char **argv) 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 @@ nt_service_parse_options(int argc, char **argv) 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; } diff --git a/src/or/or.h b/src/or/or.h index 7ef606bbf4..004a7df106 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -3018,13 +3018,20 @@ void tor_free_all(int postfork); 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 |