From d4ea1c265eda9bada625e8c148af34aad309d7b8 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 19 Apr 2005 02:40:15 +0000 Subject: [PATCH] . original commit: 222d56df55f3c2dc40c1ee33eca5d934d100d609 --- collects/mzlib/os.ss | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/collects/mzlib/os.ss b/collects/mzlib/os.ss index 262105b..e5b5313 100644 --- a/collects/mzlib/os.ss +++ b/collects/mzlib/os.ss @@ -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)))