gwu@tcs.com (George Wu) (03/30/91)
- Okay, when I rlogin/rsh to my HP9000/400t, I'd like to know from which machine I originated. The general idea is to set the DISPLAY variable such that X applications use the display on my orignal machine. I'd also like to use different stty settings, since keyboards sometimes differ. So, does anyone have an idea on how to do this? I thought I had worked out a means by parsing the output of rwho, but there's a log between login time and when rwhod actually updates the information. Any ideas? Thanks much in advance. George -- ---- George J Wu, Software Engineer | gwu@tcs.com or uunet!tcs!gwu Teknekron Communications Systems, Inc.| (415) 649-3752 2121 Allston Way, Berkeley, CA, 94704 | Quit reading news. Get back to work.
jim@tiamat.fsc.com ( IT Manager) (03/31/91)
In article <1970@news.tcs.com>, gwu@tcs.com (George Wu) writes: > > Okay, when I rlogin/rsh to my HP9000/400t, I'd like to know from which > machine I originated. The general idea is to set the DISPLAY variable such > that X applications use the display on my orignal machine. I'd also like to > use different stty settings, since keyboards sometimes differ. When using rsh, I just do: remsh otherhost "DISPLAY=$DISPLAY command" With rlogin, you could try to take advantage of rlogin passing the TERM variable to the remote host. A sequence like: on localhost: $ TERM=$TERM/$DISPLAY $ rlogin otherhost on otherhost (before the actual value of TERM is needed): DISPLAY=`echo $TERM | sed -e 's;^.*/;;'` TERM=`echo $TERM | sed -e 's;/.*$;;'` You could expand the whole notion and use appropriate code on each side of the connection to pass just about any values you wanted. Personally, I wish rsh and rlogin would just pass the entire environment, and let the remote host set it's own local stuff, with everything else remaining the same. ------------- James B. O'Connor jim@tiamat.fsc.com Ahlstrom Filtration, Inc. 615/821-4022 x. 651
paul@eye.com (Paul B. Booth) (04/01/91)
In article <822@tiamat.fsc.com> jim@tiamat.fsc.com ( IT Manager) writes: > >Personally, I wish rsh and rlogin would just pass the entire environment, and >let the remote host set it's own local stuff, with everything else remaining >the same. > If you've got nfs, try using "on." A command like "on node2 cc ..." causes your current working dir to be nfs mounted on node2 and then runs cc there with your current environment. When cc's done the mount is undone. On has a couple of quirks (root generally can't use it; and pathnames in the command string resolve to either the local or remote system depending on whether they are full names or relative to you working dir.), but it accomplishes a lot of stuff that remsh can't do well. -- Paul B. Booth (paul@eye.com) (...!hplabs!hpfcla!eye!paul) ------------------------------------------------------------------------------- 3D/EYE, Inc., 2359 N. Triphammer Rd., Ithaca, NY 14850 voice: (607)257-1381 fax: (607)257-7335
jww@hpfcbig.SDE.HP.COM (Jim Wichelman) (04/02/91)
The following simple program should work ... Jim Wichelman Hewlett Packard jww@hpfclp.sde.hp.com #------------------------------------------------------------- # 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 Jim Wichelman <jww@hpfcjww> on Mon Apr 1 11:07:24 1991 # # This archive contains: # fromhost.c # LANG=""; export LANG PATH=/bin:/usr/bin:$PATH; export PATH echo x - fromhost.c cat >fromhost.c <<'@EOF' #include <stdio.h> #include <string.h> #ifdef hpux #include <sys/types.h> #endif #ifdef apollo #include <sys/types.h> #endif #include <utmp.h> #define UTMP_FILE "/etc/utmp" main () { char *tty; char *p; FILE *fd; struct utmp info; char host[100]; extern char *ttyname(); tty = ttyname( fileno(stderr) ); if (!tty) tty = ttyname( fileno(stdout) ); if (!tty) tty = ttyname( fileno(stdin) ); tty += strlen("/dev/"); if (!(fd = fopen(UTMP_FILE, "r"))) { printf("unknown-host, can't open %s\n", UTMP_FILE); close(fd); exit(1); } while ( fread( (char *)&info, sizeof(info), 1, fd) ) if (strcmp(tty, info.ut_line) == 0) { p = info.ut_host; while (*p == ' ') p++; while (*p) { if ( ( *p == '.') || (*p == ':') ) *p = 0; else p++; } p = info.ut_host; if ( (strlen(p) == 0) || (strcmp("unix", p) == 0)) { host[0] = 0; if (gethostname(host, sizeof(host)) == 0) p = host; else p = "<unknown from host>"; } printf("%s\n",p); close(fd); exit(0); } printf("unknown-host, no entry in %s\n", UTMP_FILE); close(fd); exit(1); } @EOF chmod 664 fromhost.c exit 0
franks@synoptics.com (Frank Stutzman) (04/02/91)
In article <822@tiamat.fsc.com>, jim@tiamat.fsc.com ( IT Manager) writes: |> Personally, I wish rsh and rlogin would just pass the entire environment, and |> let the remote host set it's own local stuff, with everything else remaining |> the same. Is'nt this what the 'on' command is supposed to do? I've never used it much but that is the idea that you get from the man pages. Of course, the big problem with it is that you have to have nfs up. BTW, on the original question, as of 7.0 the /etc/utmp file does have information on where a virtual terminal connection (rlogin, telnet, whatnot) came from (i.e. the host who origniated it). Unfortunately, there are no shipped utilites that will dig this out for you. Take a look at /usr/include/utmp.h. The entry for that has UNSUPPORTED stamped all over it, but I've seen it work. |=======================================|-----------------------------| | |Frank Stutzman | | |SynOptics Communications, Inc | "arp, arp, arp" The mating | |Product Support | call of the lonely packet. | |Santa Clara, Ca | --- Mike Powell | |frank@synoptics.com | | |=======================================|-----------------------------| |