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,7 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
37 37
 /* Set default console usage if applicable */
38 38
 #if ! ( defined ( CONSOLE_VMWARE ) && CONSOLE_EXPLICIT ( CONSOLE_VMWARE ) )
39 39
 #undef CONSOLE_VMWARE
40
-#define CONSOLE_VMWARE CONSOLE_USAGE_ALL
40
+#define CONSOLE_VMWARE ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
41 41
 #endif
42 42
 
43 43
 /** VMware logfile console GuestRPC channel */

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

@@ -12,6 +12,8 @@ static void ansiscr_putc(struct _curses_screen *scr, chtype c) __nonnull;
12 12
 unsigned short _COLS = 80;
13 13
 unsigned short _LINES = 24;
14 14
 
15
+static unsigned int saved_usage;
16
+
15 17
 static void ansiscr_reset ( struct _curses_screen *scr ) {
16 18
 	/* Reset terminal attributes and clear screen */
17 19
 	scr->attrs = 0;
@@ -20,6 +22,16 @@ static void ansiscr_reset ( struct _curses_screen *scr ) {
20 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 35
 static void ansiscr_movetoyx ( struct _curses_screen *scr,
24 36
 			       unsigned int y, unsigned int x ) {
25 37
 	if ( ( x != scr->curs_x ) || ( y != scr->curs_y ) ) {
@@ -65,8 +77,8 @@ static bool ansiscr_peek ( struct _curses_screen *scr __unused ) {
65 77
 }
66 78
 
67 79
 SCREEN _ansi_screen = {
68
-	.init		= ansiscr_reset,
69
-	.exit		= ansiscr_reset,
80
+	.init		= ansiscr_init,
81
+	.exit		= ansiscr_exit,
70 82
 	.movetoyx	= ansiscr_movetoyx,
71 83
 	.putc		= ansiscr_putc,
72 84
 	.getc		= ansiscr_getc,

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

@@ -117,8 +117,12 @@ struct console_driver {
117 117
 /** Debug messages */
118 118
 #define CONSOLE_USAGE_DEBUG 0x0002
119 119
 
120
+/** Text-based user interface */
121
+#define CONSOLE_USAGE_TUI 0x0004
122
+
120 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,7 +39,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
39 39
 /* Set default console usage if applicable */
40 40
 #if ! ( defined ( CONSOLE_SYSLOG ) && CONSOLE_EXPLICIT ( CONSOLE_SYSLOG ) )
41 41
 #undef CONSOLE_SYSLOG
42
-#define CONSOLE_SYSLOG CONSOLE_USAGE_ALL
42
+#define CONSOLE_SYSLOG ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
43 43
 #endif
44 44
 
45 45
 /** The syslog server */

Loading…
Cancel
Save