mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Fix compilation of ntmain.c.
svn:r11395
This commit is contained in:
parent
4c4280e249
commit
1c8bd05c70
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user