]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Configure the pty so that it agrees with our idea of whether
authorSimon Tatham <anakin@pobox.com>
Tue, 15 Oct 2002 18:36:18 +0000 (18:36 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 15 Oct 2002 18:36:18 +0000 (18:36 +0000)
Backspace sends ^H or ^?.

[originally from svn r2076]

unix/pty.c

index 0d7b7fe3626cfa2eda1d8d8e048e38e2075c213b..2a7abb68cf3c523f7f100d29f5bafc7fae1a8506 100644 (file)
@@ -235,6 +235,17 @@ static char *pty_init(char *host, int port, char **realhost, int nodelay)
     strncpy(name, ptsname(pty_master_fd), FILENAME_MAX-1);
 #endif
 
+    /*
+     * Set the backspace character to be whichever of ^H and ^? is
+     * specified by bksp_is_delete.
+     */
+    {
+       struct termios attrs;
+       tcgetattr(pty_master_fd, &attrs);
+       attrs.c_cc[VERASE] = cfg.bksp_is_delete ? '\177' : '\010';
+       tcsetattr(pty_master_fd, TCSANOW, &attrs);
+    }
+
     /*
      * Trap as many fatal signals as we can in the hope of having
      * the best chance to clean up utmp before termination.