File tree Expand file tree Collapse file tree 4 files changed +23
-29
lines changed
compiled_starters/zig/src
starter_templates/zig/code/src Expand file tree Collapse file tree 4 files changed +23
-29
lines changed Original file line number Diff line number Diff line change 11const std = @import ("std" );
2+ var stdout_buffer : [1024 ]u8 = undefined ;
3+ var stdout_writer = std .fs .File .stdout ().writer (& stdout_buffer );
4+ const stdout = & stdout_writer .interface ;
25
36pub fn main () ! void {
47 var gpa = std .heap .GeneralPurposeAllocator (.{}){};
@@ -8,14 +11,9 @@ pub fn main() !void {
811 const args = try std .process .argsAlloc (allocator );
912 defer std .process .argsFree (allocator , args );
1013
11- var stdout_buffer : [1024 ]u8 = undefined ;
12- var stdout_writer = std .fs .File .stdout ().writer (& stdout_buffer );
13- const stdout = & stdout_writer .interface ;
14-
1514 if (args .len < 3 ) {
16- try stdout .print ("Usage: {s} <database_file_path> <command>\n " , .{args [0 ]});
17- try stdout .flush ();
18- return ;
15+ std .debug .print ("Usage: {s} <database_file_path> <command>\n " , .{args [0 ]});
16+ std .process .exit (1 );
1917 }
2018
2119 const database_file_path : []const u8 = args [1 ];
Original file line number Diff line number Diff line change 11const std = @import ("std" );
2+ var stdout_buffer : [1024 ]u8 = undefined ;
3+ var stdout_writer = std .fs .File .stdout ().writer (& stdout_buffer );
4+ const stdout = & stdout_writer .interface ;
25
36pub fn main () ! void {
47 var gpa = std .heap .GeneralPurposeAllocator (.{}){};
@@ -8,14 +11,9 @@ pub fn main() !void {
811 const args = try std .process .argsAlloc (allocator );
912 defer std .process .argsFree (allocator , args );
1013
11- var stdout_buffer : [1024 ]u8 = undefined ;
12- var stdout_writer = std .fs .File .stdout ().writer (& stdout_buffer );
13- const stdout = & stdout_writer .interface ;
14-
1514 if (args .len < 3 ) {
16- try stdout .print ("Usage: {s} <database_file_path> <command>\n " , .{args [0 ]});
17- try stdout .flush ();
18- return ;
15+ std .debug .print ("Usage: {s} <database_file_path> <command>\n " , .{args [0 ]});
16+ std .process .exit (1 );
1917 }
2018
2119 const database_file_path : []const u8 = args [1 ];
Original file line number Diff line number Diff line change 1- @@ -3,37 +3,33 @@
1+ @@ -1,37 +1,33 @@
2+ const std = @import("std");
3+ var stdout_buffer: [1024]u8 = undefined;
4+ var stdout_writer = std.fs.File.stdout().writer(&stdout_buffer);
5+ const stdout = &stdout_writer.interface;
6+
27 pub fn main() !void {
38 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
49 defer _ = gpa.deinit();
712 const args = try std.process.argsAlloc(allocator);
813 defer std.process.argsFree(allocator, args);
914
10- var stdout_buffer: [1024]u8 = undefined;
11- var stdout_writer = std.fs.File.stdout().writer(&stdout_buffer);
12- const stdout = &stdout_writer.interface;
13-
1415 if (args.len < 3) {
15- try stdout.print("Usage: {s} <database_file_path> <command>\n", .{args[0]});
16- try stdout.flush();
17- return;
16+ std.debug.print("Usage: {s} <database_file_path> <command>\n", .{args[0]});
17+ std.process.exit(1);
1818 }
1919
2020 const database_file_path: []const u8 = args[1];
Original file line number Diff line number Diff line change 11const std = @import ("std" );
2+ var stdout_buffer : [1024 ]u8 = undefined ;
3+ var stdout_writer = std .fs .File .stdout ().writer (& stdout_buffer );
4+ const stdout = & stdout_writer .interface ;
25
36pub fn main () ! void {
47 var gpa = std .heap .GeneralPurposeAllocator (.{}){};
@@ -8,14 +11,9 @@ pub fn main() !void {
811 const args = try std .process .argsAlloc (allocator );
912 defer std .process .argsFree (allocator , args );
1013
11- var stdout_buffer : [1024 ]u8 = undefined ;
12- var stdout_writer = std .fs .File .stdout ().writer (& stdout_buffer );
13- const stdout = & stdout_writer .interface ;
14-
1514 if (args .len < 3 ) {
16- try stdout .print ("Usage: {s} <database_file_path> <command>\n " , .{args [0 ]});
17- try stdout .flush ();
18- return ;
15+ std .debug .print ("Usage: {s} <database_file_path> <command>\n " , .{args [0 ]});
16+ std .process .exit (1 );
1917 }
2018
2119 const database_file_path : []const u8 = args [1 ];
You can’t perform that action at this time.
0 commit comments