In canonical mode input processing, terminal input is processed in units of lines. A line is delimited by a newline character (LF
), an end-of-file character (EOF
), or an end-of-line character (EOL
). For more information on EOF
and EOL
, see the section “Special characters”. This means that a reading program will be suspended until an entire line has been typed. Also, no matter how many bytes are requested in the read()
call, the input will comprise at most one line. It is not, however, necessary to read a whole line at once; any number of bytes, even one, may be requested in a read()
without losing information.
{MAX_CANON}
, the maximum number of bytes in a line (see limits.h
), must be greater than or equal to {_POSIX_MAX_CANON}
. If this limit is exceeded, the behavior of the system is undefined . If {MAX_CANON}
is not defined, there is no such limit (see also pathconf()
). Both constants have no effect for BS2000 block terminals, since I/O is controlled there by TIAM.
ERASE
and KILL
processing occur when either of the two special characters, the ERASE
and KILL
characters (see section “Special characters”), is read. The processing of this character affects the input buffer that has not been delimited yet by a newline character (LF
), an end-of-file character or an end-of-line character. This undelimited data constitutes the current line. The ERASE
character deletes the last character entered in the current line, provided such a character follows the start of the line. The KILL
character kills (deletes) the entire current line, if there is one, and may optionally output a new newline character. The ERASE
and KILL
characters have no effect if there is no data in the current line. The ERASE
and KILL
characters themselves are not placed in the input queue. Both characters take effect immediately after the corresponding key is pressed, independent of any backspace or tab characters that may have been entered. It is also possible to enter them directly as constants by preceding them with the escape character \
. The escape character itself is not read in this case. The deleted characters can be changed.