comparison cli-main.c @ 1295:750ec4ec4cbe

Convert #ifdef to #if, other build changes
author Matt Johnston <matt@ucc.asn.au>
date Wed, 04 May 2016 15:33:40 +0200
parents f7d565054e5f
children 2c9dac2d6707
comparison
equal deleted inserted replaced
1294:56aba7dedbea 1295:750ec4ec4cbe
33 #include "netio.h" 33 #include "netio.h"
34 34
35 static void cli_dropbear_exit(int exitcode, const char* format, va_list param) ATTRIB_NORETURN; 35 static void cli_dropbear_exit(int exitcode, const char* format, va_list param) ATTRIB_NORETURN;
36 static void cli_dropbear_log(int priority, const char* format, va_list param); 36 static void cli_dropbear_log(int priority, const char* format, va_list param);
37 37
38 #ifdef ENABLE_CLI_PROXYCMD 38 #if DROPBEAR_CLI_PROXYCMD
39 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out); 39 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out);
40 static void kill_proxy_sighandler(int signo); 40 static void kill_proxy_sighandler(int signo);
41 #endif 41 #endif
42 42
43 #if defined(DBMULTI_dbclient) || !defined(DROPBEAR_MULTI) 43 #if defined(DBMULTI_dbclient) || !DROPBEAR_MULTI
44 #if defined(DBMULTI_dbclient) && defined(DROPBEAR_MULTI) 44 #if defined(DBMULTI_dbclient) && DROPBEAR_MULTI
45 int cli_main(int argc, char ** argv) { 45 int cli_main(int argc, char ** argv) {
46 #else 46 #else
47 int main(int argc, char ** argv) { 47 int main(int argc, char ** argv) {
48 #endif 48 #endif
49 49
72 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { 72 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
73 dropbear_exit("signal() error"); 73 dropbear_exit("signal() error");
74 } 74 }
75 75
76 pid_t proxy_cmd_pid = 0; 76 pid_t proxy_cmd_pid = 0;
77 #ifdef ENABLE_CLI_PROXYCMD 77 #if DROPBEAR_CLI_PROXYCMD
78 if (cli_opts.proxycmd) { 78 if (cli_opts.proxycmd) {
79 cli_proxy_cmd(&sock_in, &sock_out, &proxy_cmd_pid); 79 cli_proxy_cmd(&sock_in, &sock_out, &proxy_cmd_pid);
80 m_free(cli_opts.proxycmd); 80 m_free(cli_opts.proxycmd);
81 if (signal(SIGINT, kill_proxy_sighandler) == SIG_ERR || 81 if (signal(SIGINT, kill_proxy_sighandler) == SIG_ERR ||
82 signal(SIGTERM, kill_proxy_sighandler) == SIG_ERR || 82 signal(SIGTERM, kill_proxy_sighandler) == SIG_ERR ||
148 usershell = m_strdup(get_user_shell()); 148 usershell = m_strdup(get_user_shell());
149 run_shell_command(cmd, ses.maxfd, usershell); 149 run_shell_command(cmd, ses.maxfd, usershell);
150 dropbear_exit("Failed to run '%s'\n", cmd); 150 dropbear_exit("Failed to run '%s'\n", cmd);
151 } 151 }
152 152
153 #ifdef ENABLE_CLI_PROXYCMD 153 #if DROPBEAR_CLI_PROXYCMD
154 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) { 154 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) {
155 char * ex_cmd = NULL; 155 char * ex_cmd = NULL;
156 size_t ex_cmdlen; 156 size_t ex_cmdlen;
157 int ret; 157 int ret;
158 158
173 173
174 static void kill_proxy_sighandler(int UNUSED(signo)) { 174 static void kill_proxy_sighandler(int UNUSED(signo)) {
175 kill_proxy_command(); 175 kill_proxy_command();
176 _exit(1); 176 _exit(1);
177 } 177 }
178 #endif /* ENABLE_CLI_PROXYCMD */ 178 #endif /* DROPBEAR_CLI_PROXYCMD */