Debian Codegraph @

reset.c

raw
1 /* $Id: reset.c,v 1.10 2024/12/05 00:37:39 tom Exp $ */
2
3 #include <vttest.h>
4 #include <esc.h>
5
6 static int did_reset = FALSE;
7
8 int
9 tst_DECSTR(MENU_ARGS)
10 {
11 vt_move(1, 1);
12 println(the_title);
13 println("(VT220 & up)");
14 println("");
15 println("The terminal will now soft-reset");
16 holdit();
17 decstr();
18 return MENU_HOLD;
19 }
20
21 static int
22 tst_DECTST(MENU_ARGS)
23 {
24 vt_move(1, 1);
25 println(the_title);
26 println("");
27
28 if (did_reset)
29 println("The terminal is now RESET. Next, the built-in confidence test");
30 else
31 printxx("The built-in confidence test ");
32 printxx("will be invoked. ");
33 holdit();
34
35 vt_clear(2);
36 dectst(1);
37 zleep(5000); /* Wait 5.0 seconds */
38 vt_move(10, 1);
39 println("If the built-in confidence test found any errors, a code");
40 printxx("%s", "is visible above. ");
41
42 did_reset = FALSE;
43 return MENU_HOLD;
44 }
45
46 static int
47 tst_RIS(MENU_ARGS)
48 {
49 vt_move(1, 1);
50 println(the_title);
51 println("(VT100 & up, not recommended)");
52 println("");
53 printxx("The terminal will now be RESET. ");
54 holdit();
55 ris();
56 zleep(5000); /* Wait 5.0 seconds */
57
58 did_reset = TRUE;
59 reset_level();
60 input_8bits = FALSE;
61 output_8bits = FALSE;
62 parse_7bits = FALSE;
63 return MENU_HOLD;
64 }
65
66 int
67 tst_rst(MENU_ARGS)
68 {
69 /* *INDENT-OFF* */
70 static MENU my_menu[] = {
71 { "Exit", NULL },
72 { "Reset to Initial State (RIS)", tst_RIS },
73 { "Invoke Terminal Test (DECTST)", tst_DECTST },
74 { "Soft Terminal Reset (DECSTR)", tst_DECSTR },
75 { "", NULL }
76 };
77 /* *INDENT-ON* */
78
79 did_reset = FALSE;
80
81 do {
82 vt_clear(2);
83 __(title(0), printxx("%s", the_title));
84 __(title(2), println("Choose test type:"));
85 } while (menu(my_menu));
86 return MENU_NOHOLD;
87 }