bin/rip/whois_rip.c
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- error_init
- main
1 /***************************************
2 $Revision: 1.22 $
3
4 Example code: main server code.
5
6 Status: NOT REVUED, TESTED
7
8 Author: Chris Ottrey + pretty much everybody else involved :-)
9
10 +html+ <DL COMPACT>
11 +html+ <DT>Online References:
12 +html+ <DD><UL>
13 +html+ </UL>
14 +html+ </DL>
15
16 ******************/ /******************
17 Modification History:
18 ottrey (09/03/1999) Created.
19 ******************/ /******************
20 Copyright (c) 1993, 1994, 1995, 1996, 1997 The TERENA Association
21 Copyright (c) 1998 RIPE NCC
22
23 All Rights Reserved
24
25 Permission to use, copy, modify, and distribute this software and its
26 documentation for any purpose and without fee is hereby granted,
27 provided that the above copyright notice appear in all copies and that
28 both that copyright notice and this permission notice appear in
29 supporting documentation, and that the name of the author not be
30 used in advertising or publicity pertaining to distribution of the
31 software without specific, written prior permission.
32
33 THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
34 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
35 AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
36 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
37 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
38 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
39 ***************************************/
40
41 #include <signal.h>
42 #include "erroutines.h"
43 #include "constants.h"
44 #include "properties.h"
45 #include "server.h"
46 #include "bitmask.h"
47 #include "thread.h"
48 #include "memwrap.h"
49
50 #include "ca_configFns.h"
51 #include "ca_dictSyms.h"
52 #include "ca_macros.h"
53 #include "ca_srcAttribs.h"
54
55 #include "sk.h"
56
57 void error_init(int argc, char ** argv) {
/* [<][>][^][v][top][bottom][index][help] */
58 char *slash;
59 char progname[32];
60
61 slash = strrchr(argv[0],'/');
62 strncpy(progname, (slash != NULL) ? slash+1 : argv[0], 31);
63 progname[31]=0;
64
65
66 ER_init(progname, 1);
67
68 #if 0
69 /* add one more definition */
70 {
71 char *err_msg = NULL;
72 char *buf =
73 "CREATE test { FORMAT SEVCHAR|FACSYMB|TEXTLONG|DATETIME SOCK 2 }"
74 "( FAC rp ASP RP_SRCH_GEN|RP_SRCH_DET|RP_LOAD_GEN SEV d-f ) "
75 "( FAC QI|SQ ASP SQ_QRYTIME | QI_COLL_GEN SEV d-f )"
76 "( FAC PW ASP PW_I_QRYLOG SEV I-f )"
77 "( FAC ALL SEV E- )"
78 /* "( FAC SV ASP SV_PORT SEV d )" */
79 ;
80
81 int parsres = ER_parse_spec(buf, &err_msg);
82
83 if( parsres != 0 ) { /* print only on failure */
84 puts(err_msg);
85 }
86
87 wr_free(err_msg);
88
89 dieif( parsres != 0 );
90 }
91 #endif
92
93 } /* error_init() */
94
95 int main(int argc, char** argv) {
/* [<][>][^][v][top][bottom][index][help] */
96 char *prop_file_name;
97 char *consts;
98 char *props;
99 char *result;
100 sigset_t sset;
101 char *sourcesFile;
102
103 /* Initialize GLib library to be thread-safe */
104 g_thread_init(NULL);
105
106 /* Create signal handling thread and block signals for others */
107 /* printf("Starting the signal handler\n");*/
108 TH_create((void *(*)(void *))SV_signal_thread, NULL);
109
110 sigemptyset(&sset);
111 /* SIGTERM will switch the updates on and off */
112 sigaddset(&sset, SIGTERM);
113 /* SIGINT stops all servers by setting do_server to 0 */
114 sigaddset(&sset, SIGINT);
115 pthread_sigmask(SIG_BLOCK, &sset, NULL);
116
117
118 /* 1. Get the config file name from argv[1] */
119 if (argc == 2) {
120 prop_file_name = (char *)calloc(1, strlen(argv[1])+1 );
121 strcpy(prop_file_name,argv[1]);
122 } else {
123 die;
124 }
125
126 /* 3. Set the constants. */
127 /* fprintf(stderr,"Constants:\n"); */
128 result=CO_set();
129 free(result);
130
131 ca_init(prop_file_name);
132
133 /* Initialize error handling */
134 error_init(argc, argv);
135
136 /* 4. Start the server */
137 SV_start();
138
139 return(0);
140
141 } /* main() */
142