aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/talk/get_names.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1994-10-24 05:42:34 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1994-10-24 05:42:34 +0000
commitc6189102a36744e2d5bc50714ba62168a5e55f32 (patch)
treed85efd6a2fd19d367bbacb21b1f641b833f7680b /usr.bin/talk/get_names.c
parentfe08a6032f1dcf6f0234a464fbf944ce37aadbeb (diff)
downloadsrc-c6189102a36744e2d5bc50714ba62168a5e55f32.tar.gz
src-c6189102a36744e2d5bc50714ba62168a5e55f32.zip
Partially back out previous fix (in cases ':' and '!'),
leave case '.' as valid user name, not host reference. Document new behaviour.
Notes
Notes: svn path=/head/; revision=3829
Diffstat (limited to 'usr.bin/talk/get_names.c')
-rw-r--r--usr.bin/talk/get_names.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c
index bde908ac2d32..0d1fcf1c32b4 100644
--- a/usr.bin/talk/get_names.c
+++ b/usr.bin/talk/get_names.c
@@ -79,17 +79,23 @@ get_names(argc, argv)
gethostname(hostname, sizeof (hostname));
my_machine_name = hostname;
/* check for, and strip out, the machine name of the target */
- for (cp = argv[1]; *cp && *cp != '@'; cp++)
+ for (cp = argv[1]; *cp && !index("@:!", *cp); cp++)
;
if (*cp == '\0') {
/* this is a local to local talk */
his_name = argv[1];
his_machine_name = my_machine_name;
} else {
+ if (*cp++ == '@') {
/* user@host */
his_name = argv[1];
- his_machine_name = cp + 1;
- *cp = '\0';
+ his_machine_name = cp;
+ } else {
+ /* host!user or host:user */
+ his_name = cp;
+ his_machine_name = argv[1];
+ }
+ *--cp = '\0';
}
if (argc > 2)
his_tty = argv[2]; /* tty name is arg 2 */