diff options
author | 2006-05-14 20:16:23 +1000 | |
---|---|---|
committer | 2006-05-14 20:16:23 +1000 | |
commit | 9ebdc16be6bf347dbd0b892f73f4e8329e970916 (patch) | |
tree | c89e80559a598f5c2423e2210082e0a06bc3fa95 /input_common.c | |
parent | 92ecc01baa1e762bc726dc51145434137efc65d4 (diff) |
Fix the longstanding hang-on-exit bug in eterm, as well as making sure the history is saved when the terminal emulator exits
darcs-hash:20060514101623-ac50b-f8ce693ec111e3c158640ef8de309bf7e5484c5b.gz
Diffstat (limited to 'input_common.c')
-rw-r--r-- | input_common.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/input_common.c b/input_common.c index b271b6a5..dcb8bac0 100644 --- a/input_common.c +++ b/input_common.c @@ -64,7 +64,7 @@ static wint_t readb() { unsigned char arr[1]; int do_loop = 0; - + do { fd_set fd; @@ -93,17 +93,21 @@ static wint_t readb() { int res = interrupt_handler(); if( res ) + { return res; + } } + do_loop = 1; break; } default: { - debug( 0, L"Error while reading input from keyboard, shutting down" ); - wperror(L"read"); - exit(1); + /* + The teminal has been closed. Save and exit. + */ + return R_EOF; } } } @@ -120,11 +124,12 @@ static wint_t readb() } if( FD_ISSET( 0, &fd ) ) { - if( read_blocked( 0, arr, 1 ) == -1 ) + if( read_blocked( 0, arr, 1 ) != 1 ) { - debug( 0, L"Error while reading input from keyboard, shutting down" ); - wperror(L"read"); - exit(1); + /* + The teminal has been closed. Save and exit. + */ + return R_EOF; } do_loop = 0; } @@ -179,8 +184,8 @@ wchar_t input_common_readch( int timed ) int sz; - if( b == R_NULL ) - return R_NULL; + if( (b == R_NULL) || (b == R_EOF) ) + return b; bb=b; |