1: #ifndef lint
2: static char *sccsid = "@(#)main.c 1.2 (Berkeley) 2/8/86";
3: #endif
4:
5: /*
6: * Network News Transfer Protocol server
7: *
8: * Phil Lapsley
9: * College of Engineering
10: * University of California, Berkeley
11: * (ARPA: phil@berkeley.edu; UUCP: ...!ucbvax!phil)
12: */
13:
14: #include "common.h"
15: #include <sys/socket.h>
16: #include <netinet/in.h>
17: #include <netdb.h>
18: #include <signal.h>
19:
20: main()
21: {
22:
23: #ifdef ALONE /* If no inetd */
24:
25: int sockt, client, length;
26: struct sockaddr_in from;
27: extern int reaper();
28:
29: disassoc();
30:
31: #ifdef FASTFORK
32: num_groups = read_groups(); /* Read active file now */
33: /* and then do it every */
34: set_timer(); /* so often later */
35: #endif
36:
37: sockt = get_socket();
38:
39: signal(SIGCHLD, reaper);
40:
41: listen(sockt, SOMAXCONN);
42:
43: for (;;) {
44: client = accept(sockt, &from, &length);
45: if (client < 0) {
46: if (errno != EINTR)
47: syslog(LOG_ERR, "nntpd: accept: %m\n");
48: continue;
49: }
50:
51: switch (fork()) {
52: case -1: syslog(LOG_ERR, "nntpd: fork: %m\n");
53: close(client);
54: break;
55:
56: case 0: close(sockt);
57: make_stdio(client);
58: serve();
59: break;
60:
61: default: close(client);
62: break;
63: }
64: }
65:
66: #else /* We have inetd */
67:
68: serve();
69:
70: #endif
71: }
Defined functions
main
defined in line
20;
never used
Defined variables
sccsid
defined in line
2;
never used