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 1
1
const 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 ;
2
5
3
6
pub fn main () ! void {
4
7
var gpa = std .heap .GeneralPurposeAllocator (.{}){};
@@ -8,14 +11,9 @@ pub fn main() !void {
8
11
const args = try std .process .argsAlloc (allocator );
9
12
defer std .process .argsFree (allocator , args );
10
13
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
-
15
14
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 );
19
17
}
20
18
21
19
const database_file_path : []const u8 = args [1 ];
Original file line number Diff line number Diff line change 1
1
const 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 ;
2
5
3
6
pub fn main () ! void {
4
7
var gpa = std .heap .GeneralPurposeAllocator (.{}){};
@@ -8,14 +11,9 @@ pub fn main() !void {
8
11
const args = try std .process .argsAlloc (allocator );
9
12
defer std .process .argsFree (allocator , args );
10
13
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
-
15
14
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 );
19
17
}
20
18
21
19
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
+
2
7
pub fn main() !void {
3
8
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
4
9
defer _ = gpa.deinit();
7
12
const args = try std.process.argsAlloc(allocator);
8
13
defer std.process.argsFree(allocator, args);
9
14
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
-
14
15
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);
18
18
}
19
19
20
20
const database_file_path: []const u8 = args[1];
Original file line number Diff line number Diff line change 1
1
const 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 ;
2
5
3
6
pub fn main () ! void {
4
7
var gpa = std .heap .GeneralPurposeAllocator (.{}){};
@@ -8,14 +11,9 @@ pub fn main() !void {
8
11
const args = try std .process .argsAlloc (allocator );
9
12
defer std .process .argsFree (allocator , args );
10
13
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
-
15
14
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 );
19
17
}
20
18
21
19
const database_file_path : []const u8 = args [1 ];
You can’t perform that action at this time.
0 commit comments