Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcdc!hpfcdq!toml From: toml@hpfcdq.HP.COM (Tom LaStrange) Newsgroups: comp.windows.x Subject: Re: twm program 'mytitle' Message-ID: <890033@hpfcdq.HP.COM> Date: 29 Mar 89 14:26:16 GMT References: <2@nrl-cmf.UUCP> Organization: Hewlett-Packard - Fort Collins, CO Lines: 72 >a few releases of twm ago, Tom sent out a small program called 'mytitle' >to the twm release. It didn't do much, but added enough to each xterm so >when I iconified it, the machine name would appear. I'm sure it went >against all specs, etc. but does anyone still have this code, or can >point me as how to manage this myself? (not that i have time, but...) > Here it is. -- Tom LaStrange Hewlett Packard Co. ARPA: toml%hpfcla@hplabs.hp.com Graphics Technology Division UUCP: hplabs!hpfcla!toml Fort Collins, CO --------------------------------------------------------------- # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by Tom LaStrange on Wed Mar 29 07:25:13 1989 # # This archive contains: # mytitle.c # LANG=""; export LANG echo x - mytitle.c cat >mytitle.c <<'@EOF' #include main() { char *wd, *home, *term, dir[200], host[100]; int i, len; if ((wd = (char *)getcwd(NULL,200)) == NULL) exit(0); term = (char *)getenv("TERM"); if (strncmp(term, "xterm", 5) && strncmp(term, "vt100", 5)) exit(0); home = (char *)getenv("HOME"); /* printf("term = \"%s\" wd = \"%s\" home = \"%s\"\n", term, wd, home);*/ gethostname(host,100); len = strlen(home); for (i = 0; i < len; i++) { if (home[i] != wd[i]) break; } if (i == len) printf("\033]2;%s: ~%s\007", host,&wd[i]); else printf("\033]2;%s: %s\007", host,wd); printf("\033]1;%s\007", host); /* printf("\033]0;%s\007", host); */ exit(0); } @EOF chmod 644 mytitle.c exit 0