home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1483
< prev
next >
Wrap
Text File
|
1990-12-28
|
2KB
|
109 lines
Newsgroups: alt.sources
From: jimf@SABER.COM
Subject: [xpert] Re: dynamic updating of title string in twm title for an Xterm.
Message-ID: <1990Jun20.012038.21900@math.lsa.umich.edu>
Date: Wed, 20 Jun 90 01:20:38 GMT
Archive-name: window-label/19-Jun-90
Original-posting-by: jimf@SABER.COM
Original-subject: Re: dynamic updating of title string in twm title for an Xterm.
Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)
[Reposted from comp.windows.x.
Comments on this service to emv@math.lsa.umich.edu (Edward Vielmetti).]
|Back under X11R3 I had copied an escape sequence from someone that updated
|the title string on the twm title bar on my xterm windows from the command
|line. Now that I have progressed to R4 and the twm version distributed
|with it, I find I can no longer do this. Can someone tell me how to do this?
The following program, "l.c" does this under both X and SunView.
jim frost
saber software
jimf@saber.com
-- cut here --
/* l.c:
*
* icon/window labelling program for sunview/X
*
* jim frost 11.27.89
*/
#include <stdio.h>
char *prgname;
void usage()
{
fprintf(stderr, "Usage: %s [-sun|-sunview|-x11|-r4|-x11r4] window_label\n",
prgname);
exit(1);
}
#define SUNVIEW 0 /* sunview is a zero */
#define X11 1 /* X11 xterm */
main(argc, argv)
int argc;
char **argv;
{ char buf[BUFSIZ];
int type= -1;
prgname= *(argv++);
if (! *argv)
usage();
if (**argv == '-') {
if (!strcmp(*argv, "-sun") || !strcmp(*argv, "-sunview"))
type= SUNVIEW;
else if (!strcmp(*argv, "-x11") || !strcmp("-x") ||
!strcmp(*argv, "-X11") || !strcmp("-X"))
type= X11;
else
usage();
}
else
--argv;
/* no type given, try to figure it out from the environment
*/
if (type < 0) {
if (getenv("WINDOW_PARENT") ||
getenv("WINDOW_ME") ||
getenv("WINDOW_GFX") ||
getenv("WMGR_ENV_PLACEHOLDER"))
type= SUNVIEW;
else
type= X11;
}
/* build string to send
*/
buf[0]= '\0';
while (*(++argv)) {
strcat(buf, *argv);
if (*(argv + 1))
strcat(buf, " ");
}
/* send the proper escape for whatever type
*/
switch(type) {
case SUNVIEW: /* in days of old these were nice enough to have the same */
printf("\033]l%s\033\\\033]L%s\033\\", buf, buf);
break;
case X11:
printf("\033]0;%s\007", buf);
break;
default:
fprintf(stderr, "%s: Internal error (unknown terminal type)\n");
}
exit(0);
}