aboutsummaryrefslogtreecommitdiffstats
path: root/shells/pash/files/patch-ae
blob: af0e10071988b40fcfabf72bfe52058ea9b65f5b (plain) (blame)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
--- keyboard.c.orig	Sun Jan 12 18:11:44 1997
+++ keyboard.c		Sat Dec 30 03:06:17 2000
@@ -26,7 +26,7 @@
 #define _TEXT_TAIL_ ':'
 
 /* Memorisation de l'etat de depart du terminal */
-struct termio _InitialState_;
+struct termios _InitialState_;
 int _fcntl_flags_;
 
 jmp_buf _uk_buf_, /* Reveil de lecture des touches speciales */
@@ -104,7 +104,7 @@
     case SIGBUS:  printf("SIGBUS");  break;
     case SIGSEGV: printf("SIGSEGV"); break;
     case SIGPIPE: printf("SIGPIPE"); break;
-    case SIGCLD:  printf("SIGCLD");  break;
+    case SIGCHLD:  printf("SIGCHLD");  break;
    }
   if(_InFree_) printf(" (%d) received on a free() system call. Exiting.\n",Num);
   else         printf(" (%d) received. Exiting.\n",Num);
@@ -229,7 +229,7 @@
 void GetKey(char *Buf)
  {
   int i;
-  struct termio Avant,Apres;
+  struct termios Avant,Apres;
 #ifdef SIGACT  
   struct sigaction IntNew,IntOld,
   		   TermNew,TermOld,
@@ -259,21 +259,21 @@
   QuitFct = signal(SIGQUIT,_terminate_);
 #endif
   
-  ioctl(0,TCGETA,&Avant);
+  tcgetattr(0, &Avant);
 
-  memcpy(&Apres,&Avant,sizeof(struct termio));
-  Apres.c_iflag &= ~(INLCR | ICRNL | IUCLC | ISTRIP | BRKINT | IXON);
+  memcpy(&Apres,&Avant,sizeof(struct termios));
+  Apres.c_iflag &= ~(INLCR | ICRNL | ISTRIP | BRKINT | IXON);
   Apres.c_oflag &= ~OPOST;
   Apres.c_lflag &= ~ICANON;
   Apres.c_cc[VMIN] = MAX_KEY;
   Apres.c_cc[VTIME] = 1;
-  ioctl(0,TCSETA,&Apres);
+  tcsetattr(0, TCSANOW, &Apres);
 
   for(i=0;i<MAX_KEY;i++) Buf[i] = 0;
 
   while((read(0,Buf,MAX_KEY) == -1) && (errno == EINTR));
 
-  ioctl(0,TCSETA,&Avant);
+  tcsetattr(0, TCSANOW, &Avant);
 
 #ifdef SIGACT
   sigaction(SIGINT,&IntOld,&IntNew);
@@ -388,7 +388,7 @@
   char Temp[MAX_KEY];
   int i,offset,rc,Code = -1,Fini = 0,CodeRead;
   unsigned int Remains;
-  struct termio Avant,Apres;
+  struct termios Avant,Apres;
 #ifdef SIGACT
   struct sigaction IntNew,IntOld,
   		   TermNew,TermOld,
@@ -418,14 +418,13 @@
   QuitFct = signal(SIGQUIT,_terminate_);
 #endif
 
-  ioctl(0,TCGETA,&Avant);
+  tcgetattr(0, &Avant);
 
   for(i=0;i<MAX_KEY;i++) Temp[i] = 0;
 
-  memcpy(&Apres,&Avant,sizeof(struct termio));
+  memcpy(&Apres,&Avant,sizeof(struct termios));
   Apres.c_iflag &= ~(INLCR |   /* Pas de conversion LF -> CR */
 		     ICRNL |   /* Pas de conversion CR -> LF */
-		     IUCLC |   /* Pas de conversion Maj -> Min */
 		     ISTRIP |  /* Pas de conversion 8 bits -> 7 bits */
 		     BRKINT |  /* Pas de caractere de controle */
 		     IXON);    /* Pas de controle de flux par Ctrl-S */
@@ -435,7 +434,7 @@
   Apres.c_cc[VSTOP] = 0;       /* Pour empecher Ctrl-S d'envoyer un Stop */
   Apres.c_cc[VSTART] = 0;      /* Si Ctrl-S est deconnecte, Ctrl-Q ne */
 			       /* sert plus a rien: on le vire        */
-  ioctl(0,TCSETA,&Apres);
+  tcsetattr(0, TCSANOW, &Apres);
 
   SetNonBlock();
 
@@ -477,7 +476,7 @@
    }
 
   SetBlock();
-  ioctl(0,TCSETA,&Avant);
+  tcsetattr(0, TCSANOW, &Avant);
 
 #ifdef SIGACT
   sigaction(SIGINT,&IntOld,&IntNew);
@@ -512,7 +511,7 @@
   char Temp[MAX_KEY];
   int i,offset,rc,Code = -1,Fini = 0,CodeRead;
   unsigned int Remains;
-  struct termio Avant,Apres;
+  struct termios Avant,Apres;
 #ifdef SIGACT
   struct sigaction IntNew,IntOld,
   		   TermNew,TermOld,
@@ -547,14 +546,13 @@
     QuitFct = signal(SIGQUIT,_terminate_);
 #endif
 
-    ioctl(0,TCGETA,&Avant);
+    tcgetattr(0, &Avant);
 
     for(i=0;i<MAX_KEY;i++) Temp[i] = 0;
 
-    memcpy(&Apres,&Avant,sizeof(struct termio));
+    memcpy(&Apres,&Avant,sizeof(struct termios));
     Apres.c_iflag &= ~(INLCR |   /* Pas de conversion LF -> CR */
 		       ICRNL |   /* Pas de conversion CR -> LF */
-		       IUCLC |   /* Pas de conversion Maj -> Min */
 		       ISTRIP |  /* Pas de conversion 8 bits -> 7 bits */
 		       BRKINT |  /* Pas de caractere de controle */
 		       IXON);    /* Pas de controle de flux par Ctrl-S */
@@ -564,7 +562,7 @@
     Apres.c_cc[VSTOP] = 0;       /* Pour empecher Ctrl-S d'envoyer un Stop */
     Apres.c_cc[VSTART] = 0;      /* Si Ctrl-S est deconnecte, Ctrl-Q ne */
 				 /* sert plus a rien: on le vire        */
-    ioctl(0,TCSETA,&Apres);
+    tcsetattr(0, TCSANOW, &Apres);
 
     while((read(0,Temp,1) == -1) && (errno == EINTR));
 
@@ -596,7 +594,7 @@
       SetBlock();
      }
 
-    ioctl(0,TCSETA,&Avant);
+    tcsetattr(0, TCSANOW, &Avant);
     
 #ifdef SIGACT    
     sigaction(SIGINT,&IntOld,&IntNew);
@@ -619,7 +617,7 @@
   char Temp[MAX_KEY];
   int i,offset,rc,Code = -1,Fini = 0,CodeRead;
   unsigned int Remains;
-  struct termio Avant,Apres;
+  struct termios Avant,Apres;
 #ifdef SIGACT
   struct sigaction IntNew,IntOld,
   		   TermNew,TermOld,
@@ -656,14 +654,13 @@
     QuitFct = signal(SIGQUIT,_terminate_);
 #endif
 
-    ioctl(0,TCGETA,&Avant);
+    tcgetattr(0, &Avant);
 
     for(i=0;i<MAX_KEY;i++) Temp[i] = 0;
 
-    memcpy(&Apres,&Avant,sizeof(struct termio));
+    memcpy(&Apres,&Avant,sizeof(struct termios));
     Apres.c_iflag &= ~(INLCR |   /* Pas de conversion LF -> CR */
 		       ICRNL |   /* Pas de conversion CR -> LF */
-		       IUCLC |   /* Pas de conversion Maj -> Min */
 		       ISTRIP |  /* Pas de conversion 8 bits -> 7 bits */
 		       BRKINT |  /* Pas de caractere de controle */
 		       IXON);    /* Pas de controle de flux par Ctrl-S */
@@ -673,7 +670,7 @@
     Apres.c_cc[VSTOP] = 0;       /* Pour empecher Ctrl-S d'envoyer un Stop */
     Apres.c_cc[VSTART] = 0;      /* Si Ctrl-S est deconnecte, Ctrl-Q ne */
 				 /* sert plus a rien: on le vire        */
-    ioctl(0,TCSETA,&Apres);
+    tcsetattr(0, TCSANOW, &Apres);
 
     while((read(0,Temp,1) == -1) && (errno == EINTR));
 
@@ -738,7 +735,7 @@
        }
      }
 
-    ioctl(0,TCSETA,&Avant);
+    tcsetattr(0, TCSANOW, &Avant);
     
 #ifdef SIGACT    
     sigaction(SIGINT,&IntOld,&IntNew);
@@ -767,7 +764,7 @@
 int Getch(void)
  {
   char Temp;
-  struct termio Avant,Apres;
+  struct termios Avant,Apres;
 #ifdef SIGACT
   struct sigaction IntNew,IntOld,
   		   TermNew,TermOld,
@@ -797,19 +794,19 @@
   QuitFct = signal(SIGQUIT,_terminate_);
 #endif
   
-  ioctl(0,TCGETA,&Avant);
-  memcpy(&Apres,&Avant,sizeof(struct termio));
-  Apres.c_iflag &= ~(INLCR | ICRNL | IUCLC | ISTRIP | IXON | BRKINT);
+  tcgetattr(0, &Avant);
+  memcpy(&Apres,&Avant,sizeof(struct termios));
+  Apres.c_iflag &= ~(INLCR | ICRNL | ISTRIP | IXON | BRKINT);
   Apres.c_oflag &= ~OPOST;
   Apres.c_lflag &= ~ICANON;
   Apres.c_cc[VMIN] = 1;
   Apres.c_cc[VSTOP] = 0;
   Apres.c_cc[VSTART] = 0;
-  ioctl(0,TCSETA,&Apres);
+  tcsetattr(0, TCSANOW, &Apres);
 
   while((read(0,&Temp,1) == -1) && (errno == EINTR));
 
-  ioctl(0,TCSETA,&Avant);
+  tcsetattr(0, TCSANOW, &Avant);
 
 #ifdef SIGACT
   sigaction(SIGINT,&IntOld,&IntNew);
@@ -1021,7 +1018,7 @@
   SetKeyboard();
   printf("Please press the <Enter> key to begin...");
   fflush(stdout);
-  gets(D);
+  fgets(D, sizeof(D), stdin);
 
   printf("\n\n");
 
@@ -1058,7 +1055,7 @@
   printf(" and restart the program.\n\n");
   printf("[Press Enter to go on...]");
   fflush(stdout);
-  gets(D);
+  fgets(D, sizeof(D), stdin);
  }
 
 /*****************************************************************************
@@ -1073,14 +1070,14 @@
 
 void SetKeyboard(void)
  {
-  struct termio Tmp;
+  struct termios Tmp;
 
   /* Retablir les valeurs de depart */
   RestoreKeyboard();
-  memcpy(&Tmp,&_InitialState_,sizeof(struct termio));
+  memcpy(&Tmp,&_InitialState_,sizeof(struct termios));
   /* Modifier ce qu'il faut */
   Tmp.c_lflag &= ~(ISIG | ECHO);
-  ioctl(0,TCSETA,&Tmp);
+  tcsetattr(0, TCSANOW, &Tmp);
  }
 
 /*****************************************************************************
@@ -1092,7 +1089,7 @@
 void RestoreKeyboard(void)
  {
   fcntl(0,F_SETFL,_fcntl_flags_);
-  ioctl(0,TCSETA,&_InitialState_);
+  tcsetattr(0, TCSANOW, &_InitialState_);
  }
 
 /*****************************************************************************
@@ -1128,7 +1125,7 @@
   sigaction(SIGHUP,&New,&Old);
   sigaction(SIGUSR1,&New,&Old);
   sigaction(SIGUSR2,&New,&Old);
-  sigaction(SIGCLD,&New,&Old);
+  sigaction(SIGCHLD,&New,&Old);
   sigemptyset(&New.sa_mask);
   sigaction(SIGALRM,&New,&Old);
 
@@ -1415,7 +1412,7 @@
    { fprintf(stderr,"Unable to get the terminal configuration through fcntl.\n");
      exit(1); }
   fprintf(stderr,"Getting terminal configuration through ioctl().\n");
-  ioctl(0,TCGETA,&_InitialState_);
+  tcgetattr(0, &_InitialState_);
 
   fprintf(stderr,"Setting terminal state.\n");
   SetKeyboard();