This repository was archived by the owner on Dec 13, 2023. It is now read-only.
File tree 2 files changed +17
-1
lines changed 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
#ifndef GUARD_TERMKEY_INTERNAL_H_
2
2
#define GUARD_TERMKEY_INTERNAL_H_
3
3
4
+ //#define HAVE_TERMIOS
5
+
6
+ #ifdef _WIN32
7
+ # undef HAVE_TERMIOS
8
+ #endif
9
+
4
10
#include "termkey.h"
5
11
6
12
#include <stdint.h>
7
- #include <termios.h>
13
+ #ifdef HAVE_TERMIOS
14
+ # include <termios.h>
15
+ #endif
8
16
9
17
#ifdef _MSC_VER
10
18
#include <BaseTsd.h>
@@ -46,8 +54,10 @@ struct TermKey {
46
54
size_t hightide ; /* Position beyond buffstart at which peekkey() should next start
47
55
* normally 0, but see also termkey_interpret_csi */
48
56
57
+ #ifdef HAVE_TERMIOS
49
58
struct termios restore_termios ;
50
59
char restore_termios_valid ;
60
+ #endif
51
61
52
62
TermKey_Terminfo_Getstr_Hook * ti_getstr_hook ;
53
63
void * ti_getstr_hook_data ;
Original file line number Diff line number Diff line change @@ -285,7 +285,9 @@ static TermKey *termkey_alloc(void)
285
285
tk -> buffsize = 256 ; /* bytes */
286
286
tk -> hightide = 0 ;
287
287
288
+ #ifdef HAVE_TERMIOS
288
289
tk -> restore_termios_valid = 0 ;
290
+ #endif
289
291
290
292
tk -> ti_getstr_hook = NULL ;
291
293
tk -> ti_getstr_hook_data = NULL ;
@@ -486,6 +488,7 @@ int termkey_start(TermKey *tk)
486
488
if (tk -> is_started )
487
489
return 1 ;
488
490
491
+ #ifdef HAVE_TERMIOS
489
492
if (tk -> fd != -1 && !(tk -> flags & TERMKEY_FLAG_NOTERMIOS )) {
490
493
struct termios termios ;
491
494
if (tcgetattr (tk -> fd , & termios ) == 0 ) {
@@ -520,6 +523,7 @@ int termkey_start(TermKey *tk)
520
523
tcsetattr (tk -> fd , TCSANOW , & termios );
521
524
}
522
525
}
526
+ #endif
523
527
524
528
struct TermKeyDriverNode * p ;
525
529
for (p = tk -> drivers ; p ; p = p -> next )
@@ -545,8 +549,10 @@ int termkey_stop(TermKey *tk)
545
549
if (p -> driver -> stop_driver )
546
550
(* p -> driver -> stop_driver )(tk , p -> info );
547
551
552
+ #ifdef HAVE_TERMIOS
548
553
if (tk -> restore_termios_valid )
549
554
tcsetattr (tk -> fd , TCSANOW , & tk -> restore_termios );
555
+ #endif
550
556
551
557
tk -> is_started = 0 ;
552
558
You can’t perform that action at this time.
0 commit comments