eucioctl - Interface to EUC-handling modules and drivers
#include <sys/ioctl.h> #include <sys/eucioctl.h> #include
<sys/stropts.h>
ioctl(
int fd,
const I_STR,
struct strioctl *argp );
Specifies a valid file descriptor. Points to a strioctl
structure.
The eucioctl interface is used with STREAMS modules and
drivers for tty and pty devices that handle Extended UNIX
Code (EUC) code sets. This interface consists of ioctl
commands, which control character classification and conversion
related to EUC character processing.
Users issue the EUC ioctl commands to modules and drivers
by calling the STREAMS I_STR ioctl() function. (Refer to
the streamio(7) reference page for details on the use of
the STREAMS I_STR ioctl() function.)
The I_STR ioctl() function takes an argument argp that is
a pointer to a strioctl structure. The members of this
structure, as defined in the /sys/stropts.h header file,
are as follows: struct strioctl(
int ic_cmd,
int ic_timout,
int ic_len,
char *ic_dp );
The EUC ioctl commands are specified by placing one of the
following values into the ic_cmd field of the strioctl
structure. The use of the pointer field, ic_dp, depends
on the command.
The following commands are used to specify or retrieve the
character width information associated with the different
classes of EUC code sets handled in the local environment:
Sets the values for the byte widths and display widths of
the classes of EUC code set in the ldterm line discipline
module's local definition. The line discipline will use
these values for its subsequent operations. Gets the current
settings of the byte widths and display widths of the
classes of EUC code sets in the ldterm module's local definition.
For the EUC_SET and EUC_GET commands, the ic_dp pointer is
a pointer to an eucioc data structure, as defined in the
eucioctl.h header file: struct eucioc(
unsigned char eucw[4],
unsigned char scrw[4] );
The first parameter definition is the byte width of character
sets; the second is the display width of character
sets.
The ic_len field contains the size of the eucioc structure.
When using the EUC_WSET command, the user process stores
character width values in the eucioc structure, then calls
the I_STR ioctl() function to set the values for the specified
file descriptor, which must be a tty or pty device.
When issued by the user process, the EUC_WGET command gets
the values currently in use for the specified file
descriptor and stores them in the eucioc structure.
The remaining EUC ioctl commands control character code
conversion as performed by the STREAMS modules and drivers
comprising a tty or pty device stream: If the module or
driver previously saved its state and turned off input
conversion, this command reenables input conversion. If
the module or driver is performing input conversion, then
the conversion is disabled and the mode is saved. When the
EUC_IXLOFF command is used with ICANON off, it creates a
behavior roughly equivalent to raw mode. Turns output
conversion back on if previously disabled by EUC_OXLOFF.
Disables output conversion and saves the current mode status.
This command is only recognized by modules and
drivers that are not operating in ASCII mode. Saves the
current mode status and disables input and output conversion.
Restores the mode previously saved by EUC_MSAVE,
restoring the saved mode and clearing the saved state
flag.
None of the preceding commands use the ic_dp pointer.
The ldterm line discipline module provided by Tru64 UNIX
uses EUC encoding as its internal character representation.
This means that the module will only recognize data
encoded in EUC. If an application or the terminal hardware
sends character codes in other than the EUC format, these
codes must be translated into EUC before reaching the
ldterm module. Once the module finishes processing the
codes, the codes must be translated back into the format
that the application or terminal hardware handles.
If an application or the terminal hardware uses a code
other than EUC and does not perform code translation, a
code conversion module must be used to convert incoming
data from its external representation into EUC and to convert
outgoing data from EUC into the appropriate external
representation. This kind of module is known as an upper
converter when it is positioned between the stream head
and ldterm module in the device stream, and a lower converter
when it is positioned between the ldterm module and
device driver in the device stream.
If an error occurs, a value of -1 is returned, and errno
is set to indicate the error.
If any of the following conditions occurs, the EUC ioctl
commands set errno to the corresponding value: The fd
parameter is not a valid file descriptor. The fd parameter
is not a terminal device. The command or argp parameter
is not valid, or the terminal is not a STREAMS-based
device. The argp parameter or ic_dp field points to memory
that is not part of the process's address space. The
struct eucioc argument is invalid. Processing of the command
timed out.
In the following coding example, the application gets the
current settings of the EUC character widths, then changes
the settings for code set class 2 to 2 and 4 bytes for the
encoding and display widths, respectively:
#include <sys/ioctl.h> #include <sys/stropts.h> #include
<sys/eucioctl.h>
main() { struct eucioc euc, *eucp = &euc;
struct strioctl i_str;
bzero((caddr_t) eucp, sizeof(struct eucioc));
i_str.ic_cmd = EUC_WGET; i_str.ic_timout = 0;
i_str.ic_len = sizeof(struct eucioc);
i_str.ic_dp = (char *)eucp; if (ioctl(0, I_STR,
&i_str) < 0) { perror("ioctl");
exit(1); }
i_str.ic_cmd = EUC_WSET; eucp->eucw[2] = 2;
eucp->scrw[2] = 4;
if (ioctl(0, I_STR, &i_str) < 0) {
perror("ioctl"); exit(1); }
}
Contains definitions for EUC-related ioctl calls. Contains
the ioctl() call prototype. Contains the definitions
for STREAMS ioctl functions.
Commands: eucset(1)
Interfaces: ldterm(7), streamio(7)
eucioctl(7)
[ Back ] |