… | |
… | |
2 | * File: ptytty.C |
2 | * File: ptytty.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
6 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
7 | * Copyright (c) 2004 Marc Lehmann <pcg@goof.com> |
7 | * Copyright (c) 2004-2006 Marc Lehmann <pcg@goof.com> |
8 | * |
8 | * |
9 | * This program is free software; you can redistribute it and/or modify |
9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by |
10 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or |
11 | * the Free Software Foundation; either version 2 of the License, or |
12 | * (at your option) any later version. |
12 | * (at your option) any later version. |
… | |
… | |
396 | |
396 | |
397 | void |
397 | void |
398 | |
398 | |
399 | rxvt_ptytty::close_tty () |
399 | rxvt_ptytty::close_tty () |
400 | { |
400 | { |
401 | if (tty >= 0) close (tty); |
401 | if (tty < 0) |
|
|
402 | return; |
|
|
403 | |
|
|
404 | close (tty); |
402 | tty = -1; |
405 | tty = -1; |
403 | } |
406 | } |
404 | |
407 | |
405 | void |
408 | void |
406 | rxvt_ptytty::put () |
409 | rxvt_ptytty::put () |
… | |
… | |
451 | |
454 | |
452 | void |
455 | void |
453 | rxvt_ptytty::set_utf8_mode (bool on) |
456 | rxvt_ptytty::set_utf8_mode (bool on) |
454 | { |
457 | { |
455 | #ifdef IUTF8 |
458 | #ifdef IUTF8 |
456 | if (pty != -1) |
459 | if (pty < 0) |
457 | { |
460 | return; |
|
|
461 | |
458 | struct termios tio; |
462 | struct termios tio; |
459 | |
463 | |
460 | if (tcgetattr (pty, &tio) != -1) |
464 | if (tcgetattr (pty, &tio) != -1) |
|
|
465 | { |
|
|
466 | tcflag_t new_cflag = tio.c_iflag; |
|
|
467 | |
|
|
468 | if (on) |
|
|
469 | new_cflag |= IUTF8; |
|
|
470 | else |
|
|
471 | new_cflag &= ~IUTF8; |
|
|
472 | |
|
|
473 | if (new_cflag != tio.c_iflag) |
461 | { |
474 | { |
462 | tcflag_t new_cflag = tio.c_iflag; |
|
|
463 | |
|
|
464 | if (on) |
|
|
465 | new_cflag |= IUTF8; |
|
|
466 | else |
|
|
467 | new_cflag &= ~IUTF8; |
|
|
468 | |
|
|
469 | if (new_cflag != tio.c_iflag) |
|
|
470 | { |
|
|
471 | tio.c_iflag = new_cflag; |
475 | tio.c_iflag = new_cflag; |
472 | tcsetattr (pty, TCSANOW, &tio); |
476 | tcsetattr (pty, TCSANOW, &tio); |
473 | } |
|
|
474 | } |
477 | } |
475 | } |
478 | } |
476 | #endif |
479 | #endif |
477 | } |
480 | } |
478 | |
481 | |