mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Conditionally import login_cap.h with pwd.h
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -35,18 +35,15 @@ pub const stdlib = @cImport({
|
||||
|
||||
pub const pwd = @cImport({
|
||||
@cInclude("pwd.h");
|
||||
// We include a FreeBSD-specific header here since login_cap.h references
|
||||
// the passwd struct directly, so we can't import it separately'
|
||||
if (builtin.os.tag == .freebsd) @cInclude("login_cap.h");
|
||||
});
|
||||
|
||||
pub const grp = @cImport({
|
||||
@cInclude("grp.h");
|
||||
});
|
||||
|
||||
// FreeBSD-specific headers (except for pwd.h)
|
||||
pub const logincap = @cImport({
|
||||
@cInclude("pwd.h");
|
||||
@cInclude("login_cap.h");
|
||||
});
|
||||
|
||||
// BSD-specific headers
|
||||
pub const kbio = @cImport({
|
||||
@cInclude("sys/kbio.h");
|
||||
@@ -61,11 +58,6 @@ pub const vt = @cImport({
|
||||
@cInclude("sys/vt.h");
|
||||
});
|
||||
|
||||
// On FreeBSD, login_cap.h references the passwd struct directly, so we must use logincap.passwd instead
|
||||
pub const passwd = if (builtin.os.tag == .freebsd) logincap.passwd else pwd.passwd;
|
||||
pub const endpwent = if (builtin.os.tag == .freebsd) logincap.endpwent else pwd.endpwent;
|
||||
pub const getpwnam = if (builtin.os.tag == .freebsd) logincap.getpwnam else pwd.getpwnam;
|
||||
|
||||
// Used for getting & setting the lock state
|
||||
const LedState = if (builtin.os.tag.isBSD()) c_int else c_char;
|
||||
const get_led_state = if (builtin.os.tag.isBSD()) kbio.KDGETLED else kd.KDGKBLED;
|
||||
|
||||
Reference in New Issue
Block a user