push the next MAKE1C state after a command is run. */
| 915 | |
| 916 | /* push the next MAKE1C state after a command is run. */ |
| 917 | static void push_cmds( CMDLIST * cmds, int status ) |
| 918 | { |
| 919 | CMDLIST * cmd_iter; |
| 920 | for( cmd_iter = cmds; cmd_iter; cmd_iter = cmd_iter->next ) |
| 921 | { |
| 922 | if ( cmd_iter->iscmd ) |
| 923 | { |
| 924 | CMD * next_cmd = cmd_iter->impl.cmd; |
| 925 | /* Propagate the command status. */ |
| 926 | if ( next_cmd->status < status ) |
| 927 | next_cmd->status = status; |
| 928 | if ( --next_cmd->asynccnt == 0 ) |
| 929 | { |
| 930 | /* Select the first target associated with the action. |
| 931 | * This is safe because sibling CMDs cannot have targets |
| 932 | * in common. |
| 933 | */ |
| 934 | TARGET * first_target = bindtarget( list_front( lol_get( &next_cmd->args, 0 ) ) ); |
| 935 | first_target->cmds = (char *)next_cmd; |
| 936 | push_state( &state_stack, first_target, NULL, T_STATE_MAKE1C ); |
| 937 | } |
| 938 | else if ( DEBUG_EXECCMD ) |
| 939 | { |
| 940 | TARGET * first_target = bindtarget( list_front( lol_get( &next_cmd->args, 0 ) ) ); |
| 941 | printf( "Delaying %s %s: %d targets not ready\n", object_str( next_cmd->rule->name ), object_str( first_target->boundname ), next_cmd->asynccnt ); |
| 942 | } |
| 943 | } |
| 944 | else |
| 945 | { |
| 946 | /* This is a target that we're finished updating */ |
| 947 | TARGET * updated_target = cmd_iter->impl.t; |
| 948 | if ( updated_target->status < status ) |
| 949 | updated_target->status = status; |
| 950 | updated_target->cmds = NULL; |
| 951 | push_state( &state_stack, updated_target, NULL, T_STATE_MAKE1C ); |
| 952 | } |
| 953 | } |
| 954 | } |
| 955 | |
| 956 | |
| 957 | /* |
no test coverage detected