@@ -67,14 +67,14 @@ void set_terminate() {
6767 * This needs to be global, because it is also accessed from the
6868 * interrupt handler.
6969 */
70- volatile unsigned int g_child_cnt = 0 ;
70+ volatile int g_child_cnt = 0 ;
7171volatile pid_t * g_child_pids = NULL ;
7272
7373/**
7474 * Unset the given pid.
7575 */
7676void child_pids_unset (pid_t cpid ) {
77- for (unsigned int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
77+ for (int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
7878 if (g_child_pids [child_idx ] == cpid ) {
7979 g_child_pids [child_idx ] = 0 ;
8080 return ;
@@ -96,7 +96,7 @@ void child_pids_print() {
9696 int poffset = 1 ;
9797 bool first = true;
9898
99- for (unsigned int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
99+ for (int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
100100 if (g_child_pids [child_idx ] == 0 ) {
101101 continue ;
102102 }
@@ -139,7 +139,7 @@ void child_pids_kill_all() {
139139 return ;
140140 }
141141
142- for (unsigned int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
142+ for (int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
143143 if (g_child_pids [child_idx ] != 0 ) {
144144 pid_t const to_kill = g_child_pids [child_idx ];
145145 ITOCHAR (skill , 16 , to_kill );
@@ -150,7 +150,7 @@ void child_pids_kill_all() {
150150}
151151
152152void child_pids_wait_all () {
153- for (unsigned int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
153+ for (int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
154154 if (g_child_pids [child_idx ] != 0 ) {
155155 pid_t const to_wait = g_child_pids [child_idx ];
156156 ITOCHAR (swait , 16 , to_wait );
@@ -321,8 +321,8 @@ int pipe_execv(command_info_t *const icmd, size_t const command_cnt,
321321 return 0 ;
322322}
323323
324- unsigned int next_running_child () {
325- for (unsigned int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
324+ int next_running_child () {
325+ for (int child_idx = 0 ; child_idx < g_child_cnt ; ++ child_idx ) {
326326 if (g_child_pids [child_idx ] != 0 ) {
327327 return child_idx ;
328328 }
@@ -451,8 +451,8 @@ int main(int argc, char *argv[]) {
451451
452452 install_signal_handler ();
453453
454- unsigned int const command_cnt = command_info_clp_count (optind , argc , argv );
455- unsigned int const pipe_cnt = pipe_info_clp_count (optind , argc , argv );
454+ int const command_cnt = command_info_clp_count (optind , argc , argv );
455+ int const pipe_cnt = pipe_info_clp_count (optind , argc , argv );
456456
457457 ITOCHAR (scommand_cnt , 16 , command_cnt );
458458 logging (lid_internal , "command_line" , "info" , "Number of commands" , 1 ,
@@ -461,7 +461,7 @@ int main(int argc, char *argv[]) {
461461 logging (lid_internal , "command_line" , "info" , "Number of pipes" , 1 ,
462462 "command_cnt" , scommand_cnt );
463463
464- unsigned int handled_args = 0 ;
464+ int handled_args = 0 ;
465465
466466 command_info_t icmd [command_cnt ];
467467 handled_args += command_info_array_constrcutor (icmd , optind , argc , argv );
@@ -475,20 +475,20 @@ int main(int argc, char *argv[]) {
475475 ITOCHAR (shandled_args , 16 , handled_args );
476476 logging (lid_internal , "command_line" , "info" , "Number of handled args" , 1 ,
477477 "handled_args" , shandled_args );
478- unsigned int const not_processed_args = argc - optind - pipe_cnt - handled_args ;
478+ int const not_processed_args = argc - optind - pipe_cnt - handled_args ;
479479 ITOCHAR (snot_processed_args , 16 , not_processed_args );
480480 logging (lid_internal , "command_line" , "info" , "Not processed args" , 1 ,
481481 "not_processed_args" , snot_processed_args );
482482
483- if (argc - optind - pipe_cnt - handled_args > 0 ) {
483+ if (not_processed_args > 0 ) {
484484 logging (lid_internal , "command_line" , "error" ,
485485 "Error: rubbish / unparsable parameters given" , 0 );
486486 usage ();
487487 }
488488
489489 // Provide memory for child_pids and initialize.
490490 pid_t child_pids [command_cnt ];
491- for (unsigned int i = 0 ; i < command_cnt ; ++ i ) {
491+ for (int i = 0 ; i < command_cnt ; ++ i ) {
492492 child_pids [i ] = 0 ;
493493 }
494494 g_child_pids = child_pids ;
0 commit comments