diff options
author | Greg Hudson <ghudson@mit.edu> | 1998-05-24 00:50:03 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 1998-05-24 00:50:03 +0000 |
commit | 2950c1476df17598d83e4864f2608d68b1a996d9 (patch) | |
tree | 8a8c3a2ade97aedca2ddbcac7641eb7d0f6d89c0 /lib | |
parent | 83bd77d41e39def0ffb43560a38806fe4c010f6f (diff) |
Use all but the first component of the tty name, instead of the last
component. This way you can recover the tty name by putting "/dev/"
before what you see, instead of guessing.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ZLocations.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ZLocations.c b/lib/ZLocations.c index c4eaa48..4dac959 100644 --- a/lib/ZLocations.c +++ b/lib/ZLocations.c @@ -47,8 +47,8 @@ Code_t ZInitLocationInfo(hostname, tty) strcpy(mytty, tty); } else { ttyp = ttyname(0); - if (ttyp) { - p = strrchr(ttyp, '/'); + if (ttyp && *ttyp) { + p = strchr(ttyp + 1, '/'); strcpy(mytty, (p) ? p + 1 : ttyp); } else { strcpy(mytty, "unknown"); |