diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vtcol.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/vtcol.rs b/src/vtcol.rs index e1b4d6a..361b8fe 100644 --- a/src/vtcol.rs +++ b/src/vtcol.rs @@ -21,7 +21,9 @@ const RAW_COLEXPR_SIZE: usize = 6; // e. g. 0xBADF00 type RawPalette<'a> = [&'a str; PALETTE_SIZE]; +/* XXX: can we get these into ``libc``? */ const KDGKBTYPE: libc::c_int = 0x4b33; /* kd.h */ +const GIO_CMAP: libc::c_int = 0x00004B70; /* kd.h */ const PIO_CMAP: libc::c_int = 0x00004B71; /* kd.h */ const KB_101: libc::c_char = 0x0002; /* kd.h */ const O_NOCTTY: libc::c_int = 0o0400; /* fcntl.h */ @@ -609,6 +611,20 @@ fn ioctl_pio_cmap(fd: Fd, pal: &Palette) -> Result<()> } } +fn ioctl_gio_cmap(fd: Fd) -> Result<Palette> +{ + let mut pal = Palette::new(); + + if unsafe { ioctl(fd, GIO_CMAP, std::mem::transmute(&mut pal)) } < 0 { + Err(anyhow!( + "ioctl(GIO_CMAP) failed to get current palette: {}", + Error::last_os_error() + )) + } else { + Ok(pal) + } +} + fn main() -> Result<()> { let job = Job::from_argv()?; |