/*
* 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 <sys/param.h>
#include <protocols/talkd.h>
+#include <pwd.h>
char *getlogin();
char *ttyname();
char *rindex();
-static any();
extern CTL_MSG msg;
/*
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++)
;