~ubuntu-branches/ubuntu/vivid/openipmi/vivid

« back to all changes in this revision

Viewing changes to libedit/orig_editline.diff2

  • Committer: Bazaar Package Importer
  • Author(s): Noèl Köthe
  • Date: 2006-09-15 17:56:24 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20060915175624-ljk0mg3xtcm65tvm
Tags: 2.0.7-1
* new upstream release from 2006-06-08
  Thanks to John Wright <john.wright hp.com> for initial work
  (closes: Bug#380149)
* updated Standards Version
* new binaries openipmicmd, openipmish, rmcp_ping

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
? common.h
 
2
? emacs.h
 
3
? fcns.c
 
4
? fcns.h
 
5
? help.c
 
6
? help.h
 
7
? orig_editline.diff2
 
8
? vi.h
 
9
Index: read.c
 
10
===================================================================
 
11
RCS file: /cvsroot/openipmi/OpenIPMI/libedit/read.c,v
 
12
retrieving revision 1.1
 
13
diff -u -r1.1 read.c
 
14
--- read.c      10 Feb 2006 16:38:52 -0000      1.1
 
15
+++ read.c      28 Feb 2006 15:38:28 -0000
 
16
@@ -1,612 +0,0 @@
 
17
-/*     $NetBSD: read.c,v 1.39 2005/08/02 12:11:14 christos Exp $       */
 
18
-
 
19
-/*-
 
20
- * Copyright (c) 1992, 1993
 
21
- *     The Regents of the University of California.  All rights reserved.
 
22
- *
 
23
- * This code is derived from software contributed to Berkeley by
 
24
- * Christos Zoulas of Cornell University.
 
25
- *
 
26
- * Redistribution and use in source and binary forms, with or without
 
27
- * modification, are permitted provided that the following conditions
 
28
- * are met:
 
29
- * 1. Redistributions of source code must retain the above copyright
 
30
- *    notice, this list of conditions and the following disclaimer.
 
31
- * 2. Redistributions in binary form must reproduce the above copyright
 
32
- *    notice, this list of conditions and the following disclaimer in the
 
33
- *    documentation and/or other materials provided with the distribution.
 
34
- * 3. Neither the name of the University nor the names of its contributors
 
35
- *    may be used to endorse or promote products derived from this software
 
36
- *    without specific prior written permission.
 
37
- *
 
38
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 
39
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
40
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
41
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 
42
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
43
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 
44
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 
45
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
46
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 
47
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
48
- * SUCH DAMAGE.
 
49
- */
 
50
-
 
51
-#include "sys.h"
 
52
-#if !defined(lint) && !defined(SCCSID)
 
53
-#if 0
 
54
-static char sccsid[] = "@(#)read.c     8.1 (Berkeley) 6/4/93";
 
55
-#else
 
56
-__RCSID("$NetBSD: read.c,v 1.39 2005/08/02 12:11:14 christos Exp $");
 
57
-#endif
 
58
-#endif /* not lint && not SCCSID */
 
59
-
 
60
-/*
 
61
- * read.c: Clean this junk up! This is horrible code.
 
62
- *        Terminal read functions
 
63
- */
 
64
-#include <errno.h>
 
65
-#include <fcntl.h>
 
66
-#include <unistd.h>
 
67
-#include <stdlib.h>
 
68
-#include "el.h"
 
69
-
 
70
-#define        OKCMD   -1
 
71
-
 
72
-private int    read__fixio(int, int);
 
73
-private int    read_preread(EditLine *);
 
74
-private int    read_char(EditLine *, char *);
 
75
-private int    read_getcmd(EditLine *, el_action_t *, char *);
 
76
-
 
77
-/* read_init():
 
78
- *     Initialize the read stuff
 
79
- */
 
80
-protected int
 
81
-read_init(EditLine *el)
 
82
-{
 
83
-       /* builtin read_char */
 
84
-       el->el_read.read_char = read_char;
 
85
-       return 0;
 
86
-}
 
87
-
 
88
-
 
89
-/* el_read_setfn():
 
90
- *     Set the read char function to the one provided.
 
91
- *     If it is set to EL_BUILTIN_GETCFN, then reset to the builtin one.
 
92
- */
 
93
-protected int
 
94
-el_read_setfn(EditLine *el, el_rfunc_t rc)
 
95
-{
 
96
-       el->el_read.read_char = (rc == EL_BUILTIN_GETCFN) ? read_char : rc;
 
97
-       return 0;
 
98
-}
 
99
-
 
100
-
 
101
-/* el_read_getfn():
 
102
- *     return the current read char function, or EL_BUILTIN_GETCFN
 
103
- *     if it is the default one
 
104
- */
 
105
-protected el_rfunc_t
 
106
-el_read_getfn(EditLine *el)
 
107
-{
 
108
-       return (el->el_read.read_char == read_char) ?
 
109
-           EL_BUILTIN_GETCFN : el->el_read.read_char;
 
110
-}
 
111
-
 
112
-
 
113
-#ifndef MIN
 
114
-#define MIN(A,B) ((A) < (B) ? (A) : (B))
 
115
-#endif
 
116
-
 
117
-#ifdef DEBUG_EDIT
 
118
-private void
 
119
-read_debug(EditLine *el)
 
120
-{
 
121
-
 
122
-       if (el->el_line.cursor > el->el_line.lastchar)
 
123
-               (void) fprintf(el->el_errfile, "cursor > lastchar\r\n");
 
124
-       if (el->el_line.cursor < el->el_line.buffer)
 
125
-               (void) fprintf(el->el_errfile, "cursor < buffer\r\n");
 
126
-       if (el->el_line.cursor > el->el_line.limit)
 
127
-               (void) fprintf(el->el_errfile, "cursor > limit\r\n");
 
128
-       if (el->el_line.lastchar > el->el_line.limit)
 
129
-               (void) fprintf(el->el_errfile, "lastchar > limit\r\n");
 
130
-       if (el->el_line.limit != &el->el_line.buffer[EL_BUFSIZ - 2])
 
131
-               (void) fprintf(el->el_errfile, "limit != &buffer[EL_BUFSIZ-2]\r\n");
 
132
-}
 
133
-#endif /* DEBUG_EDIT */
 
134
-
 
135
-
 
136
-/* read__fixio():
 
137
- *     Try to recover from a read error
 
138
- */
 
139
-/* ARGSUSED */
 
140
-private int
 
141
-read__fixio(int fd __attribute__((__unused__)), int e)
 
142
-{
 
143
-
 
144
-       switch (e) {
 
145
-       case -1:                /* Make sure that the code is reachable */
 
146
-
 
147
-#ifdef EWOULDBLOCK
 
148
-       case EWOULDBLOCK:
 
149
-#ifndef TRY_AGAIN
 
150
-#define        TRY_AGAIN
 
151
-#endif
 
152
-#endif /* EWOULDBLOCK */
 
153
-
 
154
-#if defined(POSIX) && defined(EAGAIN)
 
155
-#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
 
156
-       case EAGAIN:
 
157
-#ifndef TRY_AGAIN
 
158
-#define        TRY_AGAIN
 
159
-#endif
 
160
-#endif /* EWOULDBLOCK && EWOULDBLOCK != EAGAIN */
 
161
-#endif /* POSIX && EAGAIN */
 
162
-
 
163
-               e = 0;
 
164
-#ifdef TRY_AGAIN
 
165
-#if defined(F_SETFL) && defined(O_NDELAY)
 
166
-               if ((e = fcntl(fd, F_GETFL, 0)) == -1)
 
167
-                       return (-1);
 
168
-
 
169
-               if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1)
 
170
-                       return (-1);
 
171
-               else
 
172
-                       e = 1;
 
173
-#endif /* F_SETFL && O_NDELAY */
 
174
-
 
175
-#ifdef FIONBIO
 
176
-               {
 
177
-                       int zero = 0;
 
178
-
 
179
-                       if (ioctl(fd, FIONBIO, (ioctl_t) & zero) == -1)
 
180
-                               return (-1);
 
181
-                       else
 
182
-                               e = 1;
 
183
-               }
 
184
-#endif /* FIONBIO */
 
185
-
 
186
-#endif /* TRY_AGAIN */
 
187
-               return (e ? 0 : -1);
 
188
-
 
189
-       case EINTR:
 
190
-               return (0);
 
191
-
 
192
-       default:
 
193
-               return (-1);
 
194
-       }
 
195
-}
 
196
-
 
197
-
 
198
-/* read_preread():
 
199
- *     Try to read the stuff in the input queue;
 
200
- */
 
201
-private int
 
202
-read_preread(EditLine *el)
 
203
-{
 
204
-       int chrs = 0;
 
205
-
 
206
-       if (el->el_tty.t_mode == ED_IO)
 
207
-               return (0);
 
208
-
 
209
-#ifdef FIONREAD
 
210
-       (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
 
211
-       if (chrs > 0) {
 
212
-               char buf[EL_BUFSIZ];
 
213
-
 
214
-               chrs = read(el->el_infd, buf,
 
215
-                   (size_t) MIN(chrs, EL_BUFSIZ - 1));
 
216
-               if (chrs > 0) {
 
217
-                       buf[chrs] = '\0';
 
218
-                       el_push(el, buf);
 
219
-               }
 
220
-       }
 
221
-#endif /* FIONREAD */
 
222
-
 
223
-       return (chrs > 0);
 
224
-}
 
225
-
 
226
-
 
227
-/* el_push():
 
228
- *     Push a macro
 
229
- */
 
230
-public void
 
231
-el_push(EditLine *el, char *str)
 
232
-{
 
233
-       c_macro_t *ma = &el->el_chared.c_macro;
 
234
-
 
235
-       if (str != NULL && ma->level + 1 < EL_MAXMACRO) {
 
236
-               ma->level++;
 
237
-               if ((ma->macro[ma->level] = el_strdup(str)) != NULL)
 
238
-                       return;
 
239
-               ma->level--;
 
240
-       }
 
241
-       term_beep(el);
 
242
-       term__flush();
 
243
-}
 
244
-
 
245
-
 
246
-/* read_getcmd():
 
247
- *     Return next command from the input stream.
 
248
- */
 
249
-private int
 
250
-read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch)
 
251
-{
 
252
-       el_action_t cmd;
 
253
-       int num;
 
254
-
 
255
-       do {
 
256
-               if ((num = el_getc(el, ch)) != 1)       /* if EOF or error */
 
257
-                       return (num);
 
258
-
 
259
-#ifdef KANJI
 
260
-               if ((*ch & 0200)) {
 
261
-                       el->el_state.metanext = 0;
 
262
-                       cmd = CcViMap[' '];
 
263
-                       break;
 
264
-               } else
 
265
-#endif /* KANJI */
 
266
-
 
267
-               if (el->el_state.metanext) {
 
268
-                       el->el_state.metanext = 0;
 
269
-                       *ch |= 0200;
 
270
-               }
 
271
-               cmd = el->el_map.current[(unsigned char) *ch];
 
272
-               if (cmd == ED_SEQUENCE_LEAD_IN) {
 
273
-                       key_value_t val;
 
274
-                       switch (key_get(el, ch, &val)) {
 
275
-                       case XK_CMD:
 
276
-                               cmd = val.cmd;
 
277
-                               break;
 
278
-                       case XK_STR:
 
279
-                               el_push(el, val.str);
 
280
-                               break;
 
281
-#ifdef notyet
 
282
-                       case XK_EXE:
 
283
-                               /* XXX: In the future to run a user function */
 
284
-                               RunCommand(val.str);
 
285
-                               break;
 
286
-#endif
 
287
-                       default:
 
288
-                               EL_ABORT((el->el_errfile, "Bad XK_ type \n"));
 
289
-                               break;
 
290
-                       }
 
291
-               }
 
292
-               if (el->el_map.alt == NULL)
 
293
-                       el->el_map.current = el->el_map.key;
 
294
-       } while (cmd == ED_SEQUENCE_LEAD_IN);
 
295
-       *cmdnum = cmd;
 
296
-       return (OKCMD);
 
297
-}
 
298
-
 
299
-
 
300
-/* read_char():
 
301
- *     Read a character from the tty.
 
302
- */
 
303
-private int
 
304
-read_char(EditLine *el, char *cp)
 
305
-{
 
306
-       int num_read;
 
307
-       int tried = 0;
 
308
-
 
309
-       while ((num_read = read(el->el_infd, cp, 1)) == -1)
 
310
-               if (!tried && read__fixio(el->el_infd, errno) == 0)
 
311
-                       tried = 1;
 
312
-               else {
 
313
-                       *cp = '\0';
 
314
-                       return (-1);
 
315
-               }
 
316
-
 
317
-       return (num_read);
 
318
-}
 
319
-
 
320
-
 
321
-/* el_getc():
 
322
- *     Read a character
 
323
- */
 
324
-public int
 
325
-el_getc(EditLine *el, char *cp)
 
326
-{
 
327
-       int num_read;
 
328
-       c_macro_t *ma = &el->el_chared.c_macro;
 
329
-
 
330
-       term__flush();
 
331
-       for (;;) {
 
332
-               if (ma->level < 0) {
 
333
-                       if (!read_preread(el))
 
334
-                               break;
 
335
-               }
 
336
-               if (ma->level < 0)
 
337
-                       break;
 
338
-
 
339
-               if (ma->macro[ma->level][ma->offset] == '\0') {
 
340
-                       el_free(ma->macro[ma->level--]);
 
341
-                       ma->offset = 0;
 
342
-                       continue;
 
343
-               }
 
344
-               *cp = ma->macro[ma->level][ma->offset++] & 0377;
 
345
-               if (ma->macro[ma->level][ma->offset] == '\0') {
 
346
-                       /* Needed for QuoteMode On */
 
347
-                       el_free(ma->macro[ma->level--]);
 
348
-                       ma->offset = 0;
 
349
-               }
 
350
-               return (1);
 
351
-       }
 
352
-
 
353
-#ifdef DEBUG_READ
 
354
-       (void) fprintf(el->el_errfile, "Turning raw mode on\n");
 
355
-#endif /* DEBUG_READ */
 
356
-       if (tty_rawmode(el) < 0)/* make sure the tty is set up correctly */
 
357
-               return (0);
 
358
-
 
359
-#ifdef DEBUG_READ
 
360
-       (void) fprintf(el->el_errfile, "Reading a character\n");
 
361
-#endif /* DEBUG_READ */
 
362
-       num_read = (*el->el_read.read_char)(el, cp);
 
363
-#ifdef DEBUG_READ
 
364
-       (void) fprintf(el->el_errfile, "Got it %c\n", *cp);
 
365
-#endif /* DEBUG_READ */
 
366
-       return (num_read);
 
367
-}
 
368
-
 
369
-protected void
 
370
-read_prepare(EditLine *el)
 
371
-{
 
372
-       if (el->el_flags & HANDLE_SIGNALS)
 
373
-               sig_set(el);
 
374
-       if (el->el_flags & NO_TTY)
 
375
-               return;
 
376
-       if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED)
 
377
-               tty_rawmode(el);
 
378
-
 
379
-       /* This is relatively cheap, and things go terribly wrong if
 
380
-          we have the wrong size. */
 
381
-       el_resize(el);
 
382
-       re_clear_display(el);   /* reset the display stuff */
 
383
-       ch_reset(el, 0);
 
384
-       re_refresh(el);         /* print the prompt */
 
385
-
 
386
-       if (el->el_flags & UNBUFFERED)
 
387
-               term__flush();
 
388
-}
 
389
-
 
390
-protected void
 
391
-read_finish(EditLine *el)
 
392
-{
 
393
-       if ((el->el_flags & UNBUFFERED) == 0)
 
394
-               (void) tty_cookedmode(el);
 
395
-       if (el->el_flags & HANDLE_SIGNALS)
 
396
-               sig_clr(el);
 
397
-}
 
398
-
 
399
-public const char *
 
400
-el_gets(EditLine *el, int *nread)
 
401
-{
 
402
-       int retval;
 
403
-       el_action_t cmdnum = 0;
 
404
-       int num;                /* how many chars we have read at NL */
 
405
-       char ch;
 
406
-       int crlf = 0;
 
407
-#ifdef FIONREAD
 
408
-       c_macro_t *ma = &el->el_chared.c_macro;
 
409
-#endif /* FIONREAD */
 
410
-
 
411
-       if (el->el_flags & NO_TTY) {
 
412
-               char *cp = el->el_line.buffer;
 
413
-               size_t idx;
 
414
-
 
415
-               while ((*el->el_read.read_char)(el, cp) == 1) {
 
416
-                       /* make sure there is space for next character */
 
417
-                       if (cp + 1 >= el->el_line.limit) {
 
418
-                               idx = (cp - el->el_line.buffer);
 
419
-                               if (!ch_enlargebufs(el, 2))
 
420
-                                       break;
 
421
-                               cp = &el->el_line.buffer[idx];
 
422
-                       }
 
423
-                       cp++;
 
424
-                       if (el->el_flags & UNBUFFERED)
 
425
-                               break;
 
426
-                       if (cp[-1] == '\r' || cp[-1] == '\n')
 
427
-                               break;
 
428
-               }
 
429
-
 
430
-               el->el_line.cursor = el->el_line.lastchar = cp;
 
431
-               *cp = '\0';
 
432
-               if (nread)
 
433
-                       *nread = el->el_line.cursor - el->el_line.buffer;
 
434
-               return (el->el_line.buffer);
 
435
-       }
 
436
-
 
437
-
 
438
-#ifdef FIONREAD
 
439
-       if (el->el_tty.t_mode == EX_IO && ma->level < 0) {
 
440
-               long chrs = 0;
 
441
-
 
442
-               (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
 
443
-               if (chrs == 0) {
 
444
-                       if (tty_rawmode(el) < 0) {
 
445
-                               if (nread)
 
446
-                                       *nread = 0;
 
447
-                               return (NULL);
 
448
-                       }
 
449
-               }
 
450
-       }
 
451
-#endif /* FIONREAD */
 
452
-
 
453
-       if ((el->el_flags & UNBUFFERED) == 0)
 
454
-               read_prepare(el);
 
455
-
 
456
-       if (el->el_flags & EDIT_DISABLED) {
 
457
-               char *cp;
 
458
-               size_t idx;
 
459
-               if ((el->el_flags & UNBUFFERED) == 0)
 
460
-                       cp = el->el_line.buffer;
 
461
-               else
 
462
-                       cp = el->el_line.lastchar;
 
463
-
 
464
-               term__flush();
 
465
-
 
466
-               while ((*el->el_read.read_char)(el, cp) == 1) {
 
467
-                       /* make sure there is space next character */
 
468
-                       if (cp + 1 >= el->el_line.limit) {
 
469
-                               idx = (cp - el->el_line.buffer);
 
470
-                               if (!ch_enlargebufs(el, 2))
 
471
-                                       break;
 
472
-                               cp = &el->el_line.buffer[idx];
 
473
-                       }
 
474
-                       if (*cp == 4)   /* ought to be stty eof */
 
475
-                               break;
 
476
-                       cp++;
 
477
-                       crlf = cp[-1] == '\r' || cp[-1] == '\n';
 
478
-                       if (el->el_flags & UNBUFFERED)
 
479
-                               break;
 
480
-                       if (crlf)
 
481
-                               break;
 
482
-               }
 
483
-
 
484
-               el->el_line.cursor = el->el_line.lastchar = cp;
 
485
-               *cp = '\0';
 
486
-               if (nread)
 
487
-                       *nread = el->el_line.cursor - el->el_line.buffer;
 
488
-               return (el->el_line.buffer);
 
489
-       }
 
490
-
 
491
-       for (num = OKCMD; num == OKCMD;) {      /* while still editing this
 
492
-                                                * line */
 
493
-#ifdef DEBUG_EDIT
 
494
-               read_debug(el);
 
495
-#endif /* DEBUG_EDIT */
 
496
-               /* if EOF or error */
 
497
-               if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) {
 
498
-#ifdef DEBUG_READ
 
499
-                       (void) fprintf(el->el_errfile,
 
500
-                           "Returning from el_gets %d\n", num);
 
501
-#endif /* DEBUG_READ */
 
502
-                       break;
 
503
-               }
 
504
-               if ((unsigned int)cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */
 
505
-#ifdef DEBUG_EDIT
 
506
-                       (void) fprintf(el->el_errfile,
 
507
-                           "ERROR: illegal command from key 0%o\r\n", ch);
 
508
-#endif /* DEBUG_EDIT */
 
509
-                       continue;       /* try again */
 
510
-               }
 
511
-               /* now do the real command */
 
512
-#ifdef DEBUG_READ
 
513
-               {
 
514
-                       el_bindings_t *b;
 
515
-                       for (b = el->el_map.help; b->name; b++)
 
516
-                               if (b->func == cmdnum)
 
517
-                                       break;
 
518
-                       if (b->name)
 
519
-                               (void) fprintf(el->el_errfile,
 
520
-                                   "Executing %s\n", b->name);
 
521
-                       else
 
522
-                               (void) fprintf(el->el_errfile,
 
523
-                                   "Error command = %d\n", cmdnum);
 
524
-               }
 
525
-#endif /* DEBUG_READ */
 
526
-               /* vi redo needs these way down the levels... */
 
527
-               el->el_state.thiscmd = cmdnum;
 
528
-               el->el_state.thisch = ch;
 
529
-               if (el->el_map.type == MAP_VI &&
 
530
-                   el->el_map.current == el->el_map.key &&
 
531
-                   el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) {
 
532
-                       if (cmdnum == VI_DELETE_PREV_CHAR &&
 
533
-                           el->el_chared.c_redo.pos != el->el_chared.c_redo.buf
 
534
-                           && isprint((unsigned char)el->el_chared.c_redo.pos[-1]))
 
535
-                               el->el_chared.c_redo.pos--;
 
536
-                       else
 
537
-                               *el->el_chared.c_redo.pos++ = ch;
 
538
-               }
 
539
-               retval = (*el->el_map.func[cmdnum]) (el, ch);
 
540
-#ifdef DEBUG_READ
 
541
-               (void) fprintf(el->el_errfile,
 
542
-                       "Returned state %d\n", retval );
 
543
-#endif /* DEBUG_READ */
 
544
-
 
545
-               /* save the last command here */
 
546
-               el->el_state.lastcmd = cmdnum;
 
547
-
 
548
-               /* use any return value */
 
549
-               switch (retval) {
 
550
-               case CC_CURSOR:
 
551
-                       re_refresh_cursor(el);
 
552
-                       break;
 
553
-
 
554
-               case CC_REDISPLAY:
 
555
-                       re_clear_lines(el);
 
556
-                       re_clear_display(el);
 
557
-                       /* FALLTHROUGH */
 
558
-
 
559
-               case CC_REFRESH:
 
560
-                       re_refresh(el);
 
561
-                       break;
 
562
-
 
563
-               case CC_REFRESH_BEEP:
 
564
-                       re_refresh(el);
 
565
-                       term_beep(el);
 
566
-                       break;
 
567
-
 
568
-               case CC_NORM:   /* normal char */
 
569
-                       break;
 
570
-
 
571
-               case CC_ARGHACK:        /* Suggested by Rich Salz */
 
572
-                       /* <rsalz@pineapple.bbn.com> */
 
573
-                       continue;       /* keep going... */
 
574
-
 
575
-               case CC_EOF:    /* end of file typed */
 
576
-                       if ((el->el_flags & UNBUFFERED) == 0)
 
577
-                               num = 0;
 
578
-                       else if (num == -1) {
 
579
-                               *el->el_line.lastchar++ = CONTROL('d');
 
580
-                               el->el_line.cursor = el->el_line.lastchar;
 
581
-                               num = 1;
 
582
-                       }
 
583
-                       break;
 
584
-
 
585
-               case CC_NEWLINE:        /* normal end of line */
 
586
-                       num = el->el_line.lastchar - el->el_line.buffer;
 
587
-                       break;
 
588
-
 
589
-               case CC_FATAL:  /* fatal error, reset to known state */
 
590
-#ifdef DEBUG_READ
 
591
-                       (void) fprintf(el->el_errfile,
 
592
-                           "*** editor fatal ERROR ***\r\n\n");
 
593
-#endif /* DEBUG_READ */
 
594
-                       /* put (real) cursor in a known place */
 
595
-                       re_clear_display(el);   /* reset the display stuff */
 
596
-                       ch_reset(el, 1);        /* reset the input pointers */
 
597
-                       re_refresh(el); /* print the prompt again */
 
598
-                       break;
 
599
-
 
600
-               case CC_ERROR:
 
601
-               default:        /* functions we don't know about */
 
602
-#ifdef DEBUG_READ
 
603
-                       (void) fprintf(el->el_errfile,
 
604
-                           "*** editor ERROR ***\r\n\n");
 
605
-#endif /* DEBUG_READ */
 
606
-                       term_beep(el);
 
607
-                       term__flush();
 
608
-                       break;
 
609
-               }
 
610
-               el->el_state.argument = 1;
 
611
-               el->el_state.doingarg = 0;
 
612
-               el->el_chared.c_vcmd.action = NOP;
 
613
-               if (el->el_flags & UNBUFFERED)
 
614
-                       break;
 
615
-       }
 
616
-
 
617
-       term__flush();          /* flush any buffered output */
 
618
-       /* make sure the tty is set up correctly */
 
619
-       if ((el->el_flags & UNBUFFERED) == 0) {
 
620
-               read_finish(el);
 
621
-               if (nread)
 
622
-                       *nread = num;
 
623
-       } else {
 
624
-               if (nread)
 
625
-                       *nread = el->el_line.lastchar - el->el_line.buffer;
 
626
-       }
 
627
-       return (num ? el->el_line.buffer : NULL);
 
628
-}