summaryrefslogtreecommitdiff
path: root/expect/fixcat
diff options
context:
space:
mode:
Diffstat (limited to 'expect/fixcat')
-rwxr-xr-xexpect/fixcat21
1 files changed, 21 insertions, 0 deletions
diff --git a/expect/fixcat b/expect/fixcat
new file mode 100755
index 00000000000..7a538cf7334
--- /dev/null
+++ b/expect/fixcat
@@ -0,0 +1,21 @@
+#!expect --
+# Synopsis: fixcat
+# Author: Don Libes
+
+# Description: test to see if /bin/cat is unbuffered (i.e., -u is needed)
+# Return 0 if buffered, 1 if unbuffered.
+#
+# If this file is sitting in an architecture-specific library directory,
+# then it serves as a marker that your /bin/cat buffers by default.
+
+# test for when catting to/from files
+log_user 0
+spawn -open [open "|cat" "r+"]
+send "\r"
+expect "\r" {exit 1}
+
+# test for when catting to real tty
+#log_user 0
+#spawn /bin/cat
+#send "\r"
+#expect "\r\n\r\n" {exit 1}