1#!expect --
2# Synopsis: fixcat
3# Author: Don Libes
4
5# Description: test to see if /bin/cat is unbuffered (i.e., -u is needed)
6# Return 0 if buffered, 1 if unbuffered.
7#
8# If this file is sitting in an architecture-specific library directory,
9# then it serves as a marker that your /bin/cat buffers by default.
10
11# test for when catting to/from files
12log_user 0
13spawn -open [open "|cat" "r+"]
14send "\r"
15expect "\r" {exit 1}
16
17# test for when catting to real tty
18#log_user 0
19#spawn /bin/cat
20#send "\r"
21#expect "\r\n\r\n" {exit 1}
22