Skip to content

Commit

Permalink
refactor: gcov command in Makefile to run gcov as an interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jvondermarck committed Jan 2, 2024
1 parent bb6b67d commit b5cb7a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ gcov: $(GEXEC)
# generate some data for gcov by calling the generated binary with various options
find $(ROOT_DIR) -name "*.gcno" -not -path "./gcov/*" -exec mv {} $(GCOV_DIR) \;

$(GCOV_DIR)/$(GEXEC) -h
$(GCOV_DIR)/$(GEXEC) -i input -o output -v
$(GCOV_DIR)/$(GEXEC) gcov -h
$(GCOV_DIR)/$(GEXEC) gcov -i input -o output -v

find $(ROOT_DIR) -name "*.gcda" -not -path "./gcov/*" -exec mv {} $(GCOV_DIR) \;
gcov -o $(GCOV_DIR) $(GEXEC)
Expand Down
7 changes: 6 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ int main(int argc, char *argv[])
init_command_history();
init_aliases();

if (argc > 2 && (strcmp(argv[1], "-c") && strcmp(argv[1], "--command")) == 0)
// Check if the first argument is "gcov"
if (argc > 1 && strcmp(argv[1], "gcov") == 0)
{
run_interactive_mode();
}
else if (argc > 2 && (strcmp(argv[1], "-c") && strcmp(argv[1], "--command")) == 0)
{
run_batch_mode(argv, argc);
}
Expand Down

0 comments on commit b5cb7a7

Please sign in to comment.