]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - unix/uxplink.c
Merge branch 'pre-0.64'
[PuTTY.git] / unix / uxplink.c
index 3901ba973309e0df6cb956762825f91780c5674b..3e32925cd4e182cf54baa1d0a7397bce415adcf7 100644 (file)
@@ -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;
@@ -152,7 +150,7 @@ int term_ldisc(Terminal *term, int mode)
 {
     return FALSE;
 }
-void ldisc_update(void *frontend, int echo, int edit)
+void frontend_echoedit_update(void *frontend, int echo, int edit)
 {
     /* Update stdin read mode to reflect changes in line discipline. */
     struct termios mode;
@@ -178,8 +176,9 @@ void ldisc_update(void *frontend, int echo, int edit)
        mode.c_cc[VMIN] = 1;
        mode.c_cc[VTIME] = 0;
        /* FIXME: perhaps what we do with IXON/IXOFF should be an
-        * argument to ldisc_update(), to allow implementation of SSH-2
-        * "xon-xoff" and Rlogin's equivalent? */
+        * argument to frontend_echoedit_update(), to allow
+        * implementation of SSH-2 "xon-xoff" and Rlogin's
+        * equivalent? */
        mode.c_iflag &= ~IXON;
        mode.c_iflag &= ~IXOFF;
     }
@@ -542,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");
@@ -882,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.
      */
@@ -981,7 +992,7 @@ int main(int argc, char **argv)
      */
     local_tty = (tcgetattr(STDIN_FILENO, &orig_termios) == 0);
     atexit(cleanup_termios);
-    ldisc_update(NULL, 1, 1);
+    frontend_echoedit_update(NULL, 1, 1);
     sending = FALSE;
     now = GETTICKCOUNT();