This repository was archived by the owner on Sep 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,13 @@ pub fn build(b: *std.build.Builder) void {
1717 .target = target ,
1818 .optimize = optimize ,
1919 });
20- exe .install ();
2120
22- const run_cmd = exe .run ();
21+ // This declares intent for the executable to be installed into the
22+ // standard location when the user invokes the "install" step (the default
23+ // step when running `zig build`).
24+ b .installArtifact (exe );
25+
26+ const run_cmd = b .addRunArtifact (exe );
2327 run_cmd .step .dependOn (b .getInstallStep ());
2428 if (b .args ) | args | {
2529 run_cmd .addArgs (args );
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ pub fn main() !u8 {
1010}
1111
1212fn shellLoop (stdin : std.fs.File.Reader , stdout : std.fs.File.Writer ) ! void {
13- while ( true ) {
14- const max_input = 1024 ;
15- const max_args = 10 ;
13+ const max_input = 1024 ;
14+ const max_args = 10 ;
15+ const prompt = "> " ;
1616
17- // Prompt
18- try stdout .print ("> " , .{});
17+ while ( true ) {
18+ try stdout .print (prompt , .{});
1919
2020 // Read STDIN into buffer
2121 var input_buffer : [max_input ]u8 = undefined ;
@@ -39,7 +39,7 @@ fn shellLoop(stdin: std.fs.File.Reader, stdout: std.fs.File.Writer) !void {
3939 while (i <= input_str .len ) : (i += 1 ) {
4040 if (input_buffer [i ] == 0x20 or input_buffer [i ] == 0xa ) {
4141 input_buffer [i ] = 0 ; // turn space or line feed into null byte as sentinel
42- args_ptrs [n ] = @ptrCast (* align (1 ) const [* :0 ]u8 , & input_buffer [ofs .. i :0 ]).* ;
42+ args_ptrs [n ] = @as (* align (1 ) const [* :0 ]u8 , @ptrCast ( & input_buffer [ofs .. i :0 ]) ).* ;
4343 n += 1 ;
4444 ofs = i + 1 ;
4545 }
You can’t perform that action at this time.
0 commit comments