From 7b30811eadffb466f3ec265dbfab287b8160e893 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Thu, 30 Mar 2023 12:05:49 -0700 Subject: [PATCH] argv bug fixes --- src/main.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.zig b/src/main.zig index 481b71f..e09b9d1 100644 --- a/src/main.zig +++ b/src/main.zig @@ -60,13 +60,13 @@ pub fn main() !void { } var is_filename = false; var line_number: ?usize = null; - for (args) |arg| { + for (args, 0..) |arg, i| { if (std.mem.eql(u8, "-bg", arg)) { is_filename = true; continue; } if (is_filename) { - filename = arg; + filename = args[i]; // arg capture changes value... break; } if (arg[0] == '-' and areDigits(arg[1..])) { @@ -82,9 +82,9 @@ pub fn main() !void { std.os.exit(1); } std.debug.print("line {d} text: \"{s}\"\n", .{ line, arg }); - lines[line] = &arg; + lines[line] = &args[i]; line_number = null; - break; + continue; } }