Problem
cu(C) corrupts lines greater than 256 characters in length when sending files using the "~%put" command.
Cause
When cu(C) is told to transfer a file with "~%put", it spawns cat(C) on the remote machine to read the data being sent, and copy it to a file.
Usage of cat(C) means that cu(C) must configure the remote serial
driver to use canonical processing; the "icanon" mode as reported
by stty(C). This allows cat(C) to detect when the end of the file
is reached. (It does this by converting the EOF (End Of File)
character into a 0 value return code, passed back to cat(C) by the
read(S) system call.)When a serial line has "icanon" enabled, the line length is limited
to 256 bytes. If a line is longer than this, only the characters
after the last multiple of 256 are output, causing the corruption
in the file on the remote system. Solution
This problem cannot be avoided, and is a feature of the way cu(C) works.
To work around the problem, run uuencode(C) on the file before
sending it. uuencode(C)'d files always have a maximum line
length of 62 characters, and would therefore not suffer from this
problem. Use uudecode(C) to decode the file on the remote system.
This will also allow you to send binary files using cu(C).However, you can (and in most cases should) use uucp(C) to send files to remote systems using serial/modem connections.
uucp(C) has many advantages over cu(C), which include:
In-built error correction Unattended file transfer Batching of file transfers Transfer of binary files (without prior encoding)
See also
cu(C) stty(C) termio(M) cat(C) read(S) uuencode(C) uudecode(C)