argv bug fixes
This commit is contained in:
parent
5187ccffa2
commit
7b30811ead
|
@ -60,13 +60,13 @@ pub fn main() !void {
|
||||||
}
|
}
|
||||||
var is_filename = false;
|
var is_filename = false;
|
||||||
var line_number: ?usize = null;
|
var line_number: ?usize = null;
|
||||||
for (args) |arg| {
|
for (args, 0..) |arg, i| {
|
||||||
if (std.mem.eql(u8, "-bg", arg)) {
|
if (std.mem.eql(u8, "-bg", arg)) {
|
||||||
is_filename = true;
|
is_filename = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_filename) {
|
if (is_filename) {
|
||||||
filename = arg;
|
filename = args[i]; // arg capture changes value...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (arg[0] == '-' and areDigits(arg[1..])) {
|
if (arg[0] == '-' and areDigits(arg[1..])) {
|
||||||
|
@ -82,9 +82,9 @@ pub fn main() !void {
|
||||||
std.os.exit(1);
|
std.os.exit(1);
|
||||||
}
|
}
|
||||||
std.debug.print("line {d} text: \"{s}\"\n", .{ line, arg });
|
std.debug.print("line {d} text: \"{s}\"\n", .{ line, arg });
|
||||||
lines[line] = &arg;
|
lines[line] = &args[i];
|
||||||
line_number = null;
|
line_number = null;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user