X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=platform.scm;fp=platform.scm;h=bddc67d3bbaced79a2fa4edd267f2a5a8b75e69f;hb=8519507b78d723100bca15fe0332ff99890e77fa;hp=0000000000000000000000000000000000000000;hpb=b35e568b559038a7b848f81c70ec50753dc3f736;p=scheme.git diff --git a/platform.scm b/platform.scm new file mode 100644 index 0000000..bddc67d --- /dev/null +++ b/platform.scm @@ -0,0 +1,22 @@ +(define (slurp ip) + (with-output-to-string + (lambda () + (let f () + (let ([c (read-char ip)]) + (unless (eof-object? c) + (write-char c) + (f))))))) + +(define (trim s) + (if (<= (string-length s) 0) + s + (if (char-whitespace? + (string-ref s (- (string-length s) 1))) + (trim (substring s 0 (- (string-length s) 1))) + s))) + +(define host-os + (string->symbol + (string-downcase + (trim (slurp (car (process "uname"))))))) +