Skip to contentSkip to conversation

the xterm that is produced for the virtual consoles should have the --name

PATCH In review Michael Richardson 3 participants 3 messages Jan 18, 2006 – Jan 19, 2006 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 the xterm that is produced for the virtual consoles should have the --name

From: Michael Richardson <[email protected]>

the xterm that is produced for the virtual consoles should have the --name option added. This will tell the xterm to lookup a custom resource in the X resource database, and may permit the user to have all the consoles associated with a given UML be the same colour. For instance, you could put:

	marajade-[~] mcr 1129 %grep east .Xresources
	east*foreground: Green
	east*background: Black
	east*saveLines: 1000

this patch added a fourth argument to the xterm definition so that the name of the option could be changed. For gnome-terminal, perhaps --window-with-profile will work. It looks like this option will work without the = in the option, so it should work for gnome people too.

---

 arch/um/drivers/xterm.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

applies-to: f0f578967fc649a7b993b212e164b658639ef184 7335417358836aebdb201c5e2ea6229af6449af6

arch/um/drivers/xterm.c +17 -6
index aaa6366..0220d59 100644
@@ -50,6 +50,7 @@ void *xterm_init(char *str, int device, 
 /* Only changed by xterm_setup, which is a setup */
 static char *terminal_emulator = "xterm";
 static char *title_switch = "-T";
+static char *name_switch = "-name";
 static char *exec_switch = "-e";
 
 static int __init xterm_setup(char *line, int *add)
@@ -67,6 +68,11 @@ static int __init xterm_setup(char *line
 	*line++ = '\0';
 	if(*line) exec_switch = line;
 
+	line = strchr(line, ',');
+	if(line == NULL) return(0);
+	*line++ = '\0';
+	if(*line) name_switch = line;
+
 	return(0);
 }
 
@@ -79,8 +85,8 @@ __uml_setup("xterm=", xterm_setup,
 "    respectively.  The title switch must have the form '<switch> title',\n"
 "    not '<switch>=title'.  Similarly, the exec switch must have the form\n"
 "    '<switch> command arg1 arg2 ...'.\n"
-"    The default values are 'xterm=xterm,-T,-e'.  Values for gnome-terminal\n"
-"    are 'xterm=gnome-terminal,-t,-x'.\n\n"
+"    The default values are 'xterm=xterm,-T,-e,--name'.  Values for gnome-terminal\n"
+"    are 'xterm=gnome-terminal,-t,-x,--window-with-profile'.\n\n"
 );
 
 /* XXX This badly needs some cleaning up in the error paths
@@ -93,12 +99,17 @@ int xterm_open(int input, int output, in
 	unsigned long stack;
 	int pid, fd, new, err;
 	char title[256], file[] = "/tmp/xterm-pipeXXXXXX";
-	char *argv[] = { terminal_emulator, title_switch, title, exec_switch, 
-			 "/usr/lib/uml/port-helper", "-uml-socket",
+	char umlname[64];
+	char *argv[] = { terminal_emulator, title_switch, title,
+			 name_switch, umlname,
+			 exec_switch,"/usr/lib/uml/port-helper", "-uml-socket",
 			 file, NULL };
 
-	if(os_access(argv[4], OS_ACC_X_OK) < 0)
-		argv[4] = "port-helper";
+	/* get the UML name */
+	strcpy(umlname, get_umid(0));
+
+	if(os_access(argv[6], OS_ACC_X_OK) < 0)
+		argv[6] = "port-helper";
 
 	/* Check that DISPLAY is set, this doesn't guarantee the xterm
 	 * will work but w/o it we can be pretty sure it won't. */

---
0.99.9.GIT

#1 lore raw
Quoted 8 lines · Michael Richardson

From: Michael Richardson <[email protected]>

the xterm that is produced for the virtual consoles should have the --name option added. This will tell the xterm to lookup a custom resource in the X resource database, and may permit the user to have all the consoles associated with a given UML be the same colour. For instance, you could put:

Quoted 4 lines
	marajade-[~] mcr 1129 %grep east .Xresources
	east*foreground: Green
	east*background: Black
	east*saveLines: 1000

From the patch I guess that's for umid=east, right?

I believe to every single word of what you say, but this is black magic to me... I'm too young for this sort of things :-)

Quoted 4 lines

this patch added a fourth argument to the xterm definition so that the name of the option could be changed. For gnome-terminal, perhaps --window-with-profile will work. It looks like this option will work without the = in the option, so it should work for gnome people too.

If needing the =, they can pass it in I guess (well, we should check the option parser, guess it's happy).

Quoted 2 lines

static char *title_switch = "-T";
+static char *name_switch = "-name";

--name, with 2 dashes, not 1. Did you test the patch? (It seems perfectly ok for everything else). Fix this, run it and do the below proto update, and for me it's perfectly ok to send.

Quoted 32 lines

static char *exec_switch = "-e";

static int __init xterm_setup(char *line, int *add)

arch/um/drivers/xterm.c +5 -0
@@ -67,6 +68,11 @@ static int __init xterm_setup(char *line
 	*line++ = '\0';
 	if(*line) exec_switch = line;
 
+	line = strchr(line, ',');
+	if(line == NULL) return(0);
+	*line++ = '\0';
+	if(*line) name_switch = line;
+
 	return(0);
 }
 
@@ -79,8 +85,8 @@ __uml_setup("xterm=", xterm_setup,
 "    respectively.  The title switch must have the form '<switch>

title',\n" " not '<switch>=title'. Similarly, the exec switch must have
the form\n" " '<switch> command arg1 arg2 ...'.\n"
-" The default values are 'xterm=xterm,-T,-e'. Values for
gnome-terminal\n" -" are 'xterm=gnome-terminal,-t,-x'.\n\n"
+" The default values are 'xterm=xterm,-T,-e,--name'. Values for
gnome-terminal\n" +" are
'xterm=gnome-terminal,-t,-x,--window-with-profile'.\n\n" );

/* XXX This badly needs some cleaning up in the error paths

arch/um/drivers/xterm.c +0 -2
@@ -93,12 +99,17 @@ int xterm_open(int input, int output, in
 	unsigned long stack;
 	int pid, fd, new, err;
 	char title[256], file[] = "/tmp/xterm-pipeXXXXXX";
-	char *argv[] = { terminal_emulator, title_switch, title, exec_switch,
-			 "/usr/lib/uml/port-helper", "-uml-socket",

arch/um/drivers/xterm.c int xterm_open(int input, int output, in · line 109

Quoted 10 lines
arch/um/drivers/xterm.c +6 -2
+	char umlname[64];
+	char *argv[] = { terminal_emulator, title_switch, title,
+			 name_switch, umlname,
+			 exec_switch,"/usr/lib/uml/port-helper", "-uml-socket",
 			 file, NULL };
 
-	if(os_access(argv[4], OS_ACC_X_OK) < 0)
-		argv[4] = "port-helper";
+	/* get the UML name */
+	strcpy(umlname, get_umid(0));

The prototype just became:

extern char *get_umid(void);

Quoted 4 lines
arch/um/drivers/xterm.c +2 -0
+	if(os_access(argv[6], OS_ACC_X_OK) < 0)
+		argv[6] = "port-helper";
 

0.99.9.GIT

Update that GIT ;-)

Signature · 22 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw
Quoted 3 lines · Blaisorblade

--name, with 2 dashes, not 1. Did you test the patch? (It seems perfectly ok for everything else). Fix this, run it and do the below proto update, and for me it's perfectly ok to send.

I tested it with xterm. Works great! Unfortunately, I don't have gnome-terminal and UML working on the same machine.

Cheers,
Jody

Quoted 66 lines
Quoted 33 lines

static char *exec_switch = "-e";

static int __init xterm_setup(char *line, int *add)

arch/um/drivers/xterm.c +5 -0
@@ -67,6 +68,11 @@ static int __init xterm_setup(char *line
 	*line++ = '\0';
 	if(*line) exec_switch = line;
 
+	line = strchr(line, ',');
+	if(line == NULL) return(0);
+	*line++ = '\0';
+	if(*line) name_switch = line;
+
 	return(0);
 }
 
@@ -79,8 +85,8 @@ __uml_setup("xterm=", xterm_setup,
 "    respectively.  The title switch must have the form '<switch>

title',\n" " not '<switch>=title'. Similarly, the exec switch must have
the form\n" " '<switch> command arg1 arg2 ...'.\n"
-" The default values are 'xterm=xterm,-T,-e'. Values for
gnome-terminal\n" -" are 'xterm=gnome-terminal,-t,-x'.\n\n"
+" The default values are 'xterm=xterm,-T,-e,--name'. Values for
gnome-terminal\n" +" are
'xterm=gnome-terminal,-t,-x,--window-with-profile'.\n\n" );

/* XXX This badly needs some cleaning up in the error paths

arch/um/drivers/xterm.c +0 -2
@@ -93,12 +99,17 @@ int xterm_open(int input, int output, in
 	unsigned long stack;
 	int pid, fd, new, err;
 	char title[256], file[] = "/tmp/xterm-pipeXXXXXX";
-	char *argv[] = { terminal_emulator, title_switch, title, exec_switch,
-			 "/usr/lib/uml/port-helper", "-uml-socket",

arch/um/drivers/xterm.c int xterm_open(int input, int output, in · line 109

Quoted 10 lines
arch/um/drivers/xterm.c +6 -2
+	char umlname[64];
+	char *argv[] = { terminal_emulator, title_switch, title,
+			 name_switch, umlname,
+			 exec_switch,"/usr/lib/uml/port-helper", "-uml-socket",
 			 file, NULL };
 
-	if(os_access(argv[4], OS_ACC_X_OK) < 0)
-		argv[4] = "port-helper";
+	/* get the UML name */
+	strcpy(umlname, get_umid(0));

The prototype just became:

extern char *get_umid(void);

Quoted 4 lines
arch/um/drivers/xterm.c +2 -0
+	if(os_access(argv[6], OS_ACC_X_OK) < 0)
+		argv[6] = "port-helper";
 

0.99.9.GIT

Update that GIT ;-)

Signature · 11 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade





___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
Signature · 9 lines
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel