.
original commit: 222d56df55f3c2dc40c1ee33eca5d934d100d609
This commit is contained in:
parent
45f3cb7ede
commit
d4ea1c265e
|
@ -1,12 +1,6 @@
|
|||
(module os mzscheme
|
||||
(require (lib "foreign.ss")) (unsafe!)
|
||||
|
||||
(define BUFFER-SIZE 1024)
|
||||
(define (extract-terminated-string proc)
|
||||
(let ([s (make-bytes BUFFER-SIZE)])
|
||||
(and (proc s BUFFER-SIZE)
|
||||
(bytes->string/utf-8 (car (regexp-match #rx#"^[^\0]*" s))))))
|
||||
|
||||
(define kernel32
|
||||
(delay (and (eq? 'windows (system-type))
|
||||
(ffi-lib "kernel32"))))
|
||||
|
@ -17,6 +11,14 @@
|
|||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; gethostbyname
|
||||
|
||||
(define BUFFER-SIZE 1024)
|
||||
(define (extract-terminated-string proc)
|
||||
(let ([s (make-bytes BUFFER-SIZE)])
|
||||
(if (proc s BUFFER-SIZE)
|
||||
(bytes->string/utf-8 (car (regexp-match #rx#"^[^\0]*" s)))
|
||||
(error 'gethostname
|
||||
"could not get hostname"))))
|
||||
|
||||
(define unix-gethostname
|
||||
(delay-ffi-obj "gethostname" #f
|
||||
(_fun _bytes _int -> _int)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user