1 From 8bfa594bc37630956f80496106bb1d6070035570 Mon Sep 17 00:00:00 2001
2 From: thomasjm <tom@codedown.io>
3 Date: Wed, 2 Aug 2023 18:26:58 -0700
4 Subject: [PATCH 1/3] Fix bug in extract_filename
7 src/main.cpp | 12 ++++++------
8 1 file changed, 6 insertions(+), 6 deletions(-)
10 diff --git a/src/main.cpp b/src/main.cpp
11 index 2ee19be..57294b4 100644
14 @@ -61,19 +61,19 @@ bool should_print_version(int argc, char* argv[])
18 -std::string extract_filename(int argc, char* argv[])
19 +std::string extract_filename(int *argc, char* argv[])
22 - for (int i = 0; i < argc; ++i)
23 + for (int i = 0; i < *argc; ++i)
25 - if ((std::string(argv[i]) == "-f") && (i + 1 < argc))
26 + if ((std::string(argv[i]) == "-f") && (i + 1 < *argc))
29 - for (int j = i; j < argc - 2; ++j)
30 + for (int j = i; j < *argc - 2; ++j)
32 argv[j] = argv[j + 2];
39 @@ -128,7 +128,7 @@ int main(int argc, char* argv[])
41 signal(SIGINT, stop_handler);
43 - std::string file_name = extract_filename(argc, argv);
44 + std::string file_name = extract_filename(&argc, argv);
46 interpreter_ptr interpreter = build_interpreter(argc, argv);