cat32 - Win32 program to copy stdin to stdout




The cat32(1) utility is a Win32 program that copies its standard input to standard output. It has no other options. It is sometimes used when constructing command pipelines from both Interix and Win32 commands.

The Interix subsystem has some limitations running Win32 programs and connecting their output to Interix pipes. Any access to a particular pipe end by an Interix process after a Win32 process has been given that end (through the exec(2) call) will fail, either with the [EPIPE] error, a SIGPIPE signal, or EOF.

For example, this command will show only the contents of file1:

(cmd.exe /c type file1; cat file2) | cat

The Interix cat(1) command fails, because when it tries to write to the pipe (after the Win32 command), it gets an EPIPE error.

This command will work, because a Win32 command can accept the pipe from an Interix command:

(cat file1 ; cmd.exe /c type file2) | cat

The subshell created by the parentheses fork/execs the Interix cat(1) command first; it is only after it fork/execs the Win32 command that the write end of the pipe becomes inaccessible to Interix processes.

The cat32(1) utility is a Win32 filter that can overcome many of these problems. The fix for the first command is to use cat32(1):

(cmd.exe /c type file1; cat file2 | cat32) | cat

In this case, the Interix cat is writing to a fresh, uncontaminated pipe.


The cat32(1) utility exits with status 0 for success, and >0 if an error occurred.