Not a typewriter
Encyclopedia
In computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

 "Not a typewriter" or ENOTTY is an error code defined in the errno.h
Errno.h
Errno.h is a header file in the standard library of C programming language. It defines macros to report error conditions through error codes stored in a static location called errno....

 found on many Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 systems. This code is used to indicate that an attempt has been made to use a non-TTY device as a TTY device.

Details

"Typewriter" was what early UNIX
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 systems called a terminal
Terminal (telecommunication)
In the context of telecommunications, a terminal is a device which is capable of communicating over a line. Examples of terminals are telephones, fax machines, and network devices - printers and workstations....

. This usage goes all the way back to the First Edition of the Unix Programmer's Manual, dated November 3, 1971. For example, the description of the "hup
SIGHUP
On POSIX-compliant platforms, SIGHUP is a signal sent to a process when its controlling terminal is closed....

" command was "hup hangs up the phone on the typewriter which uses it." The abbreviation TTY, which occurs widely even in modern UNIX systems, stood for "Teletype." The generic term "typewriter
Typewriter
A typewriter is a mechanical or electromechanical device with keys that, when pressed, cause characters to be printed on a medium, usually paper. Typically one character is printed per keypress, and the machine prints the characters by making ink impressions of type elements similar to the pieces...

" was probably used because "Teletype" was a registered trademark of AT&T
AT&T
AT&T Inc. is an American multinational telecommunications corporation headquartered in Whitacre Tower, Dallas, Texas, United States. It is the largest provider of mobile telephony and fixed telephony in the United States, and is also a provider of broadband and subscription television services...

 subsidiary Teletype Corporation and was too specific. The name "Teletype" was derived from the more general term, "teletypewriter"; using "typewriter" was a different contraction of the same original term.

If this error code is returned, then at some point a diagnostic message may be output. Because some people consider "Not a typewriter" to be a confusing message some systems display a different confusing message such as "Inappropriate ioctl
Ioctl
In computing, ioctl, short for input/output control, is a system call for device-specific operations and other operations which cannot be expressed by regular system calls. It takes a parameter specifying a request code; the effect of a call depends completely on the request code. Request codes are...

 [input/output control] for device" instead. The real source of these confusing messages is, alas, often more subtle.

This message is usually not the result of an error related to the I/O device, but was due to the way the isatty library routine works. The error code errno is only set when a system call fails. One of the first system calls made by the C standard I/O library is in an isatty call used to determine if the program is being run interactively by a human (in which case isatty will succeed and the library will write its output a line at a time so the user sees a regular flow of text) or as part of a pipeline (in which case it writes a block at a time for efficiency). If a library routine fails for some reason unrelated to a system call (for example, because a user name wasn't found in the password file) and a naive programmer blindly calls the normal error reporting routine perror on every failure, the leftover ENOTTY will result in an utterly inappropriate "Not a typewriter" (or "Not a teletype", or "Inappropriate ioctl for device") being delivered to the user.

For many years the UNIX mail program
Mail transfer agent
Within Internet message handling services , a message transfer agent or mail transfer agent or mail relay is software that transfers electronic mail messages from one computer to another using a client–server application architecture...

 sendmail
Sendmail
Sendmail is a general purpose internetwork email routing facility that supports many kinds of mail-transfer and -delivery methods, including the Simple Mail Transfer Protocol used for email transport over the Internet....

contained this bug: when mail was delivered from another system, the mail program was (of course) being run non-interactively. If the destination address was local, but referred to a user name not found in the local password file, the message sent back to the originator of the email was the announcement that the person they were attempting to communicate with was not a typewriter.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK