mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-22 21:44:20 +02:00
FreeBSD fixes
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
b73c78d2fb
commit
7b9f03176d
2 changed files with 13 additions and 7 deletions
|
|
@ -41,8 +41,9 @@ pub const grp = @cImport({
|
|||
@cInclude("grp.h");
|
||||
});
|
||||
|
||||
// FreeBSD-specific headers
|
||||
// FreeBSD-specific headers (except for pwd.h)
|
||||
pub const logincap = @cImport({
|
||||
@cInclude("pwd.h");
|
||||
@cInclude("login_cap.h");
|
||||
});
|
||||
|
||||
|
|
@ -60,6 +61,11 @@ 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue