X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fuxplink.c;h=6290a2c2a713b7adb2a4bd7fc1debd99591ae058;hb=a063e522970946bf7d5dc052079d7773c0dee76d;hp=3901ba973309e0df6cb956762825f91780c5674b;hpb=a44a6c3c544f28431f8df0f766a598bb27f7b786;p=PuTTY.git diff --git a/unix/uxplink.c b/unix/uxplink.c index 3901ba97..6290a2c2 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; @@ -542,7 +540,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"); @@ -882,6 +880,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. */