50 lines
1.4 KiB
Diff
50 lines
1.4 KiB
Diff
From 8bfa594bc37630956f80496106bb1d6070035570 Mon Sep 17 00:00:00 2001
|
|
From: thomasjm <tom@codedown.io>
|
|
Date: Wed, 2 Aug 2023 18:26:58 -0700
|
|
Subject: [PATCH 1/3] Fix bug in extract_filename
|
|
|
|
---
|
|
src/main.cpp | 12 ++++++------
|
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/main.cpp b/src/main.cpp
|
|
index 2ee19be..57294b4 100644
|
|
--- a/src/main.cpp
|
|
+++ b/src/main.cpp
|
|
@@ -61,19 +61,19 @@ bool should_print_version(int argc, char* argv[])
|
|
return false;
|
|
}
|
|
|
|
-std::string extract_filename(int argc, char* argv[])
|
|
+std::string extract_filename(int *argc, char* argv[])
|
|
{
|
|
std::string res = "";
|
|
- for (int i = 0; i < argc; ++i)
|
|
+ for (int i = 0; i < *argc; ++i)
|
|
{
|
|
- if ((std::string(argv[i]) == "-f") && (i + 1 < argc))
|
|
+ if ((std::string(argv[i]) == "-f") && (i + 1 < *argc))
|
|
{
|
|
res = argv[i + 1];
|
|
- for (int j = i; j < argc - 2; ++j)
|
|
+ for (int j = i; j < *argc - 2; ++j)
|
|
{
|
|
argv[j] = argv[j + 2];
|
|
}
|
|
- argc -= 2;
|
|
+ *argc -= 2;
|
|
break;
|
|
}
|
|
}
|
|
@@ -128,7 +128,7 @@ int main(int argc, char* argv[])
|
|
#endif
|
|
signal(SIGINT, stop_handler);
|
|
|
|
- std::string file_name = extract_filename(argc, argv);
|
|
+ std::string file_name = extract_filename(&argc, argv);
|
|
|
|
interpreter_ptr interpreter = build_interpreter(argc, argv);
|
|
|
|
--
|
|
2.40.1
|
|
|