From: Harlan Stenn Date: Wed, 16 May 2007 07:39:02 +0000 (-0400) Subject: [Bug 824] New parser code has some build problems with the SIM code. X-Git-Tag: NTP_4_2_5P34~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2af7530eb93ff37b6a09222922cc6e07d6805046;p=thirdparty%2Fntp.git [Bug 824] New parser code has some build problems with the SIM code. bk: 464ab516mHazmWsJ-m0ohZcX11m-Eg --- diff --git a/ChangeLog b/ChangeLog index 06db357f2..033b68e57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* [Bug 824] New parser code has some build problems with the SIM code. * [Bug 817] Use longnames for setting ntp variables on the command-line; Allowing '-v' with and without an arg to disambiguate usage is error-prone. diff --git a/include/ntp_config.h b/include/ntp_config.h index 06ffea126..269d8be26 100644 --- a/include/ntp_config.h +++ b/include/ntp_config.h @@ -2,9 +2,7 @@ #define __NTP_CONFIG_H__ #include "ntp_data_structures.h" -#ifdef SIM - #include "ntpsim.h" -#endif +#include "ntpsim.h" /* @@ -160,10 +158,8 @@ struct addr_opts_node *create_addr_opts_node(struct address_node *addr, queue *o struct sim_node *create_sim_node(queue *init_opts, queue *servers); struct setvar_node *create_setvar_node(char *var, char *val, u_short def); -#ifdef SIM script_info *create_sim_script_info(double duration, queue *script_queue); server_info *create_sim_server(struct address_node *addr, double server_offset, queue *script); -#endif extern struct REMOTE_CONFIG_INFO remote_config; void config_remotely(void); diff --git a/include/ntpsim.h b/include/ntpsim.h index 2546a8f0f..9be8f2990 100644 --- a/include/ntpsim.h +++ b/include/ntpsim.h @@ -30,6 +30,9 @@ /* CONSTANTS */ +#ifdef PI +# undef PI +#endif #define PI 3.1415926535 /* The world's most famous constant */ #define SIM_TIME 86400 /* end simulation time */ #define NET_DLY .001 /* network delay */ @@ -136,8 +139,4 @@ double poisson (double, double); int yyparse (void); void create_server_associations (void); - #endif - - - diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index df9dc67da..af1ebb1f2 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -60,6 +60,8 @@ HANDLE ResolverThreadHandle = NULL; #include "ntp_parser.h" #include "ntp_data_structures.h" +void yyerror (char *msg); + extern int priority_done; @@ -537,9 +539,13 @@ struct addr_opts_node *create_addr_opts_node( script_info *create_sim_script_info(double duration, queue *script_queue) { +#ifdef SIM + return NULL; +#else script_info *my_info; struct attr_val *my_attr_val; my_info = (script_info *)get_node(sizeof(script_info)); + /* XXX: check the return value... */ /* Initialize Script Info with default values*/ my_info->duration = duration; @@ -578,6 +584,7 @@ script_info *create_sim_script_info(double duration, queue *script_queue) } destroy_queue(script_queue); return (my_info); +#endif } @@ -618,6 +625,9 @@ static struct sockaddr_storage *get_next_address(struct address_node *addr) server_info *create_sim_server(struct address_node *addr, double server_offset, queue *script) { +#ifdef SIM + return NULL; +#else server_info *my_info; my_info = (server_info *) get_node(sizeof(server_info)); @@ -626,6 +636,7 @@ server_info *create_sim_server(struct address_node *addr, double server_offset, my_info->script = script; my_info->curr_script = dequeue(my_info->script); return my_info; +#endif /* SIM */ } struct sim_node *create_sim_node(queue *init_opts, queue *servers) diff --git a/ntpd/ntp_data_structures.c b/ntpd/ntp_data_structures.c index 80f0bc6d9..0ead2dd4b 100644 --- a/ntpd/ntp_data_structures.c +++ b/ntpd/ntp_data_structures.c @@ -65,7 +65,7 @@ void *get_node(size_t size) return new_node + 1; } else - return NULL; + return NULL; /* XXX: log this! */ } /* Define a function to free the allocated memory for a queue node */ diff --git a/ntpd/ntp_parser.c b/ntpd/ntp_parser.c index e24f8b1a4..12cc06097 100644 --- a/ntpd/ntp_parser.c +++ b/ntpd/ntp_parser.c @@ -1,4 +1,4 @@ -/* A Bison parser, made from /backroom/ntp-dev/A.whimsy/ntpd/../../ntpd/ntp_parser.y +/* A Bison parser, made from /deacon/backroom/ntp-dev/A.whimsy/ntpd/../../ntpd/ntp_parser.y by GNU bison 1.35. */ #define YYBISON 1 /* Identify Bison output. */ @@ -2282,7 +2282,7 @@ case 208: break; case 209: #line 892 "ntp_parser.y" -{ yyval.Sim_server = create_sim_server(yyvsp[-4].Address_node, yyvsp[-2].Double, yyvsp[-1].Queue); } +{ yyval.Sim_server = create_sim_server(yyvsp[-4].Address_node, yyvsp[-2].Double, yyvsp[-1].Queue); } break; case 210: #line 896 "ntp_parser.y" diff --git a/ntpd/ntp_parser.y b/ntpd/ntp_parser.y index c7aa507c6..5970f8974 100644 --- a/ntpd/ntp_parser.y +++ b/ntpd/ntp_parser.y @@ -889,7 +889,7 @@ sim_server_list sim_server : sim_server_name '{' sim_server_offset sim_act_list '}' - { $$ = create_sim_server($1, $3, $4); } + { $$ = create_sim_server($1, $3, $4); } ; sim_server_offset diff --git a/ntpd/ntpsim.c b/ntpd/ntpsim.c index c652bdd2f..d0e2c0c47 100644 --- a/ntpd/ntpsim.c +++ b/ntpd/ntpsim.c @@ -403,11 +403,14 @@ void sim_event_recv_packet(Event *e) /*** TODO: Need to decide on how to output for multiple servers ***/ void sim_event_beep(Event *e) { +#if 0 static int first_time = 1; char *dash = "-----------------"; +#endif + fprintf(stderr, "BEEP!!!\n"); enqueue(event_queue, event(e->time + simulation.beep_delay, BEEP)); -/* +#if 0 if(simulation.beep_delay > 0) { if (first_time) { printf("\t%4c T %4c\t%4c T+ERR %3c\t%5cT+ERR+NTP\n", @@ -423,7 +426,7 @@ void sim_event_beep(Event *e) simclock.local_time, n->time, n->clk_time, n->ntp_time); -*/ +#endif }