~ubuntu-branches/debian/squeeze/mysql-5.1/squeeze

« back to all changes in this revision

Viewing changes to cmd-line-utils/libedit/common.c

  • Committer: Package Import Robot
  • Author(s): Moritz Muehlenhoff
  • Date: 2014-01-14 10:40:30 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140114104030-44alii0hx3x3g41y
Tags: 5.1.73-1
* New upstream release
  http://dev.mysql.com/doc/relnotes/mysql/5.1/en/news-5-1-73.html
* Update patches
* Disable flaky test rpl.rpl_innodb_bug28430 breaking the build. It's  marked
  as experimental by upstream and the internet is full of reports about it's
  unrelialibity

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*      $NetBSD: common.c,v 1.21 2008/09/30 08:37:42 aymeric Exp $      */
 
1
/*      $NetBSD: common.c,v 1.28 2011/07/29 20:58:07 christos Exp $     */
2
2
 
3
3
/*-
4
4
 * Copyright (c) 1992, 1993
51
51
 */
52
52
protected el_action_t
53
53
/*ARGSUSED*/
54
 
ed_end_of_file(EditLine *el, int c __attribute__((__unused__)))
 
54
ed_end_of_file(EditLine *el, Int c __attribute__((__unused__)))
55
55
{
56
56
 
57
57
        re_goto_bottom(el);
58
58
        *el->el_line.lastchar = '\0';
59
 
        return (CC_EOF);
 
59
        return CC_EOF;
60
60
}
61
61
 
62
62
 
65
65
 *      Insert a character [bound to all insert keys]
66
66
 */
67
67
protected el_action_t
68
 
ed_insert(EditLine *el, int c)
 
68
ed_insert(EditLine *el, Int c)
69
69
{
70
70
        int count = el->el_state.argument;
71
71
 
72
72
        if (c == '\0')
73
 
                return (CC_ERROR);
 
73
                return CC_ERROR;
74
74
 
75
75
        if (el->el_line.lastchar + el->el_state.argument >=
76
76
            el->el_line.limit) {
98
98
        if (el->el_state.inputmode == MODE_REPLACE_1)
99
99
                return vi_command_mode(el, 0);
100
100
 
101
 
        return (CC_NORM);
 
101
        return CC_NORM;
102
102
}
103
103
 
104
104
 
108
108
 */
109
109
protected el_action_t
110
110
/*ARGSUSED*/
111
 
ed_delete_prev_word(EditLine *el, int c __attribute__((__unused__)))
 
111
ed_delete_prev_word(EditLine *el, Int c __attribute__((__unused__)))
112
112
{
113
 
        char *cp, *p, *kp;
 
113
        Char *cp, *p, *kp;
114
114
 
115
115
        if (el->el_line.cursor == el->el_line.buffer)
116
 
                return (CC_ERROR);
 
116
                return CC_ERROR;
117
117
 
118
118
        cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
119
119
            el->el_state.argument, ce__isword);
122
122
                *kp++ = *p;
123
123
        el->el_chared.c_kill.last = kp;
124
124
 
125
 
        c_delbefore(el, el->el_line.cursor - cp);       /* delete before dot */
 
125
        c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */
126
126
        el->el_line.cursor = cp;
127
127
        if (el->el_line.cursor < el->el_line.buffer)
128
128
                el->el_line.cursor = el->el_line.buffer; /* bounds check */
129
 
        return (CC_REFRESH);
 
129
        return CC_REFRESH;
130
130
}
131
131
 
132
132
 
136
136
 */
137
137
protected el_action_t
138
138
/*ARGSUSED*/
139
 
ed_delete_next_char(EditLine *el, int c)
 
139
ed_delete_next_char(EditLine *el, Int c __attribute__((__unused__)))
140
140
{
141
 
#ifdef notdef                   /* XXX */
 
141
#ifdef DEBUG_EDIT
142
142
#define EL      el->el_line
143
143
        (void) fprintf(el->el_errlfile,
144
144
            "\nD(b: %x(%s)  c: %x(%s) last: %x(%s) limit: %x(%s)\n",
151
151
                        if (el->el_line.cursor == el->el_line.buffer) {
152
152
                                /* if I'm also at the beginning */
153
153
#ifdef KSHVI
154
 
                                return (CC_ERROR);
 
154
                                return CC_ERROR;
155
155
#else
156
156
                                /* then do an EOF */
157
 
                                term_writechar(el, c);
158
 
                                return (CC_EOF);
 
157
                                terminal_writec(el, c);
 
158
                                return CC_EOF;
159
159
#endif
160
160
                        } else {
161
161
#ifdef KSHVI
162
162
                                el->el_line.cursor--;
163
163
#else
164
 
                                return (CC_ERROR);
 
164
                                return CC_ERROR;
165
165
#endif
166
166
                        }
167
167
                } else {
168
168
                        if (el->el_line.cursor != el->el_line.buffer)
169
169
                                el->el_line.cursor--;
170
170
                        else
171
 
                                return (CC_ERROR);
 
171
                                return CC_ERROR;
172
172
                }
173
173
        }
174
174
        c_delafter(el, el->el_state.argument);  /* delete after dot */
176
176
            el->el_line.cursor > el->el_line.buffer)
177
177
                        /* bounds check */
178
178
                el->el_line.cursor = el->el_line.lastchar - 1;
179
 
        return (CC_REFRESH);
 
179
        return CC_REFRESH;
180
180
}
181
181
 
182
182
 
186
186
 */
187
187
protected el_action_t
188
188
/*ARGSUSED*/
189
 
ed_kill_line(EditLine *el, int c __attribute__((__unused__)))
 
189
ed_kill_line(EditLine *el, Int c __attribute__((__unused__)))
190
190
{
191
 
        char *kp, *cp;
 
191
        Char *kp, *cp;
192
192
 
193
193
        cp = el->el_line.cursor;
194
194
        kp = el->el_chared.c_kill.buf;
197
197
        el->el_chared.c_kill.last = kp;
198
198
                        /* zap! -- delete to end */
199
199
        el->el_line.lastchar = el->el_line.cursor;
200
 
        return (CC_REFRESH);
 
200
        return CC_REFRESH;
201
201
}
202
202
 
203
203
 
207
207
 */
208
208
protected el_action_t
209
209
/*ARGSUSED*/
210
 
ed_move_to_end(EditLine *el, int c __attribute__((__unused__)))
 
210
ed_move_to_end(EditLine *el, Int c __attribute__((__unused__)))
211
211
{
212
212
 
213
213
        el->el_line.cursor = el->el_line.lastchar;
214
214
        if (el->el_map.type == MAP_VI) {
215
215
                if (el->el_chared.c_vcmd.action != NOP) {
216
216
                        cv_delfini(el);
217
 
                        return (CC_REFRESH);
 
217
                        return CC_REFRESH;
218
218
                }
219
219
#ifdef VI_MOVE
220
220
                el->el_line.cursor--;
221
221
#endif
222
222
        }
223
 
        return (CC_CURSOR);
 
223
        return CC_CURSOR;
224
224
}
225
225
 
226
226
 
230
230
 */
231
231
protected el_action_t
232
232
/*ARGSUSED*/
233
 
ed_move_to_beg(EditLine *el, int c __attribute__((__unused__)))
 
233
ed_move_to_beg(EditLine *el, Int c __attribute__((__unused__)))
234
234
{
235
235
 
236
236
        el->el_line.cursor = el->el_line.buffer;
237
237
 
238
238
        if (el->el_map.type == MAP_VI) {
239
239
                        /* We want FIRST non space character */
240
 
                while (isspace((unsigned char) *el->el_line.cursor))
 
240
                while (Isspace(*el->el_line.cursor))
241
241
                        el->el_line.cursor++;
242
242
                if (el->el_chared.c_vcmd.action != NOP) {
243
243
                        cv_delfini(el);
244
 
                        return (CC_REFRESH);
 
244
                        return CC_REFRESH;
245
245
                }
246
246
        }
247
 
        return (CC_CURSOR);
 
247
        return CC_CURSOR;
248
248
}
249
249
 
250
250
 
253
253
 *      [^T] [^T]
254
254
 */
255
255
protected el_action_t
256
 
ed_transpose_chars(EditLine *el, int c)
 
256
ed_transpose_chars(EditLine *el, Int c)
257
257
{
258
258
 
259
259
        if (el->el_line.cursor < el->el_line.lastchar) {
260
260
                if (el->el_line.lastchar <= &el->el_line.buffer[1])
261
 
                        return (CC_ERROR);
 
261
                        return CC_ERROR;
262
262
                else
263
263
                        el->el_line.cursor++;
264
264
        }
267
267
                c = el->el_line.cursor[-2];
268
268
                el->el_line.cursor[-2] = el->el_line.cursor[-1];
269
269
                el->el_line.cursor[-1] = c;
270
 
                return (CC_REFRESH);
 
270
                return CC_REFRESH;
271
271
        } else
272
 
                return (CC_ERROR);
 
272
                return CC_ERROR;
273
273
}
274
274
 
275
275
 
279
279
 */
280
280
protected el_action_t
281
281
/*ARGSUSED*/
282
 
ed_next_char(EditLine *el, int c __attribute__((__unused__)))
 
282
ed_next_char(EditLine *el, Int c __attribute__((__unused__)))
283
283
{
284
 
        char *lim = el->el_line.lastchar;
 
284
        Char *lim = el->el_line.lastchar;
285
285
 
286
286
        if (el->el_line.cursor >= lim ||
287
287
            (el->el_line.cursor == lim - 1 &&
288
288
            el->el_map.type == MAP_VI &&
289
289
            el->el_chared.c_vcmd.action == NOP))
290
 
                return (CC_ERROR);
 
290
                return CC_ERROR;
291
291
 
292
292
        el->el_line.cursor += el->el_state.argument;
293
293
        if (el->el_line.cursor > lim)
296
296
        if (el->el_map.type == MAP_VI)
297
297
                if (el->el_chared.c_vcmd.action != NOP) {
298
298
                        cv_delfini(el);
299
 
                        return (CC_REFRESH);
 
299
                        return CC_REFRESH;
300
300
                }
301
 
        return (CC_CURSOR);
 
301
        return CC_CURSOR;
302
302
}
303
303
 
304
304
 
308
308
 */
309
309
protected el_action_t
310
310
/*ARGSUSED*/
311
 
ed_prev_word(EditLine *el, int c __attribute__((__unused__)))
 
311
ed_prev_word(EditLine *el, Int c __attribute__((__unused__)))
312
312
{
313
313
 
314
314
        if (el->el_line.cursor == el->el_line.buffer)
315
 
                return (CC_ERROR);
 
315
                return CC_ERROR;
316
316
 
317
317
        el->el_line.cursor = c__prev_word(el->el_line.cursor,
318
318
            el->el_line.buffer,
322
322
        if (el->el_map.type == MAP_VI)
323
323
                if (el->el_chared.c_vcmd.action != NOP) {
324
324
                        cv_delfini(el);
325
 
                        return (CC_REFRESH);
 
325
                        return CC_REFRESH;
326
326
                }
327
 
        return (CC_CURSOR);
 
327
        return CC_CURSOR;
328
328
}
329
329
 
330
330
 
334
334
 */
335
335
protected el_action_t
336
336
/*ARGSUSED*/
337
 
ed_prev_char(EditLine *el, int c __attribute__((__unused__)))
 
337
ed_prev_char(EditLine *el, Int c __attribute__((__unused__)))
338
338
{
339
339
 
340
340
        if (el->el_line.cursor > el->el_line.buffer) {
345
345
                if (el->el_map.type == MAP_VI)
346
346
                        if (el->el_chared.c_vcmd.action != NOP) {
347
347
                                cv_delfini(el);
348
 
                                return (CC_REFRESH);
 
348
                                return CC_REFRESH;
349
349
                        }
350
 
                return (CC_CURSOR);
 
350
                return CC_CURSOR;
351
351
        } else
352
 
                return (CC_ERROR);
 
352
                return CC_ERROR;
353
353
}
354
354
 
355
355
 
358
358
 *      [^V] [^V]
359
359
 */
360
360
protected el_action_t
361
 
ed_quoted_insert(EditLine *el, int c)
 
361
ed_quoted_insert(EditLine *el, Int c)
362
362
{
363
363
        int num;
364
 
        char tc;
 
364
        Char tc;
365
365
 
366
366
        tty_quotemode(el);
367
 
        num = el_getc(el, &tc);
368
 
        c = (unsigned char) tc;
 
367
        num = FUN(el,getc)(el, &tc);
 
368
        c = tc;
369
369
        tty_noquotemode(el);
370
370
        if (num == 1)
371
 
                return (ed_insert(el, c));
 
371
                return ed_insert(el, c);
372
372
        else
373
 
                return (ed_end_of_file(el, 0));
 
373
                return ed_end_of_file(el, 0);
374
374
}
375
375
 
376
376
 
378
378
 *      Adds to argument or enters a digit
379
379
 */
380
380
protected el_action_t
381
 
ed_digit(EditLine *el, int c)
 
381
ed_digit(EditLine *el, Int c)
382
382
{
383
383
 
384
 
        if (!isdigit(c))
385
 
                return (CC_ERROR);
 
384
        if (!Isdigit(c))
 
385
                return CC_ERROR;
386
386
 
387
387
        if (el->el_state.doingarg) {
388
388
                        /* if doing an arg, add this in... */
390
390
                        el->el_state.argument = c - '0';
391
391
                else {
392
392
                        if (el->el_state.argument > 1000000)
393
 
                                return (CC_ERROR);
 
393
                                return CC_ERROR;
394
394
                        el->el_state.argument =
395
395
                            (el->el_state.argument * 10) + (c - '0');
396
396
                }
397
 
                return (CC_ARGHACK);
 
397
                return CC_ARGHACK;
398
398
        }
399
399
 
400
400
        return ed_insert(el, c);
406
406
 *      For ESC-n
407
407
 */
408
408
protected el_action_t
409
 
ed_argument_digit(EditLine *el, int c)
 
409
ed_argument_digit(EditLine *el, Int c)
410
410
{
411
411
 
412
 
        if (!isdigit(c))
413
 
                return (CC_ERROR);
 
412
        if (!Isdigit(c))
 
413
                return CC_ERROR;
414
414
 
415
415
        if (el->el_state.doingarg) {
416
416
                if (el->el_state.argument > 1000000)
417
 
                        return (CC_ERROR);
 
417
                        return CC_ERROR;
418
418
                el->el_state.argument = (el->el_state.argument * 10) +
419
419
                    (c - '0');
420
420
        } else {                /* else starting an argument */
421
421
                el->el_state.argument = c - '0';
422
422
                el->el_state.doingarg = 1;
423
423
        }
424
 
        return (CC_ARGHACK);
 
424
        return CC_ARGHACK;
425
425
}
426
426
 
427
427
 
431
431
 */
432
432
protected el_action_t
433
433
/*ARGSUSED*/
434
 
ed_unassigned(EditLine *el, int c __attribute__((__unused__)))
 
434
ed_unassigned(EditLine *el __attribute__((__unused__)),
 
435
    Int c __attribute__((__unused__)))
435
436
{
436
437
 
437
 
        return (CC_ERROR);
 
438
        return CC_ERROR;
438
439
}
439
440
 
440
441
 
449
450
protected el_action_t
450
451
/*ARGSUSED*/
451
452
ed_tty_sigint(EditLine *el __attribute__((__unused__)), 
452
 
              int c __attribute__((__unused__)))
 
453
              Int c __attribute__((__unused__)))
453
454
{
454
455
 
455
 
        return (CC_NORM);
 
456
        return CC_NORM;
456
457
}
457
458
 
458
459
 
463
464
protected el_action_t
464
465
/*ARGSUSED*/
465
466
ed_tty_dsusp(EditLine *el __attribute__((__unused__)), 
466
 
             int c __attribute__((__unused__)))
 
467
             Int c __attribute__((__unused__)))
467
468
{
468
469
 
469
 
        return (CC_NORM);
 
470
        return CC_NORM;
470
471
}
471
472
 
472
473
 
477
478
protected el_action_t
478
479
/*ARGSUSED*/
479
480
ed_tty_flush_output(EditLine *el __attribute__((__unused__)), 
480
 
                    int c __attribute__((__unused__)))
 
481
                    Int c __attribute__((__unused__)))
481
482
{
482
483
 
483
 
        return (CC_NORM);
 
484
        return CC_NORM;
484
485
}
485
486
 
486
487
 
491
492
protected el_action_t
492
493
/*ARGSUSED*/
493
494
ed_tty_sigquit(EditLine *el __attribute__((__unused__)), 
494
 
               int c __attribute__((__unused__)))
 
495
               Int c __attribute__((__unused__)))
495
496
{
496
497
 
497
 
        return (CC_NORM);
 
498
        return CC_NORM;
498
499
}
499
500
 
500
501
 
505
506
protected el_action_t
506
507
/*ARGSUSED*/
507
508
ed_tty_sigtstp(EditLine *el __attribute__((__unused__)), 
508
 
               int c __attribute__((__unused__)))
 
509
               Int c __attribute__((__unused__)))
509
510
{
510
511
 
511
 
        return (CC_NORM);
 
512
        return CC_NORM;
512
513
}
513
514
 
514
515
 
519
520
protected el_action_t
520
521
/*ARGSUSED*/
521
522
ed_tty_stop_output(EditLine *el __attribute__((__unused__)), 
522
 
                   int c __attribute__((__unused__)))
 
523
                   Int c __attribute__((__unused__)))
523
524
{
524
525
 
525
 
        return (CC_NORM);
 
526
        return CC_NORM;
526
527
}
527
528
 
528
529
 
533
534
protected el_action_t
534
535
/*ARGSUSED*/
535
536
ed_tty_start_output(EditLine *el __attribute__((__unused__)), 
536
 
                    int c __attribute__((__unused__)))
 
537
                    Int c __attribute__((__unused__)))
537
538
{
538
539
 
539
 
        return (CC_NORM);
 
540
        return CC_NORM;
540
541
}
541
542
 
542
543
 
546
547
 */
547
548
protected el_action_t
548
549
/*ARGSUSED*/
549
 
ed_newline(EditLine *el, int c __attribute__((__unused__)))
 
550
ed_newline(EditLine *el, Int c __attribute__((__unused__)))
550
551
{
551
552
 
552
553
        re_goto_bottom(el);
553
554
        *el->el_line.lastchar++ = '\n';
554
555
        *el->el_line.lastchar = '\0';
555
 
        return (CC_NEWLINE);
 
556
        return CC_NEWLINE;
556
557
}
557
558
 
558
559
 
562
563
 */
563
564
protected el_action_t
564
565
/*ARGSUSED*/
565
 
ed_delete_prev_char(EditLine *el, int c __attribute__((__unused__)))
 
566
ed_delete_prev_char(EditLine *el, Int c __attribute__((__unused__)))
566
567
{
567
568
 
568
569
        if (el->el_line.cursor <= el->el_line.buffer)
569
 
                return (CC_ERROR);
 
570
                return CC_ERROR;
570
571
 
571
572
        c_delbefore(el, el->el_state.argument);
572
573
        el->el_line.cursor -= el->el_state.argument;
573
574
        if (el->el_line.cursor < el->el_line.buffer)
574
575
                el->el_line.cursor = el->el_line.buffer;
575
 
        return (CC_REFRESH);
 
576
        return CC_REFRESH;
576
577
}
577
578
 
578
579
 
582
583
 */
583
584
protected el_action_t
584
585
/*ARGSUSED*/
585
 
ed_clear_screen(EditLine *el, int c __attribute__((__unused__)))
 
586
ed_clear_screen(EditLine *el, Int c __attribute__((__unused__)))
586
587
{
587
588
 
588
 
        term_clear_screen(el);  /* clear the whole real screen */
 
589
        terminal_clear_screen(el);      /* clear the whole real screen */
589
590
        re_clear_display(el);   /* reset everything */
590
 
        return (CC_REFRESH);
 
591
        return CC_REFRESH;
591
592
}
592
593
 
593
594
 
598
599
protected el_action_t
599
600
/*ARGSUSED*/
600
601
ed_redisplay(EditLine *el __attribute__((__unused__)), 
601
 
             int c __attribute__((__unused__)))
 
602
             Int c __attribute__((__unused__)))
602
603
{
603
604
 
604
 
        return (CC_REDISPLAY);
 
605
        return CC_REDISPLAY;
605
606
}
606
607
 
607
608
 
611
612
 */
612
613
protected el_action_t
613
614
/*ARGSUSED*/
614
 
ed_start_over(EditLine *el, int c __attribute__((__unused__)))
 
615
ed_start_over(EditLine *el, Int c __attribute__((__unused__)))
615
616
{
616
617
 
617
618
        ch_reset(el, 0);
618
 
        return (CC_REFRESH);
 
619
        return CC_REFRESH;
619
620
}
620
621
 
621
622
 
626
627
protected el_action_t
627
628
/*ARGSUSED*/
628
629
ed_sequence_lead_in(EditLine *el __attribute__((__unused__)), 
629
 
                    int c __attribute__((__unused__)))
 
630
                    Int c __attribute__((__unused__)))
630
631
{
631
632
 
632
 
        return (CC_NORM);
 
633
        return CC_NORM;
633
634
}
634
635
 
635
636
 
639
640
 */
640
641
protected el_action_t
641
642
/*ARGSUSED*/
642
 
ed_prev_history(EditLine *el, int c __attribute__((__unused__)))
 
643
ed_prev_history(EditLine *el, Int c __attribute__((__unused__)))
643
644
{
644
645
        char beep = 0;
645
646
        int sv_event = el->el_history.eventno;
649
650
 
650
651
        if (el->el_history.eventno == 0) {      /* save the current buffer
651
652
                                                 * away */
652
 
                (void) strncpy(el->el_history.buf, el->el_line.buffer,
 
653
                (void) Strncpy(el->el_history.buf, el->el_line.buffer,
653
654
                    EL_BUFSIZ);
654
655
                el->el_history.last = el->el_history.buf +
655
656
                    (el->el_line.lastchar - el->el_line.buffer);
659
660
        if (hist_get(el) == CC_ERROR) {
660
661
                if (el->el_map.type == MAP_VI) {
661
662
                        el->el_history.eventno = sv_event;
662
 
                        return CC_ERROR;
 
663
                        
663
664
                }
664
665
                beep = 1;
665
666
                /* el->el_history.eventno was fixed by first call */
677
678
 */
678
679
protected el_action_t
679
680
/*ARGSUSED*/
680
 
ed_next_history(EditLine *el, int c __attribute__((__unused__)))
 
681
ed_next_history(EditLine *el, Int c __attribute__((__unused__)))
681
682
{
682
683
        el_action_t beep = CC_REFRESH, rval;
683
684
 
704
705
 */
705
706
protected el_action_t
706
707
/*ARGSUSED*/
707
 
ed_search_prev_history(EditLine *el, int c __attribute__((__unused__)))
 
708
ed_search_prev_history(EditLine *el, Int c __attribute__((__unused__)))
708
709
{
709
 
        const char *hp;
 
710
        const Char *hp;
710
711
        int h;
711
712
        bool_t found = 0;
712
713
 
719
720
                    "e_prev_search_hist(): eventno < 0;\n");
720
721
#endif
721
722
                el->el_history.eventno = 0;
722
 
                return (CC_ERROR);
 
723
                return CC_ERROR;
723
724
        }
724
725
        if (el->el_history.eventno == 0) {
725
 
                (void) strncpy(el->el_history.buf, el->el_line.buffer,
 
726
                (void) Strncpy(el->el_history.buf, el->el_line.buffer,
726
727
                    EL_BUFSIZ);
727
728
                el->el_history.last = el->el_history.buf +
728
729
                    (el->el_line.lastchar - el->el_line.buffer);
729
730
        }
730
731
        if (el->el_history.ref == NULL)
731
 
                return (CC_ERROR);
 
732
                return CC_ERROR;
732
733
 
733
734
        hp = HIST_FIRST(el);
734
735
        if (hp == NULL)
735
 
                return (CC_ERROR);
 
736
                return CC_ERROR;
736
737
 
737
738
        c_setpat(el);           /* Set search pattern !! */
738
739
 
743
744
#ifdef SDEBUG
744
745
                (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
745
746
#endif
746
 
                if ((strncmp(hp, el->el_line.buffer, (size_t)
 
747
                if ((Strncmp(hp, el->el_line.buffer, (size_t)
747
748
                            (el->el_line.lastchar - el->el_line.buffer)) ||
748
749
                        hp[el->el_line.lastchar - el->el_line.buffer]) &&
749
750
                    c_hmatch(el, hp)) {
758
759
#ifdef SDEBUG
759
760
                (void) fprintf(el->el_errfile, "not found\n");
760
761
#endif
761
 
                return (CC_ERROR);
 
762
                return CC_ERROR;
762
763
        }
763
764
        el->el_history.eventno = h;
764
765
 
765
 
        return (hist_get(el));
 
766
        return hist_get(el);
766
767
}
767
768
 
768
769
 
772
773
 */
773
774
protected el_action_t
774
775
/*ARGSUSED*/
775
 
ed_search_next_history(EditLine *el, int c __attribute__((__unused__)))
 
776
ed_search_next_history(EditLine *el, Int c __attribute__((__unused__)))
776
777
{
777
 
        const char *hp;
 
778
        const Char *hp;
778
779
        int h;
779
780
        bool_t found = 0;
780
781
 
783
784
        *el->el_line.lastchar = '\0';   /* just in case */
784
785
 
785
786
        if (el->el_history.eventno == 0)
786
 
                return (CC_ERROR);
 
787
                return CC_ERROR;
787
788
 
788
789
        if (el->el_history.ref == NULL)
789
 
                return (CC_ERROR);
 
790
                return CC_ERROR;
790
791
 
791
792
        hp = HIST_FIRST(el);
792
793
        if (hp == NULL)
793
 
                return (CC_ERROR);
 
794
                return CC_ERROR;
794
795
 
795
796
        c_setpat(el);           /* Set search pattern !! */
796
797
 
798
799
#ifdef SDEBUG
799
800
                (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
800
801
#endif
801
 
                if ((strncmp(hp, el->el_line.buffer, (size_t)
 
802
                if ((Strncmp(hp, el->el_line.buffer, (size_t)
802
803
                            (el->el_line.lastchar - el->el_line.buffer)) ||
803
804
                        hp[el->el_line.lastchar - el->el_line.buffer]) &&
804
805
                    c_hmatch(el, hp))
811
812
#ifdef SDEBUG
812
813
                        (void) fprintf(el->el_errfile, "not found\n");
813
814
#endif
814
 
                        return (CC_ERROR);
 
815
                        return CC_ERROR;
815
816
                }
816
817
        }
817
818
        el->el_history.eventno = found;
818
819
 
819
 
        return (hist_get(el));
 
820
        return hist_get(el);
820
821
}
821
822
 
822
823
 
826
827
 */
827
828
protected el_action_t
828
829
/*ARGSUSED*/
829
 
ed_prev_line(EditLine *el, int c __attribute__((__unused__)))
 
830
ed_prev_line(EditLine *el, Int c __attribute__((__unused__)))
830
831
{
831
 
        char *ptr;
 
832
        Char *ptr;
832
833
        int nchars = c_hpos(el);
833
834
 
834
835
        /*
842
843
                        break;
843
844
 
844
845
        if (el->el_state.argument > 0)
845
 
                return (CC_ERROR);
 
846
                return CC_ERROR;
846
847
 
847
848
        /*
848
849
         * Move to the beginning of the line
859
860
                continue;
860
861
 
861
862
        el->el_line.cursor = ptr;
862
 
        return (CC_CURSOR);
 
863
        return CC_CURSOR;
863
864
}
864
865
 
865
866
 
869
870
 */
870
871
protected el_action_t
871
872
/*ARGSUSED*/
872
 
ed_next_line(EditLine *el, int c __attribute__((__unused__)))
 
873
ed_next_line(EditLine *el, Int c __attribute__((__unused__)))
873
874
{
874
 
        char *ptr;
 
875
        Char *ptr;
875
876
        int nchars = c_hpos(el);
876
877
 
877
878
        /*
882
883
                        break;
883
884
 
884
885
        if (el->el_state.argument > 0)
885
 
                return (CC_ERROR);
 
886
                return CC_ERROR;
886
887
 
887
888
        /*
888
889
         * Move to the character requested
893
894
                continue;
894
895
 
895
896
        el->el_line.cursor = ptr;
896
 
        return (CC_CURSOR);
 
897
        return CC_CURSOR;
897
898
}
898
899
 
899
900
 
903
904
 */
904
905
protected el_action_t
905
906
/*ARGSUSED*/
906
 
ed_command(EditLine *el, int c __attribute__((__unused__)))
 
907
ed_command(EditLine *el, Int c __attribute__((__unused__)))
907
908
{
908
 
        char tmpbuf[EL_BUFSIZ];
 
909
        Char tmpbuf[EL_BUFSIZ];
909
910
        int tmplen;
910
911
 
911
 
        tmplen = c_gets(el, tmpbuf, "\n: ");
912
 
        term__putc(el, '\n');
 
912
        tmplen = c_gets(el, tmpbuf, STR("\n: "));
 
913
        terminal__putc(el, '\n');
913
914
 
914
915
        if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
915
 
                term_beep(el);
 
916
                terminal_beep(el);
916
917
 
917
918
        el->el_map.current = el->el_map.key;
918
919
        re_clear_display(el);