summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-14 23:35:03 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-15 00:32:18 +0200
commit29ff6d9fcc05b283b6d797146330e950286028ed (patch)
tree66789441730e6b22149c953b254e7e753cee70a2 /tests
parent4d276c640374c9981dad2681f98af8c8d133939a (diff)
downloadguix-29ff6d9fcc05b283b6d797146330e950286028ed.tar.gz
syscalls: Add TIOCGWINSZ bindings.
* guix/build/syscalls.scm (TIOCGWINSZ): New macro.
(<window-size>): New record type.
(winsize): New C struct.
(winsize-struct): New variable.
(terminal-window-size, terminal-columns): New procedures.
Diffstat (limited to 'tests')
-rw-r--r--tests/syscalls.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 8e24184fe2..1b443be0c8 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -244,4 +244,17 @@
              (#f #f)
              (lo (interface-address lo)))))))
 
+(test-equal "terminal-window-size ENOTTY"
+  ENOTTY
+  (call-with-input-file "/dev/null"
+    (lambda (port)
+      (catch 'system-error
+        (lambda ()
+          (terminal-window-size port))
+        (lambda args
+          (system-error-errno args))))))
+
+(test-assert "terminal-columns"
+  (> (terminal-columns) 0))
+
 (test-end)