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 {
17
17
.target = target ,
18
18
.optimize = optimize ,
19
19
});
20
- exe .install ();
21
20
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 );
23
27
run_cmd .step .dependOn (b .getInstallStep ());
24
28
if (b .args ) | args | {
25
29
run_cmd .addArgs (args );
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ pub fn main() !u8 {
10
10
}
11
11
12
12
fn 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 = "> " ;
16
16
17
- // Prompt
18
- try stdout .print ("> " , .{});
17
+ while ( true ) {
18
+ try stdout .print (prompt , .{});
19
19
20
20
// Read STDIN into buffer
21
21
var input_buffer : [max_input ]u8 = undefined ;
@@ -39,7 +39,7 @@ fn shellLoop(stdin: std.fs.File.Reader, stdout: std.fs.File.Writer) !void {
39
39
while (i <= input_str .len ) : (i += 1 ) {
40
40
if (input_buffer [i ] == 0x20 or input_buffer [i ] == 0xa ) {
41
41
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 ]) ).* ;
43
43
n += 1 ;
44
44
ofs = i + 1 ;
45
45
}
You can’t perform that action at this time.
0 commit comments