HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
b
blmode(3C) blmode(3C)
(TO BE OBSOLETED)
unsigned char cb_alertc; /* Alert character */
unsigned char cb_termc; /* Terminating char */
unsigned char cb_replen; /* cb_reply length */
char cb_reply[NBREPLY]; /* optional reply */
};
The cb_flags field controls the basic block-mode protocol:
CB_BMTRANS 0000001 Enable mandatory block-mode transmission.
CB_OWNTERM 0000002 Enable user control of handshake.
If CB_BMTRANS is set, all transmissions are processed as block-mode transmissions. The block-mode
handshake is not required and data read is processed as block-mode transfer data. The block-mode
handshake can still be invoked by receipt of an alert character as the first character seen. A blread()
issued with the CB_BMTRANS bit set causes any existing input buffer data to be flushed.
If CB_BMTRANS is not set, and if the alert character is defined and is detected anywhere in the input
stream, the input buffer is flushed and the block-mode handshake is invoked. The system then sends the
cb_trig2c character to the terminal, and a block-mode transfer follows. The alert character can be
escaped by preceding it with a backslash(\
).
If
CB_OWNTERM is set, reads are terminated upon receipt of a non-escaped alert character. No input
buffer flushing is performed, and the alert character is returned in the data read. This allows application
code to perform its own block-mode handshaking. If the bit is clear, a non-escaped alert character causes
normal block-mode handshaking to be used.
The initial
cb_flags value is all-bits-cleared.
There are several special characters (both input and output) that are used with block mode. These charac-
ters and the initial values for these characters are described below. Any of these characters can be
undefined by setting its value to 0377.
cb_trig1c (default DC1) is the initial trigger character sent to the terminal at the beginning of a read
request.
cb_trig2c (default DC1) is the secondary trigger character sent to the terminal after the alert charac-
ter has been seen.
cb_alertc (defaultDC2) is the alert character sent by the terminal in response to the first trigger char-
acter. It signifies that the terminal is ready to send the data block. The alert character can
be escaped by preceding it with a backslash ("\").
cb_termc (defaultRS) is sent by the terminal after the block-mode transfer has completed. It signifies
the end of the data block to the computer.
The cb_replen field specifies the length in bytes of the cb_reply field. If set to zero, the
cb_reply string is not used. The cb_replen eld is initially set to zero.
The cb_reply array contains a string to be sent out after receipt of the alert character, but before the
second trigger character is sent by the computer. Any character can be included in the reply string. The
number of characters sent is specified by cb_replen. The initial value of all characters in the
cb_reply array is NULL.
RETURNS
If an error occurs, all calls return a value of 1 and errno is set to indicate the error. If no error is
detected,
blread() returns the number of characters read. All other calls return 0 upon successful com-
pletion.
During a read, it is possible for the user’s buffer to be altered, even if an error value is returned. The data
in the user’s buffer should be ignored as it is not complete. The following errors can be returned by the
library calls indicated:
blopen()
[ENOTTY] The file descriptor specified is not related to a terminal device.
blclose()
[ENOTTY] No previous blopen has been issued for the specified file descriptor.
Section 344 3 HP-UX Release 11i: December 2000
___
___