version 1.5, 1998/04/28 22:13:25 |
version 1.6, 1998/08/18 04:02:13 |
|
|
char *names; |
char *names; |
|
|
if ((argc < 2 ) || ('@' == argv[1][0])) { |
if ((argc < 2 ) || ('@' == argv[1][0])) { |
printf("Usage: talk user [ttyname]\n"); |
fprintf(stderr, "usage: talk user [ttyname]\n" |
printf(" talk user@hostname [ttyname]\n"); |
" talk user@hostname [ttyname]\n"); |
exit(-1); |
exit(-1); |
} |
} |
if (!isatty(0)) { |
if (!isatty(0)) |
printf("Standard input must be a tty, not a pipe or a file\n"); |
errx(1, "standard input must be a tty, not a pipe or a file"); |
exit(-1); |
|
} |
|
|
|
if ((my_name = getlogin()) == NULL) { |
if ((my_name = getlogin()) == NULL) { |
struct passwd *pw; |
struct passwd *pw; |
|
|
if ((pw = getpwuid(getuid())) == NULL) { |
if ((pw = getpwuid(getuid())) == NULL) |
printf("You don't exist. Go away.\n"); |
errx(1, "you don't exist in the passwd file."); |
exit(-1); |
|
} |
|
my_name = pw->pw_name; |
my_name = pw->pw_name; |
} |
} |
gethostname(hostname, sizeof (hostname)); |
gethostname(hostname, sizeof (hostname)); |