Browse Source

[console] Exclude text-based UI output from logfile-based consoles

The output from text-based user interfaces such as the "config"
command is not generally meaningful for logfile-based consoles such as
syslog and vmconsole.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
64d17dbd50

+ 1
- 1
src/arch/i386/interface/vmware/vmconsole.c View File

37
 /* Set default console usage if applicable */
37
 /* Set default console usage if applicable */
38
 #if ! ( defined ( CONSOLE_VMWARE ) && CONSOLE_EXPLICIT ( CONSOLE_VMWARE ) )
38
 #if ! ( defined ( CONSOLE_VMWARE ) && CONSOLE_EXPLICIT ( CONSOLE_VMWARE ) )
39
 #undef CONSOLE_VMWARE
39
 #undef CONSOLE_VMWARE
40
-#define CONSOLE_VMWARE CONSOLE_USAGE_ALL
40
+#define CONSOLE_VMWARE ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
41
 #endif
41
 #endif
42
 
42
 
43
 /** VMware logfile console GuestRPC channel */
43
 /** VMware logfile console GuestRPC channel */

+ 14
- 2
src/hci/mucurses/ansi_screen.c View File

12
 unsigned short _COLS = 80;
12
 unsigned short _COLS = 80;
13
 unsigned short _LINES = 24;
13
 unsigned short _LINES = 24;
14
 
14
 
15
+static unsigned int saved_usage;
16
+
15
 static void ansiscr_reset ( struct _curses_screen *scr ) {
17
 static void ansiscr_reset ( struct _curses_screen *scr ) {
16
 	/* Reset terminal attributes and clear screen */
18
 	/* Reset terminal attributes and clear screen */
17
 	scr->attrs = 0;
19
 	scr->attrs = 0;
20
 	printf ( "\033[0m" );
22
 	printf ( "\033[0m" );
21
 }
23
 }
22
 
24
 
25
+static void ansiscr_init ( struct _curses_screen *scr ) {
26
+	saved_usage = console_set_usage ( CONSOLE_USAGE_TUI );
27
+	ansiscr_reset ( scr );
28
+}
29
+
30
+static void ansiscr_exit ( struct _curses_screen *scr ) {
31
+	ansiscr_reset ( scr );
32
+	console_set_usage ( saved_usage );
33
+}
34
+
23
 static void ansiscr_movetoyx ( struct _curses_screen *scr,
35
 static void ansiscr_movetoyx ( struct _curses_screen *scr,
24
 			       unsigned int y, unsigned int x ) {
36
 			       unsigned int y, unsigned int x ) {
25
 	if ( ( x != scr->curs_x ) || ( y != scr->curs_y ) ) {
37
 	if ( ( x != scr->curs_x ) || ( y != scr->curs_y ) ) {
65
 }
77
 }
66
 
78
 
67
 SCREEN _ansi_screen = {
79
 SCREEN _ansi_screen = {
68
-	.init		= ansiscr_reset,
69
-	.exit		= ansiscr_reset,
80
+	.init		= ansiscr_init,
81
+	.exit		= ansiscr_exit,
70
 	.movetoyx	= ansiscr_movetoyx,
82
 	.movetoyx	= ansiscr_movetoyx,
71
 	.putc		= ansiscr_putc,
83
 	.putc		= ansiscr_putc,
72
 	.getc		= ansiscr_getc,
84
 	.getc		= ansiscr_getc,

+ 5
- 1
src/include/ipxe/console.h View File

117
 /** Debug messages */
117
 /** Debug messages */
118
 #define CONSOLE_USAGE_DEBUG 0x0002
118
 #define CONSOLE_USAGE_DEBUG 0x0002
119
 
119
 
120
+/** Text-based user interface */
121
+#define CONSOLE_USAGE_TUI 0x0004
122
+
120
 /** All console usages */
123
 /** All console usages */
121
-#define CONSOLE_USAGE_ALL ( CONSOLE_USAGE_STDOUT | CONSOLE_USAGE_DEBUG )
124
+#define CONSOLE_USAGE_ALL \
125
+	( CONSOLE_USAGE_STDOUT | CONSOLE_USAGE_DEBUG | CONSOLE_USAGE_TUI )
122
 
126
 
123
 /** @} */
127
 /** @} */
124
 
128
 

+ 1
- 1
src/net/udp/syslog.c View File

39
 /* Set default console usage if applicable */
39
 /* Set default console usage if applicable */
40
 #if ! ( defined ( CONSOLE_SYSLOG ) && CONSOLE_EXPLICIT ( CONSOLE_SYSLOG ) )
40
 #if ! ( defined ( CONSOLE_SYSLOG ) && CONSOLE_EXPLICIT ( CONSOLE_SYSLOG ) )
41
 #undef CONSOLE_SYSLOG
41
 #undef CONSOLE_SYSLOG
42
-#define CONSOLE_SYSLOG CONSOLE_USAGE_ALL
42
+#define CONSOLE_SYSLOG ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
43
 #endif
43
 #endif
44
 
44
 
45
 /** The syslog server */
45
 /** The syslog server */

Loading…
Cancel
Save