-
Notifications
You must be signed in to change notification settings - Fork 0
/
pad.c
1958 lines (1880 loc) · 43 KB
/
pad.c
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
** Copyright (C) 1991, 1997 Free Software Foundation, Inc.
**
** This file is part of TACK.
**
** TACK is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2, or (at your option)
** any later version.
**
** TACK is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with TACK; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA
*/
#include <tack.h>
MODULE_ID("$Id: pad.c,v 1.7 2009/12/26 21:30:31 tom Exp $")
/* test the pad counts on the terminal */
static void pad_standard(struct test_list *, int *, int *);
static void init_xon_xoff(struct test_list *, int *, int *);
static void init_cup(struct test_list *, int *, int *);
static void pad_rmxon(struct test_list *, int *, int *);
static void pad_home1(struct test_list *, int *, int *);
static void pad_home2(struct test_list *, int *, int *);
static void pad_clear(struct test_list *, int *, int *);
static void pad_ech(struct test_list *, int *, int *);
static void pad_el1(struct test_list *, int *, int *);
static void pad_el(struct test_list *, int *, int *);
static void pad_smdc(struct test_list *, int *, int *);
static void pad_dch(struct test_list *, int *, int *);
static void pad_dch1(struct test_list *, int *, int *);
static void pad_smir(struct test_list *, int *, int *);
static void pad_ich(struct test_list *, int *, int *);
static void pad_ich1(struct test_list *, int *, int *);
static void pad_xch1(struct test_list *, int *, int *);
static void pad_rep(struct test_list *, int *, int *);
static void pad_cup(struct test_list *, int *, int *);
static void pad_hd(struct test_list *, int *, int *);
static void pad_hu(struct test_list *, int *, int *);
static void pad_rin(struct test_list *, int *, int *);
static void pad_il(struct test_list *, int *, int *);
static void pad_indn(struct test_list *, int *, int *);
static void pad_dl(struct test_list *, int *, int *);
static void pad_xl(struct test_list *, int *, int *);
static void pad_scrc(struct test_list *, int *, int *);
static void pad_csrind(struct test_list *, int *, int *);
static void pad_sccsrrc(struct test_list *, int *, int *);
static void pad_csr_nel(struct test_list *, int *, int *);
static void pad_csr_cup(struct test_list *, int *, int *);
static void pad_ht(struct test_list *, int *, int *);
static void pad_smso(struct test_list *, int *, int *);
static void pad_smacs(struct test_list *, int *, int *);
static void pad_crash(struct test_list *, int *, int *);
/*
Any command found in this list, executed from a "Done" prompt
will force the default action to repeat rather than next.
*/
const char *pad_repeat_test = {"ep-+<>"};
struct test_list pad_test_list[] = {
{0, 0, 0, 0, "e) edit terminfo", 0, &edit_menu},
{0, 0, 0, 0, "p) change padding", 0, &change_pad_menu},
{0, 0, 0, 0, "@) display statistics about the last test", dump_test_stats, 0},
{0, 0, 0, 0, "c) clear screen", menu_clear_screen, 0},
{0, 0, 0, 0, "i) send reset and init", menu_reset_init, 0},
{0, 0, 0, 0, txt_longer_test_time, longer_test_time, 0},
{0, 0, 0, 0, txt_shorter_test_time, shorter_test_time, 0},
{0, 0, 0, 0, txt_longer_augment, longer_augment, 0},
{0, 0, 0, 0, txt_shorter_augment, shorter_augment, 0},
/***
Phase 1: Test initialization and reset strings.
(rs1) (rs2) (rs3) (is1) (is2) (is3) are very difficult to test.
They have no defined output. To make matters worse, the cap
builder could partition (rs1) (rs2) (rs3) by length, leaving the
terminal in some unknown state between (rs1) and (rs2) or between
(r2) and (rs3). Some reset strings clear the screen when done.
We have no control over this. The only thing we can do for
certain is to test the pad times by checking for overruns.
***/
{MENU_NEXT, 3, "rs1", 0, 0, pad_standard, 0},
{MENU_NEXT, 3, "rs2", 0, 0, pad_standard, 0},
{MENU_NEXT, 3, "rs3", 0, 0, pad_standard, 0},
{MENU_NEXT | MENU_INIT, 0, 0, 0, 0, init_xon_xoff, 0},
{MENU_NEXT, 3, "is1", 0, 0, pad_standard, 0},
{MENU_NEXT, 3, "is2", 0, 0, pad_standard, 0},
{MENU_NEXT, 3, "is3", 0, 0, pad_standard, 0},
{MENU_NEXT, 3, "rmxon", "smxon", 0, pad_rmxon, 0},
{MENU_NEXT | MENU_INIT, 0, 0, 0, 0, init_cup, 0},
/*
Phase 2: Test home, screen clears and erases.
*/
{MENU_NEXT, 0, "home", 0, 0, pad_home1, 0},
{MENU_NEXT, 0, "home) (nel", 0, 0, pad_home2, 0},
{MENU_NEXT | 1, 0, "clear", 0, 0, pad_clear, 0},
{MENU_NEXT | MENU_LM1, 0, "ed", 0, 0, pad_clear, 0},
{MENU_NEXT | MENU_80c, 0, "ech", 0, 0, pad_ech, 0},
{MENU_NEXT | MENU_80c, 0, "el1", "cub1 nel", 0, pad_el1, 0},
{MENU_NEXT | MENU_10c, 0, "el", "nel", 0, pad_el, 0},
/*
Phase 3: Character deletions and insertions
*/
{MENU_NEXT, 0, "smdc) (rmdc", 0, 0, pad_smdc, 0},
{MENU_NEXT | MENU_80c, 0, "dch", "smdc rmdc", 0, pad_dch, 0},
{MENU_NEXT | MENU_80c, 0, "dch1", "smdc rmdc", 0, pad_dch1, 0},
{MENU_NEXT, 0, "smir) (rmir", 0, 0, pad_smir, 0},
{MENU_NEXT | MENU_90c, 0, "ich) (ip", "smir rmir", 0, pad_ich, 0},
{MENU_NEXT | MENU_90c, 0, "ich1) (ip", "smir rmir", 0, pad_ich1, 0},
{MENU_NEXT, 4, "ich1) (dch1", "smir rmir", 0, pad_xch1, 0},
{MENU_NEXT | MENU_90c, 0, "rep", 0, 0, pad_rep, 0},
/*
Phase 4: Test cursor addressing pads.
*/
{MENU_NEXT, 0, "cup", 0, 0, pad_cup, 0},
/*
Phase 5: Test scrolling and cursor save/restore.
*/
{MENU_NEXT, 0, "hd", 0, 0, pad_hd, 0},
{MENU_NEXT, 0, "hu", 0, 0, pad_hu, 0},
{MENU_NEXT | MENU_LM1 | 1, 0, "rin", 0, 0, pad_rin, 0},
{MENU_NEXT, 0, "ri", 0, 0, pad_rin, 0},
{MENU_NEXT | MENU_LM1 | 1, 0, "il", 0, 0, pad_il, 0},
{MENU_NEXT, 0, "il1", 0, 0, pad_il, 0},
{MENU_NEXT | MENU_LM1 | 1, 0, "indn", 0, 0, pad_indn, 0},
{MENU_NEXT, 0, "ind", 0, 0, pad_indn, 0},
{MENU_NEXT | MENU_LM1 | 1, 0, "dl", 0, 0, pad_dl, 0},
{MENU_NEXT, 0, "dl1", 0, 0, pad_dl, 0},
{MENU_NEXT, 0, "il1) (dl1", 0, 0, pad_xl, 0},
{MENU_NEXT, 0, "sc) (rc", 0, 0, pad_scrc, 0},
{MENU_NEXT | MENU_50l, 0, "csr) (ind", 0, 0, pad_csrind, 0},
{MENU_NEXT, 0, "sc) (csr) (rc", 0, 0, pad_sccsrrc, 0},
{MENU_NEXT, 0, "csr) (nel", "sc rc", 0, pad_csr_nel, 0},
{MENU_NEXT, 0, "csr) (cup", 0, 0, pad_csr_cup, 0},
/*
Phase 6: Test tabs.
*/
{MENU_NEXT, 0, "ht", 0, 0, pad_ht, 0},
/*
Phase 7: Test character-set-switch pads.
*/
{MENU_NEXT, 0, "smso) (rmso", 0, 0, pad_smso, 0},
{MENU_NEXT, 0, "smacs) (rmacs", 0, 0, pad_smacs, 0},
/*
Phase 8: Tests for miscellaneous mode-switch pads.
*/
{MENU_NEXT, 3, "flash", 0, 0, pad_standard, 0},
{MENU_NEXT, 3, "smkx", 0, 0, pad_standard, 0},
{MENU_NEXT, 3, "rmkx", 0, 0, pad_standard, 0},
{MENU_NEXT, 3, "smm", 0, 0, pad_standard, 0},
{MENU_NEXT, 3, "rmm", 0, 0, pad_standard, 0},
/*
Phase 9: Test crash-and-burn properties of unpadded (clear).
*/
{0, 0, "clear", "xon", "k) run clear test with no padding", pad_crash, 0},
{MENU_LAST, 0, 0, 0, 0, 0, 0}
};
/* globals */
static int hzcc; /* horizontal character count */
char letter; /* current character being displayed */
int letter_number; /* points into letters[] */
int augment, repeats; /* number of characters (or lines) effected */
char letters[] = "AbCdefghiJklmNopQrStuVwXyZ";
static char every_line[] = "This text should be on every line.";
static char all_lines[] = "Each char on any line should be the same. ";
static char above_line[] = "The above lines should be all Xs. ";
static char no_visual[] = "This loop test has no visual failure indicator. ";
/*
** pad_standard(test_list, status, ch)
**
** Run a single cap pad test.
*/
static void
pad_standard(
struct test_list *t,
int *state,
int *ch)
{
const char *long_name;
char *cap;
int l = 2, i;
char tbuf[128];
if ((cap = get_string_cap_byname(t->caps_done, &long_name))) {
sprintf(tbuf, "(%s) %s, start testing", t->caps_done,
long_name);
if (skip_pad_test(t, state, ch, tbuf)) {
return;
}
i = 1;
pad_test_startup(1);
do {
if (i >= columns) {
page_loop();
l++;
i = 1;
}
tt_putp(cap);
putchp(letter);
i++;
} while(still_testing());
pad_test_shutdown(t, 0);
if (l >= lines) {
home_down();
} else {
put_crlf();
}
ptextln(no_visual);
} else {
CAP_NOT_FOUND;
/* Note: get_string_cap_byname() always sets long_name */
sprintf(temp, "(%s) %s, not present. ", t->caps_done,
long_name);
ptext(temp);
}
pad_done_message(t, state, ch);
}
/*
** init_xon_xoff(test_list, status, ch)
**
** Initialize the xon_xoff values
*/
static void
init_xon_xoff(
struct test_list *t GCC_UNUSED,
int *state GCC_UNUSED,
int *ch GCC_UNUSED)
{
/* the reset strings may dink with the XON/XOFF modes */
if (select_xon_xoff == 0 && exit_xon_mode) {
tc_putp(exit_xon_mode);
}
if (select_xon_xoff == 1 && enter_xon_mode) {
tc_putp(enter_xon_mode);
}
}
/*
** pad_rmxon(test_list, status, ch)
**
** Test (rmxon) exit XON/XOFF mode
*/
static void
pad_rmxon(
struct test_list *t,
int *state,
int *ch)
{
if (select_xon_xoff == 0 && exit_xon_mode) {
pad_standard(t, state, ch);
}
}
/*
** init_cup(test_list, status, ch)
**
** Send the initialization strings for XON/XOFF and (smcup)
** Stop pad testing if clear screen is missing.
*/
static void
init_cup(
struct test_list *t,
int *state,
int *ch)
{
init_xon_xoff(t, state, ch);
if (enter_ca_mode) {
tc_putp(enter_ca_mode);
}
if (!can_clear_screen) {
ptext("(clear) clear screen not present,");
ptext(" pad processing terminated. ");
pad_done_message(t, state, ch);
if (*ch == 0 || *ch == 'n' || *ch == 's' || *ch == 'r') {
*ch = '?';
}
return;
}
}
/*
** pad_home1(test_list, status, ch)
**
** Test (home) when (am) is set.
*/
static void
pad_home1(
struct test_list *t,
int *state,
int *ch)
{
int j, k;
if (can_go_home && auto_right_margin) {
/*
truly brain damaged terminals will fail this test because
they cannot accept data at full rate
*/
if (skip_pad_test(t, state, ch, "(home) Home start testing")) {
return;
}
pad_test_startup(1);
do {
go_home();
for (j = 1; j < lines; j++) {
for (k = 0; k < columns; k++) {
if (k & 0xF) {
put_this(letter);
} else {
put_this('.');
}
}
SLOW_TERMINAL_EXIT;
}
NEXT_LETTER;
} while(still_testing());
pad_test_shutdown(t, 0);
ptext("All the dots should line up. ");
pad_done_message(t, state, ch);
put_clear();
}
}
/*
** pad_home2(test_list, status, ch)
**
** Test (home) and (nel). (am) is reset.
*/
static void
pad_home2(
struct test_list *t,
int *state,
int *ch)
{
int j, k;
if (can_go_home) {
if (skip_pad_test(t, state, ch,
"(home) Home, (nel) newline start testing")) {
return;
}
pad_test_startup(1);
do {
go_home();
for (j = 1; j < lines; j++) {
for (k = 2; k < columns; k++) {
if (k & 0xF) {
put_this(letter);
} else {
put_this('.');
}
}
put_crlf(); /* this does the (nel) */
SLOW_TERMINAL_EXIT;
}
NEXT_LETTER;
} while(still_testing());
pad_test_shutdown(t, 0);
ptext("All the dots should line up. ");
pad_done_message(t, state, ch);
put_clear();
}
}
/*
** pad_clear(test_list, status, ch)
**
** Test (clear) and (ed)
** run the clear screen tests (also clear-to-end-of-screen)
**
** 0) full page
** 1) sparse page
** 2) short lines
** 3) one full line
** 4) one short line
*/
static void
pad_clear(
struct test_list *t,
int *state,
int *ch)
{
const char *end_message = 0;
const char *txt;
int j, k, is_clear;
int clear_select; /* select the test number */
is_clear = t->flags & 1;
clear_select = auto_right_margin ? 0 : 1;
if (is_clear) {
txt = "(clear) clear-screen start testing";
} else {
if (!clr_eos) {
CAP_NOT_FOUND;
ptext("(ed) erase-to-end-of-display, not present. ");
pad_done_message(t, state, ch);
return;
}
txt = "(ed) erase-to-end-of-display start testing";
}
if (skip_pad_test(t, state, ch, txt)) {
return;
}
if (enter_am_mode) {
tc_putp(enter_am_mode);
clear_select = 0;
}
for (; clear_select < 5; clear_select++) {
if (augment > lines || is_clear || !cursor_address) {
augment = lines;
} else {
if (augment <= 1) {
augment = 2;
}
if (augment < lines) {
put_clear();
tt_putparm(cursor_address, 1,
lines - augment - 1, 0);
ptextln("This line should not be erased (ed)");
}
}
repeats = augment;
switch (clear_select) {
case 0:
end_message = "Clear full screen. ";
break;
case 1:
end_message = "Clear sparse screen. ";
if (cursor_down) {
break;
}
clear_select++;
/* FALLTHRU */
case 2:
end_message = "Clear one character per line. ";
if (newline) {
break;
}
clear_select++;
/* FALLTHRU */
case 3:
end_message = "Clear one full line. ";
break;
case 4:
end_message = "Clear single short line. ";
break;
}
pad_test_startup(0);
do {
switch (clear_select) {
case 0: /* full screen test */
for (j = 1; j < repeats; j++) {
for (k = 0; k < columns; k++) {
if (k & 0xF) {
put_this(letter);
} else {
put_this('.');
}
}
SLOW_TERMINAL_EXIT;
}
break;
case 1: /* sparse screen test */
for (j = columns - repeats; j > 2; j--) {
put_this(letter);
}
for (j = 2; j < repeats; j++) {
tt_putp(cursor_down);
put_this(letter);
}
break;
case 2: /* short lines */
for (j = 2; j < repeats; j++) {
put_this(letter);
tt_putp(newline);
}
put_this(letter);
break;
case 3: /* one full line */
for (j = columns - 5; j > 1; j--) {
put_this(letter);
}
break;
case 4: /* one short line */
put_str("Erase this!");
break;
}
if (is_clear) {
put_clear();
} else {
if (augment == lines) {
go_home();
} else {
tt_putparm(cursor_address, 1,
lines - repeats, 0);
}
tt_tputs(clr_eos, repeats);
}
NEXT_LETTER;
} while(still_testing());
pad_test_shutdown(t, 1);
ptext(end_message);
pad_done_message(t, state, ch);
if (*ch != 0 && *ch != 'n') {
return;
}
}
}
/*
** pad_ech(test_list, status, ch)
**
** Test (ech) erase characters
*/
static void
pad_ech(
struct test_list *t,
int *state,
int *ch)
{
int i, j;
if (!erase_chars) {
CAP_NOT_FOUND;
ptext("(ech) Erase-characters, not present. ");
pad_done_message(t, state, ch);
return;
}
if (skip_pad_test(t, state, ch,
"(ech) Erase-characters start testing")) {
return;
}
if (augment > columns - 2) {
augment = columns - 2;
}
pad_test_startup(1);
do {
go_home();
for (i = 2; i < lines; i++) {
for (j = 0; j <= repeats; j++) {
putchp(letter);
}
put_cr();
tt_putparm(erase_chars, repeats, repeats, 0);
put_crlf();
SLOW_TERMINAL_EXIT;
}
for (i = 1; i <= repeats; i++) {
putchp(' ');
}
putchp(letter);
put_crlf();
NEXT_LETTER;
} while(still_testing());
pad_test_shutdown(t, 0);
ptext(all_lines);
pad_done_message(t, state, ch);
put_clear();
}
/*
** pad_el1(test_list, status, ch)
**
** Test (el1) erase to start of line also (cub1) and (nel)
*/
static void
pad_el1(
struct test_list *t,
int *state,
int *ch)
{
int i, j;
if (!clr_bol) {
CAP_NOT_FOUND;
ptext("(el1) Erase-to-beginning-of-line, not present. ");
pad_done_message(t, state, ch);
return;
}
if (skip_pad_test(t, state, ch,
"(el1) Erase-to-beginning-of-line start testing")) {
return;
}
if (augment > columns - 2) {
augment = columns - 2;
}
pad_test_startup(1);
do {
go_home();
for (i = 2; i < lines; i++) {
for (j = 0; j <= repeats; j++) {
putchp(letter);
}
tt_putp(cursor_left);
tt_putp(cursor_left);
tt_tputs(clr_bol, repeats);
put_crlf();
SLOW_TERMINAL_EXIT;
}
for (i = 1; i <= repeats; i++) {
putchp(' ');
}
putchp(letter);
put_crlf();
NEXT_LETTER;
} while(still_testing());
pad_test_shutdown(t, 0);
ptext(all_lines);
pad_done_message(t, state, ch);
put_clear();
}
/*
** pad_el(test_list, status, ch)
**
** Test (el) clear to end of line also (nel)
*/
static void
pad_el(
struct test_list *t,
int *state,
int *ch)
{
int i, j;
if (!clr_eol) {
CAP_NOT_FOUND;
ptext("(el) Clear-to-end-of-line, not present. ");
pad_done_message(t, state, ch);
return;
}
if (skip_pad_test(t, state, ch,
"(el) Clear-to-end-of-line start testing")) {
return;
}
hzcc = columns * 8 / 10; /* horizontal character count */
if (augment > hzcc) {
augment = hzcc;
}
pad_test_startup(1);
do {
go_home();
for (i = 2; i < lines; i++) {
for (j = -1; j < augment; j++) {
putchp(letter);
}
put_cr();
putchp(letter);
tt_putp(clr_eol);
put_crlf();
SLOW_TERMINAL_EXIT;
}
putchp(letter);
put_crlf();
NEXT_LETTER;
} while(still_testing());
pad_test_shutdown(t, 0);
ptext(all_lines);
pad_done_message(t, state, ch);
put_clear();
}
/*
** pad_smdc(test_list, status, ch)
**
** Test (smdc) (rmdc) Delete mode
*/
static void
pad_smdc(
struct test_list *t,
int *state,
int *ch)
{
int i;
if (!enter_delete_mode) {
CAP_NOT_FOUND;
ptext("(smdc) Enter-delete-mode");
if (!exit_delete_mode) {
ptext(", (rmdc) Exit-delete-mode");
}
ptext(", not present. ");
pad_done_message(t, state, ch);
return;
}
if (skip_pad_test(t, state, ch,
"(smdc) (rmdc) Enter/Exit-delete-mode start testing")) {
return;
}
pad_test_startup(1);
do {
page_loop();
for (i = 1; i < columns; i++) {
tt_putp(enter_delete_mode);
tt_putp(exit_delete_mode);
putchp(letter);
}
} while(still_testing());
pad_test_shutdown(t, 0);
home_down();
ptext(no_visual);
pad_done_message(t, state, ch);
put_clear();
}
/*
** pad_dch(test_list, status, ch)
**
** Test (smdc) (rmdc) Delete mode and (dch)
*/
static void
pad_dch(
struct test_list *t,
int *state,
int *ch)
{
int i, j;
if (!parm_dch) {
CAP_NOT_FOUND;
ptext("(dch) Delete-characters, not present. ");
pad_done_message(t, state, ch);
return;
}
if (skip_pad_test(t, state, ch,
"(dch) Delete-characters start testing")) {
return;
}
hzcc = columns * 8 / 10; /* horizontal character count */
if (augment > hzcc) {
augment = hzcc;
}
pad_test_startup(1);
do {
go_home();
for (i = 2; i < lines; i++) {
for (j = 0; j <= repeats; j++) {
putchp(letter);
}
put_cr();
tt_putp(enter_delete_mode);
tt_putparm(parm_dch, repeats, repeats, 0);
tt_putp(exit_delete_mode);
put_crlf();
SLOW_TERMINAL_EXIT;
}
putchp(letter);
put_crlf();
NEXT_LETTER;
} while(still_testing());
pad_test_shutdown(t, 0);
home_down();
ptext(all_lines);
pad_done_message(t, state, ch);
put_clear();
}
/*
** pad_dch1(test_list, status, ch)
**
** Test (smdc) (rmdc) Delete mode and (dch1)
*/
static void
pad_dch1(
struct test_list *t,
int *state,
int *ch)
{
int i, j;
if (!delete_character) {
if (parm_dch) {
/* if the other one is defined then its OK */
return;
}
CAP_NOT_FOUND;
ptext("(dch1) Delete-character, not present. ");
pad_done_message(t, state, ch);
return;
}
if (skip_pad_test(t, state, ch,
"(dch1) Delete-character start testing")) {
return;
}
hzcc = columns * 8 / 10; /* horizontal character count */
if (augment > hzcc) {
augment = hzcc;
}
pad_test_startup(1);
do {
go_home();
for (i = 2; i < lines; i++) {
for (j = -1; j < augment; j++) {
putchp(letter);
}
put_cr();
tt_putp(enter_delete_mode);
for (j = 0; j < augment; j++) {
tt_putp(delete_character);
}
tt_putp(exit_delete_mode);
put_crlf();
SLOW_TERMINAL_EXIT;
}
putchp(letter);
put_crlf();
NEXT_LETTER;
} while(still_testing());
pad_test_shutdown(t, 0);
ptext(all_lines);
pad_done_message(t, state, ch);
put_clear();
}
/*
** pad_smir(test_list, status, ch)
**
** Test (smir) (rmir) Insert mode
*/
static void
pad_smir(
struct test_list *t,
int *state,
int *ch)
{
int i;
if (!enter_insert_mode) {
CAP_NOT_FOUND;
ptext("(smir) Enter-insert-mode");
if (!exit_insert_mode) {
ptext(", (rmir) Exit-insert-mode");
}
ptext(", not present. ");
pad_done_message(t, state, ch);
return;
}
if (skip_pad_test(t, state, ch,
"(smir) (rmir) Enter/Exit-insert-mode start testing")) {
return;
}
pad_test_startup(1);
do {
page_loop();
for (i = 1; i < columns; i++) {
tt_putp(enter_insert_mode);
tt_putp(exit_insert_mode);
putchp(letter);
}
} while(still_testing());
pad_test_shutdown(t, 0);
home_down();
ptext(no_visual);
pad_done_message(t, state, ch);
put_clear();
}
/*
** pad_ich(test_list, status, ch)
**
** Test (smir) (rmir) Insert mode and (ich) and (ip)
*/
static void
pad_ich(
struct test_list *t,
int *state,
int *ch)
{
int i, j;
if (!parm_ich) {
CAP_NOT_FOUND;
ptext("(ich) Insert-characters, not present. ");
pad_done_message(t, state, ch);
return;
}
if (skip_pad_test(t, state, ch,
"(ich) Insert-characters, (ip) Insert-padding start testing")) {
return;
}
j = columns * 9 / 10;
if (augment > j) {
augment = j;
}
pad_test_startup(1);
do {
go_home();
for (i = 2; i < lines; i++) {
putchp(letter);
put_cr();
tt_putp(enter_insert_mode);
replace_mode = 0;
tt_putparm(parm_ich, repeats, repeats, 0);
tt_putp(exit_insert_mode);
replace_mode = 1;
put_crlf();
SLOW_TERMINAL_EXIT;
}
for (i = 0; i < repeats; i++) {
putchp(' ');
}
putchp(letter);
NEXT_LETTER;
put_crlf();
} while(still_testing());
pad_test_shutdown(t, 0);
ptext(all_lines);
pad_done_message(t, state, ch);
tc_putp(exit_insert_mode);
}
/*
** pad_ich1(test_list, status, ch)
**
** Test (smir) (rmir) Insert mode and (ich1) and (ip)
*/
static void
pad_ich1(
struct test_list *t,
int *state,
int *ch)
{
int i, j;
if (!insert_character) {
CAP_NOT_FOUND;
ptext("(ich1) Insert-character, not present. ");
pad_done_message(t, state, ch);
return;
}
if (skip_pad_test(t, state, ch,
"(ich1) Insert-character, (ip) Insert-padding start testing")) {
return;
}
if (augment > columns - 2) {
augment = columns - 2;
}
pad_test_startup(1);
do {
put_clear();
for (i = 2; i < lines; i++) {
putchp(letter);
put_cr();
tt_putp(enter_insert_mode);
replace_mode = 0;
if (!insert_padding && !insert_character) {
/* only enter/exit is needed */
for (j = 0; j < augment; j++) {
putchp('.');
}
} else {
for (j = 0; j < augment; j++) {
tt_putp(insert_character);
putchp('.');
tt_putp(insert_padding);
}
}
tt_putp(exit_insert_mode);
replace_mode = 1;
put_crlf();
SLOW_TERMINAL_EXIT;
}
for (j = 0; j < augment; j++) {
putchp('.');
}
putchp(letter);
NEXT_LETTER;
put_crlf();
} while(still_testing());
pad_test_shutdown(t, 0);
ptext(all_lines);
pad_done_message(t, state, ch);
tc_putp(exit_insert_mode);
}
/*
** pad_xch1(test_list, status, ch)
**
** Test (ich1) (ip) (dch1)
*/
static void
pad_xch1(
struct test_list *t,
int *state,