I can answer only your first question ("what this means"). But since you
stated it as a disjunction, I feel free to post the answer, even though it's
unlikely to help you solve your problem.
"Not a typewriter" is a UNIX error value meaning that an operation which only
makes sense for ttys was attempted on a file descriptor which is connected to
something other than a tty, e.g. a normal file on disk.
Error codes like this are generally transmitted to the caller by the global
variable "errno". Some library routines set errno on error; some don't
(that's the simplified version, but it's true as stated). If you get an error
return value from a library function which is not defined as setting errno on
error but you nevertheless use errno as a guide to what error message to
report, you'll get a bizarre, unrelated error message.
What error message will you get? Well, in many cases, you'll get "not a
typewriter". This is because stdio buffering acts differently when the output
or input is connected to a tty versus a plain file. The easiest way for stdio
to check whether or not the various standard descriptors are ttys versus plain
files is to attempt to perform some tty-only operation on them. This it does,
getting the error "not a typewriter", which is useful information with which
it proceeds. At this point, errno has the value 25, meaning "Not a
typewriter".
The program now proceeds. If it encounters some kind of error of a kind which
does not modify errno, but nevertheless calls the library function perror(),
which is documented as reporting an error message according to the contents of
errno, it prints the inappropriate message "Not a typewriter". Something
wrong with an e-mail configuration in a place I used to work was once telling
a would-be e-mail user that he was not a typewriter (e.g. "mayfield: Not a
typewriter"), which he didn't actually regard as a problem and was surprised
that the computer thought otherwise.
If you are running out of memory, this might cause a "not a typewriter"
message. Some library functions in unix call various low-level functions
which do set errno, and also malloc(), which does not. If they fail for lack
of memory, they will return an error code, and errno will not be set, and the
calling program will probably call perror() and report that something is "not
a typewriter".
On the other hand, I've seen unix programs which call perror() in all sorts of
inappropriate situations, such as the failure to locate an environment
variable. A program I'm thinking of now, if you unset your HOME environment
variable, would output "HOME: Not a typewriter".
Unfortunately, all this really means is that "not a typewriter" means that the
error message is being reported incorrectly (in this case by the J-code
interpreter, I suppose). (Unless that's really the correct error message,
e.g. if you do a stty on a disk file.) So it's not a very helpful message,
and this article is probably not very helpful, but I think it does answer your
question, and I hope someone out there has found it enlightening and/or
interesting.
regards,
Alan "unrepentant unix-hacker" Rosenthal
- Jim Mayfield
mayf...@cs.umbc.edu