X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fuxplink.c;h=64c3cabcdacc66afd58e6ec87b9684e14725a863;hb=89da2ddf564a93414ee9ab2df3f053608094e417;hp=08780899f061067416453911aaaa9abff3201880;hpb=c269dd0135a927d4d22a334cfefb09361f311fcd;p=PuTTY.git diff --git a/unix/uxplink.c b/unix/uxplink.c index 08780899..64c3cabc 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -29,7 +29,7 @@ void *logctx; static struct termios orig_termios; -void fatalbox(char *p, ...) +void fatalbox(const char *p, ...) { struct termios cf; va_list ap; @@ -46,7 +46,7 @@ void fatalbox(char *p, ...) } cleanup_exit(1); } -void modalfatalbox(char *p, ...) +void modalfatalbox(const char *p, ...) { struct termios cf; va_list ap; @@ -63,7 +63,7 @@ void modalfatalbox(char *p, ...) } cleanup_exit(1); } -void nonfatal(char *p, ...) +void nonfatal(const char *p, ...) { struct termios cf; va_list ap; @@ -75,7 +75,7 @@ void nonfatal(char *p, ...) fputc('\n', stderr); postmsg(&cf); } -void connection_fatal(void *frontend, char *p, ...) +void connection_fatal(void *frontend, const char *p, ...) { struct termios cf; va_list ap; @@ -92,7 +92,7 @@ void connection_fatal(void *frontend, char *p, ...) } cleanup_exit(1); } -void cmdline_error(char *p, ...) +void cmdline_error(const char *p, ...) { struct termios cf; va_list ap; @@ -113,14 +113,12 @@ static void *backhandle; static Conf *conf; /* - * Default settings that are specific to pterm. + * Default settings that are specific to Unix plink. */ char *platform_default_s(const char *name) { if (!strcmp(name, "TermType")) return dupstr(getenv("TERM")); - if (!strcmp(name, "UserName")) - return get_username(); if (!strcmp(name, "SerialLine")) return dupstr("/dev/ttyS0"); return NULL; @@ -448,7 +446,7 @@ int from_backend_eof(void *frontend_handle) return FALSE; /* do not respond to incoming EOF with outgoing */ } -int get_userpass_input(prompts_t *p, unsigned char *in, int inlen) +int get_userpass_input(prompts_t *p, const unsigned char *in, int inlen) { int ret; ret = cmdline_get_passwd_input(p, in, inlen); @@ -543,7 +541,7 @@ void uxsel_input_remove(int id) { } */ static void usage(void) { - printf("PuTTY Link: command-line connection utility\n"); + printf("Plink: command-line connection utility\n"); printf("%s\n", ver); printf("Usage: plink [options] [user@]host [command]\n"); printf(" (\"host\" can also be a PuTTY saved session name)\n"); @@ -883,6 +881,18 @@ int main(int argc, char **argv) */ cmdline_run_saved(conf); + /* + * If we have no better ideas for the remote username, use the local + * one, as 'ssh' does. + */ + if (conf_get_str(conf, CONF_username)[0] == '\0') { + char *user = get_username(); + if (user) { + conf_set_str(conf, CONF_username, user); + sfree(user); + } + } + /* * Apply subsystem status. */