X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/95f51977ddc18faa2e212f30c00a39540b39f325..ca67e7b465996afb3821d6a075c4dc6a7f0f5d52:/usr/src/ucb/talk/get_names.c diff --git a/usr/src/ucb/talk/get_names.c b/usr/src/ucb/talk/get_names.c index 9421fd6ea1..fe4238169b 100644 --- a/usr/src/ucb/talk/get_names.c +++ b/usr/src/ucb/talk/get_names.c @@ -1,21 +1,32 @@ /* * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef lint -static char sccsid[] = "@(#)get_names.c 5.2 (Berkeley) 3/13/86"; -#endif not lint +static char sccsid[] = "@(#)get_names.c 5.5 (Berkeley) 6/29/88"; +#endif /* not lint */ #include "talk.h" #include #include +#include char *getlogin(); char *ttyname(); char *rindex(); -static any(); extern CTL_MSG msg; /* @@ -39,14 +50,17 @@ get_names(argc, argv) printf("Standard input must be a tty, not a pipe or a file\n"); exit(-1); } - my_name = getlogin(); - if (my_name == NULL) { - printf("You don't exist. Go away.\n"); - exit(-1); + if ((my_name = getlogin()) == NULL) { + struct passwd *pw; + + if ((pw = getpwuid(getuid())) == NULL) { + printf("You don't exist. Go away.\n"); + exit(-1); + } + my_name = pw->pw_name; } gethostname(hostname, sizeof (hostname)); my_machine_name = hostname; - my_tty = rindex(ttyname(0), '/') + 1; /* check for, and strip out, the machine name of the target */ for (cp = argv[1]; *cp && !any(*cp, "@:!."); cp++) ;