C fn definitions on Linux
parent
e9e931fe4a
commit
f4fe90ea6d
|
@ -85,6 +85,8 @@ fn C.DEFAULT_LT() bool
|
|||
fn C.DEFAULT_GE() bool
|
||||
fn C.isatty() int
|
||||
|
||||
fn C.syscall() int
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
struct C.Display
|
||||
struct C.Atom
|
||||
struct C.Window
|
||||
fn C.XFree()
|
||||
fn C.XInitThreads() int
|
||||
fn C.XCloseDisplay(d &Display)
|
||||
fn C.XFlush(d &Display)
|
||||
|
|
|
@ -752,12 +752,15 @@ fn on_segfault(f voidptr) {
|
|||
|
||||
fn C.getpid() int
|
||||
fn C.proc_pidpath (int, byteptr, int) int
|
||||
fn C.readlink() int
|
||||
|
||||
// executable return the path name of the executable that started the current process.
|
||||
|
||||
// executable returns the path name of the executable that started the current
|
||||
// process.
|
||||
pub fn executable() string {
|
||||
$if linux {
|
||||
mut result := malloc(MAX_PATH)
|
||||
count := int(C.readlink('/proc/self/exe', result, MAX_PATH ))
|
||||
count := C.readlink('/proc/self/exe', result, MAX_PATH)
|
||||
if count < 0 {
|
||||
panic('error reading /proc/self/exe to get exe path')
|
||||
}
|
||||
|
|
|
@ -34,10 +34,15 @@ enum Action {
|
|||
suspend
|
||||
}
|
||||
|
||||
fn C.tcgetattr() int
|
||||
fn C.tcsetattr() int
|
||||
fn C.ioctl() int
|
||||
fn C.raise()
|
||||
|
||||
// Toggle raw mode of the terminal by changing its attributes
|
||||
// Catches SIGUSER (CTRL+C) Signal to reset tty
|
||||
fn (r mut Readline) enable_raw_mode() {
|
||||
if ( C.tcgetattr(0, &r.orig_termios) == -1 ) {
|
||||
if C.tcgetattr(0, &r.orig_termios) == -1 {
|
||||
r.is_tty = false
|
||||
r.is_raw = false
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue