File tree Expand file tree Collapse file tree 2 files changed +29
-10
lines changed
Expand file tree Collapse file tree 2 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -284,10 +284,32 @@ int bugz_modify_main(int argc, char **argv) {
284284 _append_modify_arg_ (remove_dependson );
285285 break ;
286286 case opt_modify_add_cc :
287- _append_modify_arg_ (add_cc );
287+ if (1 ) {
288+ char * token , * str ;
289+ str = (char * )malloc (strlen (optarg )+ 1 );
290+ strcpy (str , optarg );
291+ token = strtok (str , "," );
292+ while (token != NULL ) {
293+ bugz_modify_arguments .add_cc = \
294+ curl_slist_append (bugz_modify_arguments .add_cc , token );
295+ token = strtok (NULL , "," );
296+ }
297+ free (str );
298+ }
288299 break ;
289300 case opt_modify_remove_cc :
290- _append_modify_arg_ (remove_cc );
301+ if (1 ) {
302+ char * token , * str ;
303+ str = (char * )malloc (strlen (optarg )+ 1 );
304+ strcpy (str , optarg );
305+ token = strtok (str , "," );
306+ while (token != NULL ) {
307+ bugz_modify_arguments .remove_cc = \
308+ curl_slist_append (bugz_modify_arguments .remove_cc , token );
309+ token = strtok (NULL , "," );
310+ }
311+ free (str );
312+ }
291313 break ;
292314 case opt_modify_component :
293315 _append_modify_arg_ (component );
Original file line number Diff line number Diff line change @@ -597,18 +597,15 @@ int bugz_post_main(int argc, char **argv) {
597597 fprintf (stdout , "%-12s: %s\n" , "Assigned to" , json_object_get_string (val ));
598598 }
599599 if (bugz_post_arguments .cc ) {
600- char * q , * p , buf [ 1024 ] = { 0 } ;
600+ char * q , * p ;
601601 struct curl_slist * last = bugz_slist_get_last (bugz_post_arguments .cc );
602602 val = json_object_new_array ();
603603 p = last -> data ;
604- while ((q = strchr (p , ',' )) != NULL ){
605- memcpy (buf , p , q - p );
606- buf [q - p + 1 ] = 0 ;
607- json_object_array_add (val , json_object_new_string (buf ));
608- p = q + 1 ;
604+ q = strtok (p , "," );
605+ while (q != NULL ){
606+ json_object_array_add (val , json_object_new_string (q ));
607+ q = strtok (NULL , "," );
609608 }
610- if (strlen (p ))
611- json_object_array_add (val , json_object_new_string (p ));
612609 json_object_object_add (json , "cc" , val );
613610 fprintf (stdout , "%-12s: %s\n" , "CC" , json_object_get_string (val ));
614611 }
You can’t perform that action at this time.
0 commit comments