mtree: no more /lib and /lib/i386.
[minix.git] / commands / talkd / talkd.c
blobb7afb88f53465469959195337bd1487ec8f0c1ad
1 /* talkd.c Copyright Michael Temari 07/22/1996 All Rights Reserved */
3 #include <sys/types.h>
4 #include <stdio.h>
5 #include <string.h>
6 #include <unistd.h>
7 #include <net/gen/in.h>
9 #include "talk.h"
10 #include "talkd.h"
11 #include "net.h"
12 #include "process.h"
14 _PROTOTYPE(int main, (int argc, char *argv[]));
16 int opt_d = 0;
17 char myhostname[HOST_SIZE+1];
19 int main(argc, argv)
20 int argc;
21 char *argv[];
23 struct talk_request request;
24 struct talk_reply reply;
26 if(argc > 1)
27 if(strcmp(argv[1], "-d") || argc > 2) {
28 fprintf(stderr, "Usage: talkd [-d]\n");
29 return(-1);
30 } else
31 opt_d = 1;
33 if(getuid() != 0) {
34 fprintf(stderr, "talkd: Must be run as super user\n");
35 return(-1);
38 if(gethostname(myhostname, HOST_SIZE) < 0) {
39 fprintf(stderr, "talkd: Error getting hostname\n");
40 return(-1);
43 if(NetInit()) {
44 fprintf(stderr, "talkd: Error in NetInit\n");
45 return(-1);
48 while(getrequest(&request) == 0) {
49 if(processrequest(&request, &reply)) break;
50 if(sendreply(&request, &reply)) break;
53 return(-1);