summaryrefslogtreecommitdiff
path: root/inputmethod/skkfep/patches/patch-be
blob: 75f1ae48e85bde7c97693552415b31b474f4edb6 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
$NetBSD: patch-be,v 1.2 2012/12/20 21:50:47 joerg Exp $

--- readwrite.c.orig	1998-07-06 15:31:15.000000000 +0000
+++ readwrite.c
@@ -4,10 +4,21 @@
 #include "kanjicode.h"
 #include "ctrlcode.h"
 
+#ifndef STDIN_FILENO
+#define STDIN_FILENO	0
+#endif
+
+#ifndef STDOUT_FILENO
+#define STDOUT_FILENO	1
+#endif
+
 #ifdef DEBUG
 extern FILE *wrlog;
 #endif
 
+static void convCode(unsigned char c1, unsigned char c2, unsigned char *obuf,
+    kanjicode ic, kanjicode oc);
+
 kanjicode OutCode = NATIVECODE, WriteCode = NATIVECODE;
 
 typedef struct KanjiStatus {
@@ -29,22 +40,16 @@ struct code_mode codeMode[8] = {
 	SIC_B,SOC_B,"JIS",3,3,
 };
 
-extern int	tty;
-
 char read1()
 {	char	c;
 
-	if (read(tty,&c,1) != 0)
+	if (read(STDIN_FILENO,&c,1) != 0)
 		return c;
 	return EOF;
 }
 
-checkStatusAndConvCode(c,ic,oc,stat,ostat,optr,olen)
-char c;
-kanjicode ic,oc;
-KanjiStatus stat,ostat;
-char **optr;
-int *olen;
+static void checkStatusAndConvCode(char c, kanjicode ic, kanjicode oc,
+    KanjiStatus stat, KanjiStatus ostat, char **optr, int *olen)
 {
 	static char buf[6];
 
@@ -201,10 +206,8 @@ int *olen;
 	}
 }
 
-syncStatus(ttyno,ic,oc,istatus,ostatus)
-int ttyno;
-kanjicode ic,oc;
-KanjiStatus istatus,ostatus;
+static void syncStatus(int ttyno, kanjicode ic, kanjicode oc,
+    KanjiStatus istatus, KanjiStatus ostatus)
 {
 	if (!isJIS(oc) || istatus->kanjiMode == ostatus->kanjiMode)
 			return;
@@ -320,13 +323,13 @@ writes(s)
 char    *s;
 {       int    l = strlen(s);
 	
-	writeTTYorg(tty,s,l,INTERNALCODE,OutCode,&TInter_Stat,&To_TTY_Stat);
+	writeTTYorg(STDOUT_FILENO,s,l,INTERNALCODE,OutCode,&TInter_Stat,&To_TTY_Stat);
 }
 
 write1(c)
 char c;
 {
-	writeTTYorg(tty,&c,1,INTERNALCODE,OutCode,&TInter_Stat,&To_TTY_Stat);
+	writeTTYorg(STDOUT_FILENO,&c,1,INTERNALCODE,OutCode,&TInter_Stat,&To_TTY_Stat);
 }
 
 writeShTty(s,l)
@@ -334,14 +337,14 @@ char	*s;
 int	l;
 {
 
-	writeTTYorg(tty,s,l,WriteCode,OutCode,&From_SH_Stat,&To_TTY_Stat);
+	writeTTYorg(STDOUT_FILENO,s,l,WriteCode,OutCode,&From_SH_Stat,&To_TTY_Stat);
 }
 
 writeTty(s,l)
 char	*s;
 int	l;
 {
-	writeTTYorg(tty,s,l,INTERNALCODE,OutCode,&TInter_Stat,&To_TTY_Stat);
+	writeTTYorg(STDOUT_FILENO,s,l,INTERNALCODE,OutCode,&TInter_Stat,&To_TTY_Stat);
 }
 
 
@@ -376,10 +379,8 @@ bell()
 	write1('\007');
 }
 
-convCode(c1,c2,obuf,ic,oc)
-unsigned char c1,c2;
-unsigned char *obuf;
-kanjicode ic,oc;
+static void convCode(unsigned char c1, unsigned char c2, unsigned char *obuf,
+    kanjicode ic, kanjicode oc)
 {
 	if (ic == oc || (isJIS(ic) && isJIS(oc)) ) {
 		obuf[0] = c1;