summaryrefslogtreecommitdiff
path: root/inputmethod/canna/patches/patch-canuum_termio.c
blob: ada72ce65c38f4dafc3d55f85616e5014edff809 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
$NetBSD: patch-canuum_termio.c,v 1.1 2015/10/18 03:58:31 tsutsui Exp $

- Appease prototype warnings.
- Reorganize curses ops.

--- canuum/termio.c.orig	2003-12-27 17:15:21.000000000 +0000
+++ canuum/termio.c
@@ -36,6 +36,11 @@
 #include <stdio.h>
 #if STDC_HEADERS
 #  include <stdlib.h>
+#  include <string.h>
+#else
+#  if HAVE_STRINGS_H
+#    include <strings.h>
+#  endif
 #endif /* STDC_HEADERS */
 
 #include "commonhd.h"
@@ -51,15 +56,15 @@
 extern int putchar ();
 
 extern char Term_Name[];
-extern char *Term_UnderScoreStart;
-extern char *Term_UnderScoreEnd;
-extern char *Term_ClrScreen;
-extern char *Term_ClrEofLine;
-extern char *Term_ThrowCursor;
-extern char *Term_StandOutStart;
-extern char *Term_StandOutEnd;
-extern char *Term_BoldOutStart;
-extern char *Term_BoldOutEnd;
+extern const char *Term_UnderScoreStart;
+extern const char *Term_UnderScoreEnd;
+extern const char *Term_ClrScreen;
+extern const char *Term_ClrEofLine;
+extern const char *Term_ThrowCursor;
+extern const char *Term_StandOutStart;
+extern const char *Term_StandOutEnd;
+extern const char *Term_BoldOutStart;
+extern const char *Term_BoldOutEnd;
 static int bold_mode_fun = 0;
 
 int
@@ -73,7 +78,7 @@ openTermData ()
   char errprefix[1024] = "error";
 
   /* for convert_key --- added by Nide 10/3 */
-  if (NULL == (cp = get_kbd_env ()) || 0 != convert_getterm (cp, (0 != verbose_option)))
+  if (NULL == initscr() || NULL == (cp = get_kbd_env ()) || 0 != convert_getterm (cp, (0 != verbose_option)))
     {
       fprintf (stderr, "Cannot get keyboard information.\n");
       return (-1);
@@ -96,13 +101,8 @@ openTermData ()
       return (-1);
     }
 #endif /* CANNA */
-  setupterm (0, 1, &status);
-  /* This seems needless and causes hangs on Solaris8 + ncurses */
-  /* reset_shell_mode (); */
-  if (status != 1)
-    {
-      return (-1);
-    }
+  reset_shell_mode();
+
 #if defined(uniosu)
   if (jterm < 2)
     {                           /* kanji terminal */
@@ -110,7 +110,7 @@ openTermData ()
       return (-1);
     }
 #endif /* defined(uniosu) */
-  if (save_cursor == (char *) NULL || *save_cursor == NULL || restore_cursor == (char *) NULL || *restore_cursor == NULL || change_scroll_region == (char *) NULL || *change_scroll_region == NULL)
+  if (save_cursor == (char *) NULL || *save_cursor == 0 || restore_cursor == (char *) NULL || *restore_cursor == 0 || change_scroll_region == (char *) NULL || *change_scroll_region == 0)
     {
       fprintf (stderr, "Your terminal is not strong enough. Goodbye !\n");
       return (-1);
@@ -175,7 +175,6 @@ openTermData ()
 void
 closeTermData ()
 {
-  resetterm ();
   reset_shell_mode ();
 }