Initial commit of an unmodified 2.11BSD source tree taken from a boot tape.
[211bsd.git] / new / notes / src / talkto.c
1 #ifdef  RCSIDENT
2 static char rcsid[] = "$Header: talkto.c,v 1.7.0.1 85/03/18 20:56:55 notes Rel $";
3 #endif  RCSIDENT
4
5 /*
6  *      talkto(auth, uniq) struct auth_f *auth; struct id_d *uniq;
7  *      see if the author is a local user (by checking the sys field of
8  *      the note to see where it was written) and then grab his name from
9  *      the auth structure. If he is not "Anonymous", and is local then
10  *      we do a 'write name' command to talk with him.
11  *
12  *      Ray Essick      December 1981
13  */
14 #include "parms.h"
15 #include "structs.h"
16
17 static char *command = NULL;
18
19 talkto (auth)
20 struct auth_f  *auth;
21 {
22     char    cmdline[CMDLEN];                            /* build the command in here */
23
24     if (strcmp ("Anonymous", auth -> aname) == 0)
25         return;
26 /*
27  *      with 4.2 and later -- we might want to let this go on past
28  *      since the talk(1) program works across machine boundaries.
29  */
30     if (strcmp (Authsystem, auth -> asystem) != 0)
31         return;                                         /* hard to talk to other machine */
32     if (command == NULL && (command = getenv ("WRITE")) == NULL)
33         command = WRITE;                                /* assign default */
34     sprintf (cmdline, "%s %s", command, auth -> aname);
35     printf ("%s\n", cmdline);                           /* let him know what doing */
36
37 #ifndef FASTFORK
38     dounix (cmdline, 1, 1);                             /* run the command */
39 #else
40     dounix (1, 1, command, auth -> aname, 0, 0, 0);
41 #endif
42
43     printf ("--Hit any key to continue--");
44     gchar ();                                           /* grab character and drop it */
45 }