X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fuxplink.c;h=3e32925cd4e182cf54baa1d0a7397bce415adcf7;hb=f004bcca17a789356c32527a396b68b71a773db2;hp=08780899f061067416453911aaaa9abff3201880;hpb=c269dd0135a927d4d22a334cfefb09361f311fcd;p=PuTTY.git diff --git a/unix/uxplink.c b/unix/uxplink.c index 08780899..3e32925c 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -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; @@ -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. */