+* [Bug 1642] ntpdsim can't find simulate block in config file.
(4.2.7p55) 2010/09/22 Released by Harlan Stenn <stenn@ntp.org>
* Documentation updates from Dave Mills.
* [Bug 1636] from 4.2.6p3-RC2: segfault after denied remote config.
queue *script_queue
)
{
-#ifdef SIM
+#ifndef SIM
return NULL;
-#else
+#else /* SIM follows */
script_info *my_info;
struct attr_val *my_attr_val;
my_info->proc_delay = PROC_DLY;
/* Traverse the script_queue and fill out non-default values */
- my_attr_val = queue_head(script_queue);
- while (my_attr_val != NULL) {
+
+ for (my_attr_val = queue_head(script_queue);
+ my_attr_val != NULL;
+ my_attr_val = next_node(my_attr_val)) {
+
/* Set the desired value */
switch (my_attr_val->attr) {
}
}
return (my_info);
-#endif
+#endif /* SIM */
}
-#if !defined(SIM)
-
-#define ADDR_LENGTH 16 + 1
-
+#ifdef SIM
static sockaddr_u *
get_next_address(
struct address_node *addr
{
const char addr_prefix[] = "192.168.0.";
static int curr_addr_no = 1;
+#define ADDR_LENGTH 16 + 1 /* room for 192.168.1.255 */
char addr_string[ADDR_LENGTH];
sockaddr_u *final_addr;
struct addrinfo *ptr;
freeaddrinfo(ptr);
return final_addr;
}
-#endif /* !SIM */
+#endif /* SIM */
server_info *
queue *script
)
{
-#ifdef SIM
+#ifndef SIM
return NULL;
-#else
+#else /* SIM follows */
server_info *my_info;
my_info = get_node(sizeof *my_info);
my_info->script = script;
my_info->curr_script = dequeue(my_info->script);
return my_info;
-#endif /* SIM */
+#endif /* SIM */
}
struct sim_node *
/* special chars are their own token values */
token = ch;
/*
- * '=' implies a single string following as in:
+ * '=' outside simulator configuration implies
+ * a single string following as in:
* setvar Owner = "The Boss" default
- * This could alternatively be handled by
- * removing '=' from special_chars and adding
- * it to the keyword table.
*/
- if ('=' == ch)
+ if ('=' == ch && old_config_style)
followedby = FOLLBY_STRING;
yytext[0] = (char)ch;
yytext[1] = '\0';
if (followedby == FOLLBY_TOKEN && !instring) {
token = is_keyword(yytext, &followedby);
- if (token)
+ if (token) {
+ /*
+ * T_Server is exceptional as it forces the
+ * following token to be a string in the
+ * non-simulator parts of the configuration,
+ * but in the simulator configuration section,
+ * "server" is followed by "=" which must be
+ * recognized as a token not a string.
+ */
+ if (T_Server == token && !old_config_style)
+ followedby = FOLLBY_TOKEN;
goto normal_return;
+ }
else if (is_integer(yytext)) {
yylval_was_set = 1;
errno = 0;
)
{
parse_cmdline_opts(&argc, &argv);
+#ifdef DEBUG
+ debug = DESC(DEBUG_LEVEL).optOccCt;
+ DPRINTF(1, ("%s\n", Version));
+#endif
return ntpsim(argc, argv);
}
}
# endif
-#ifdef DEBUG
+# ifdef DEBUG
debug = DESC(DEBUG_LEVEL).optOccCt;
DPRINTF(1, ("%s\n", Version));
# endif