diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 15 |
1 files changed, 3 insertions, 12 deletions
@@ -121,9 +121,6 @@ struct sockaddr_storage hostaddr; | |||
121 | */ | 121 | */ |
122 | volatile int received_window_change_signal = 0; | 122 | volatile int received_window_change_signal = 0; |
123 | 123 | ||
124 | /* Value of argv[0] (set in the main program). */ | ||
125 | char *av0; | ||
126 | |||
127 | /* Flag indicating whether we have a valid host private key loaded. */ | 124 | /* Flag indicating whether we have a valid host private key loaded. */ |
128 | int host_private_key_loaded = 0; | 125 | int host_private_key_loaded = 0; |
129 | 126 | ||
@@ -141,7 +138,7 @@ Buffer command; | |||
141 | void | 138 | void |
142 | usage() | 139 | usage() |
143 | { | 140 | { |
144 | fprintf(stderr, "Usage: %s [options] host [command]\n", av0); | 141 | fprintf(stderr, "Usage: %s [options] host [command]\n", __progname); |
145 | fprintf(stderr, "Options:\n"); | 142 | fprintf(stderr, "Options:\n"); |
146 | fprintf(stderr, " -l user Log in using this user name.\n"); | 143 | fprintf(stderr, " -l user Log in using this user name.\n"); |
147 | fprintf(stderr, " -n Redirect input from /dev/null.\n"); | 144 | fprintf(stderr, " -n Redirect input from /dev/null.\n"); |
@@ -169,7 +166,7 @@ usage() | |||
169 | fprintf(stderr, " -p port Connect to this port. Server must be on the same port.\n"); | 166 | fprintf(stderr, " -p port Connect to this port. Server must be on the same port.\n"); |
170 | fprintf(stderr, " -L listen-port:host:port Forward local port to remote address\n"); | 167 | fprintf(stderr, " -L listen-port:host:port Forward local port to remote address\n"); |
171 | fprintf(stderr, " -R listen-port:host:port Forward remote port to local address\n"); | 168 | fprintf(stderr, " -R listen-port:host:port Forward remote port to local address\n"); |
172 | fprintf(stderr, " These cause %s to listen for connections on a port, and\n", av0); | 169 | fprintf(stderr, " These cause %s to listen for connections on a port, and\n", __progname); |
173 | fprintf(stderr, " forward them to the other side by connecting to host:port.\n"); | 170 | fprintf(stderr, " forward them to the other side by connecting to host:port.\n"); |
174 | fprintf(stderr, " -C Enable compression.\n"); | 171 | fprintf(stderr, " -C Enable compression.\n"); |
175 | fprintf(stderr, " -N Do not execute a shell or command.\n"); | 172 | fprintf(stderr, " -N Do not execute a shell or command.\n"); |
@@ -273,9 +270,6 @@ main(int ac, char **av) | |||
273 | */ | 270 | */ |
274 | umask(022); | 271 | umask(022); |
275 | 272 | ||
276 | /* Save our own name. */ | ||
277 | av0 = av[0]; | ||
278 | |||
279 | /* Initialize option structure to indicate that no values have been set. */ | 273 | /* Initialize option structure to indicate that no values have been set. */ |
280 | initialize_options(&options); | 274 | initialize_options(&options); |
281 | 275 | ||
@@ -283,10 +277,7 @@ main(int ac, char **av) | |||
283 | host = NULL; | 277 | host = NULL; |
284 | 278 | ||
285 | /* If program name is not one of the standard names, use it as host name. */ | 279 | /* If program name is not one of the standard names, use it as host name. */ |
286 | if (strchr(av0, '/')) | 280 | cp = __progname; |
287 | cp = strrchr(av0, '/') + 1; | ||
288 | else | ||
289 | cp = av0; | ||
290 | #ifdef HAVE_CYGWIN | 281 | #ifdef HAVE_CYGWIN |
291 | if (strcasecmp(cp, "rsh") && strcasecmp(cp, "ssh") && | 282 | if (strcasecmp(cp, "rsh") && strcasecmp(cp, "ssh") && |
292 | strcasecmp(cp, "rlogin") && strcasecmp(cp, "slogin") && | 283 | strcasecmp(cp, "rlogin") && strcasecmp(cp, "slogin") && |