type aliases, avoiding zeroes(), breaking a long line

pull/596/head
Kinzie 2 months ago
parent 56496e2bdb
commit a63895ab93

@ -112,7 +112,9 @@ pub fn draw(self: *Matrix) void {
dot.is_head = false;
if (MID_SCROLL_CHANGE) {
const randint = self.terminal_buffer.random.int(i16);
if (@mod(randint, 8) == 0) dot.value = @mod(randint, MAX_CODEPOINT) + MIN_CODEPOINT;
if (@mod(randint, 8) == 0) {
dot.value = @mod(randint, MAX_CODEPOINT) + MIN_CODEPOINT;
}
}
y += 1;

@ -454,7 +454,9 @@ fn addUtmpEntry(entry: *Utmp, username: [*:0]const u8, pid: c_int) !void {
entry.ut_user = username_buf;
entry.ut_host = std.mem.zeroes([256]u8);
var host: [256]u8 = undefined;
host[0] = 0;
entry.ut_host = host;
var tv: std.c.timeval = undefined;
_ = std.c.gettimeofday(&tv, null);

@ -18,6 +18,10 @@ pub const xcb = @cImport({
@cInclude("xcb/xcb.h");
});
pub const c_size = u64;
pub const c_uid = u32;
pub const c_gid = u32;
pub const c_time = c_long;
pub const tm = extern struct {
tm_sec: c_int,
tm_min: c_int,
@ -33,8 +37,8 @@ pub const passwd = extern struct {
pw_name: [*:0]u8,
pw_passwd: [*:0]u8,
pw_uid: u32,
pw_gid: u32,
pw_uid: c_uid,
pw_gid: c_gid,
pw_gecos: [*:0]u8,
pw_dir: [*:0]u8,
pw_shell: [*:0]u8,
@ -64,20 +68,20 @@ pub const O_RDWR: c_uint = 0x02;
pub extern "c" fn fileno(stream: *std.c.FILE) c_int;
pub extern "c" fn sysconf(name: c_int) c_long;
pub extern "c" fn time(second: ?*c_long) c_long;
pub extern "c" fn localtime(timer: *const c_long) *tm;
pub extern "c" fn strftime(str: [*:0]u8, maxsize: u64, format: [*:0]const u8, timeptr: *const tm) u64;
pub extern "c" fn time(second: ?*c_time) c_time;
pub extern "c" fn localtime(timer: *const c_time) *tm;
pub extern "c" fn strftime(str: [*:0]u8, maxsize: c_size, format: [*:0]const u8, timeptr: *const tm) c_size;
pub extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int;
pub extern "c" fn getenv(name: [*:0]const u8) [*:0]u8;
pub extern "c" fn putenv(name: [*:0]u8) c_int;
pub extern "c" fn clearenv() c_int;
pub extern "c" fn getuid() u32;
pub extern "c" fn getuid() c_uid;
pub extern "c" fn getpwnam(name: [*:0]const u8) ?*passwd;
pub extern "c" fn endpwent() void;
pub extern "c" fn setusershell() void;
pub extern "c" fn getusershell() [*:0]u8;
pub extern "c" fn endusershell() void;
pub extern "c" fn initgroups(user: [*:0]const u8, group: u32) c_int;
pub extern "c" fn initgroups(user: [*:0]const u8, group: c_gid) c_int;
pub extern "c" fn chdir(path: [*:0]const u8) c_int;
pub extern "c" fn execl(path: [*:0]const u8, arg: [*:0]const u8, ...) c_int;

Loading…
Cancel
Save