@@ -62,12 +62,12 @@ void print_geostore_usage(void)
6262 * ticket, attr name, attr value
6363 */
6464
65- int test_attr_reply (cmd_result_t reply_code , cmd_request_t cmd )
65+ int test_attr_reply (struct command_line * cl , cmd_result_t reply_code )
6666{
6767 int rv = 0 ;
6868 const char * op_str = "" ;
6969
70- switch (cmd ) {
70+ switch (cl -> type ) {
7171 case ATTR_SET : op_str = "set" ; break ;
7272 case ATTR_GET : op_str = "get" ; break ;
7373 case ATTR_LIST : op_str = "list" ; break ;
@@ -86,7 +86,7 @@ int test_attr_reply(cmd_result_t reply_code, cmd_request_t cmd)
8686
8787 case RLT_SYNC_SUCC :
8888 case RLT_SUCCESS :
89- if (cmd == ATTR_SET )
89+ if (cl -> type == ATTR_SET )
9090 log_info ("%s succeeded!" , op_str );
9191 rv = 0 ;
9292 break ;
@@ -98,13 +98,13 @@ int test_attr_reply(cmd_result_t reply_code, cmd_request_t cmd)
9898
9999 case RLT_INVALID_ARG :
100100 log_error ("ticket \"%s\" does not exist" ,
101- cl . attr_msg .attr .tkt_id );
101+ cl -> attr_msg .attr .tkt_id );
102102 rv = 1 ;
103103 break ;
104104
105105 case RLT_NO_SUCH_ATTR :
106106 log_error ("attribute \"%s\" not set" ,
107- cl . attr_msg .attr .name );
107+ cl -> attr_msg .attr .name );
108108 rv = 1 ;
109109 break ;
110110
@@ -149,7 +149,7 @@ static int read_server_reply(
149149 return rv ;
150150}
151151
152- int do_attr_command (struct booth_config * conf_ptr , cmd_request_t cmd )
152+ int do_attr_command (struct command_line * cl , struct booth_config * conf_ptr )
153153{
154154 struct booth_site * site = NULL ;
155155 struct boothc_header * header ;
@@ -158,12 +158,13 @@ int do_attr_command(struct booth_config *conf_ptr, cmd_request_t cmd)
158158 char * msg = NULL ;
159159
160160 assert (conf_ptr != NULL && conf_ptr -> transport != NULL );
161+ assert (cl != NULL );
161162
162- if (! * cl . site )
163+ if (* cl -> site == '\0' )
163164 site = local ;
164165 else {
165- if (!find_site_by_name (conf_ptr , cl . site , & site , 1 )) {
166- log_error ("Site \"%s\" not configured." , cl . site );
166+ if (!find_site_by_name (conf_ptr , cl -> site , & site , 1 )) {
167+ log_error ("Site \"%s\" not configured." , cl -> site );
167168 goto out_close ;
168169 }
169170 }
@@ -172,21 +173,22 @@ int do_attr_command(struct booth_config *conf_ptr, cmd_request_t cmd)
172173 if (site == local ) {
173174 log_error ("We're just an arbitrator, no attributes here." );
174175 } else {
175- log_error ("%s is just an arbitrator, no attributes there." , cl .site );
176+ log_error ("%s is just an arbitrator, no attributes there." ,
177+ cl -> site );
176178 }
177179 goto out_close ;
178180 }
179181
180182 tpt = * conf_ptr -> transport + TCP ;
181183
182- init_header (conf_ptr , & cl . attr_msg .header , cmd , 0 , cl . options , 0 , 0 ,
183- sizeof (cl . attr_msg ));
184+ init_header (conf_ptr , & cl -> attr_msg .header , cl -> type , 0 , cl -> options ,
185+ 0 , 0 , sizeof (cl -> attr_msg ));
184186
185187 rv = tpt -> open (site );
186188 if (rv < 0 )
187189 goto out_close ;
188190
189- rv = tpt -> send (conf_ptr , site , & cl . attr_msg , sendmsglen (& cl . attr_msg ));
191+ rv = tpt -> send (conf_ptr , site , & cl -> attr_msg , sendmsglen (& cl -> attr_msg ));
190192 if (rv < 0 )
191193 goto out_close ;
192194
@@ -201,7 +203,7 @@ int do_attr_command(struct booth_config *conf_ptr, cmd_request_t cmd)
201203 header = (struct boothc_header * )msg ;
202204 if (rv < 0 ) {
203205 if (rv == -1 )
204- (void )test_attr_reply (ntohl (header -> result ), cmd );
206+ (void ) test_attr_reply (cl , ntohl (header -> result ));
205207 goto out_close ;
206208 }
207209 len = ntohl (header -> length );
@@ -217,7 +219,7 @@ int do_attr_command(struct booth_config *conf_ptr, cmd_request_t cmd)
217219 rv = -1 ;
218220 goto out_close ;
219221 }
220- rv = test_attr_reply (ntohl (header -> result ), cmd );
222+ rv = test_attr_reply (cl , ntohl (header -> result ));
221223
222224out_close :
223225 if (tpt && site )
0 commit comments