Deleted Added
sdiff udiff text old ( 182007 ) new ( 200576 )
full compact
1/*
2 * cmd_args.c = command-line argument processing
3 */
4#ifdef HAVE_CONFIG_H
5# include <config.h>
6#endif
7
8#include "ntpd.h"

--- 73 unchanged lines hidden (view full) ---

82 if (HAVE_OPT( PANICGATE ))
83 allow_panic = TRUE;
84
85 if (HAVE_OPT( JAILDIR )) {
86#ifdef HAVE_DROPROOT
87 droproot = 1;
88 chrootdir = OPT_ARG( JAILDIR );
89#else
90 errflg++;
91#endif
92 }
93
94 if (HAVE_OPT( KEYFILE ))
95 getauthkeys(OPT_ARG( KEYFILE ));
96
97 if (HAVE_OPT( PIDFILE ))

--- 15 unchanged lines hidden (view full) ---

113 proto_config(PROTO_BROADDELAY, 0, tmp, NULL);
114 }
115 } while (0);
116
117 if (HAVE_OPT( STATSDIR ))
118 stats_config(STATS_STATSDIR, OPT_ARG( STATSDIR ));
119
120 if (HAVE_OPT( TRUSTEDKEY )) {
121 int ct = STACKCT_OPT( TRUSTEDKEY );
122 const char** pp = STACKLST_OPT( TRUSTEDKEY );
123
124 do {
125 u_long tkey;
126 const char* p = *pp++;
127
128 tkey = (int)atol(p);
129 if (tkey == 0 || tkey > NTP_MAXKEY) {
130 msyslog(LOG_ERR,

--- 5 unchanged lines hidden (view full) ---

136 } while (--ct > 0);
137 }
138
139 if (HAVE_OPT( USER )) {
140#ifdef HAVE_DROPROOT
141 char *ntp_optarg = OPT_ARG( USER );
142
143 droproot = 1;
144 user = malloc(strlen(ntp_optarg) + 1);
145 if (user == NULL) {
146 errflg++;
147 } else {
148 (void)strncpy(user, ntp_optarg, strlen(ntp_optarg) + 1);
149 group = rindex(user, ':');
150 if (group)
151 *group++ = '\0'; /* get rid of the ':' */
152 }
153#else
154 errflg++;
155#endif
156 }
157
158 if (HAVE_OPT( VAR )) {
159 int ct = STACKCT_OPT( VAR );
160 const char** pp = STACKLST_OPT( VAR );
161
162 do {
163 const char* my_ntp_optarg = *pp++;
164
165 set_sys_var(my_ntp_optarg, strlen(my_ntp_optarg)+1,
166 (u_short) (RW));
167 } while (--ct > 0);
168 }
169
170 if (HAVE_OPT( DVAR )) {
171 int ct = STACKCT_OPT( DVAR );
172 const char** pp = STACKLST_OPT( DVAR );
173
174 do {
175 const char* my_ntp_optarg = *pp++;
176
177 set_sys_var(my_ntp_optarg, strlen(my_ntp_optarg)+1,
178 (u_short) (RW | DEF));
179 } while (--ct > 0);
180 }
181
182 if (HAVE_OPT( SLEW ))
183 clock_max = 600;
184
185 if (HAVE_OPT( UPDATEINTERVAL )) {
186 long val = OPT_VALUE_UPDATEINTERVAL;
187
188 if (val >= 0)
189 interface_interval = val;
190 else {
191 msyslog(LOG_ERR,
192 "command line interface update interval %ld must be greater or equal to 0",
193 val);
194 errflg++;
195 }
196 }
197#ifdef SIM
198 if (HAVE_OPT( SIMBROADCASTDELAY ))
199 sscanf(OPT_ARG( SIMBROADCASTDELAY ), "%lf", &ntp_node.bdly);
200
201 if (HAVE_OPT( PHASENOISE ))

--- 18 unchanged lines hidden (view full) ---

220 sscanf(OPT_ARG( NDELAY ), "%lf", &ntp_node.ndly);
221
222 if (HAVE_OPT( PDELAY ))
223 sscanf(OPT_ARG( PDELAY ), "%lf", &ntp_node.pdly);
224
225#endif /* SIM */
226
227 if (errflg || argc) {
228 printf("argc is <%d>\n", argc);
229 optionUsage(myOptions, 2);
230 }
231 return;
232}