

void print_actions(Action *act) {
    while (act != NULL) {
        if (act->args == NULL) {
            fprintf(stderr, "ERROR: action with NULL args\n");
            act = act->next_act;
            continue;
        }
        printf("\t");

        int i = 0;
        while (act->args[i] != NULL) {
            printf("%s ", act->args[i]);
            i++;
        }
        printf("\n");
        act = act->next_act;
    }
}

void print_rules(Rule *rules) {
    Rule *cur = rules;

    while (cur != NULL) {
        if (cur->dependencies || cur->actions) {
            printf("%s : ", cur->target);

            Dependency *dep = cur->dependencies;
            while (dep != NULL) {
                if (dep->rule->target == NULL) {
                    fprintf(stderr, "ERROR: dependency with NULL rule\n");
                }
                printf("%s ", dep->rule->target);
                dep = dep->next_dep;
            }
            printf("\n");

            print_actions(cur->actions);
        }
        cur = cur->next_rule;
    }
}
