__cnvblk() — Convert block

Standards

Standards / Extensions C or C++ Dependencies
z/OS® UNIX both  

Format

#define _XOPEN_SOURCE
#include <unistd.h>

void __cnvblk(char bits[8], char bytes[64], int flag);

General description

The __cnvblk() function maps an 8 character array, bits, of bits to or from a 64 character array, bytes, of bytes depending on the value of flag.

If the value of flag is 0, __cnvblk() sets all bytes in the bytes array to 0x00 for which the corresponding bits in the bits array have value 0, and it sets all bytes in the bytes array to 0x01 for which the corresponding bits in the bits array have value 1.

If the value of flag is not 0, __cnvblk() sets all bits in the bits array to 0 for which corresponding bytes in the bytes array have value 0x00, and it sets all bits in the bits array to 1 for which the corresponding bytes in the bytes array have value 0x01.

This function may be used to prepare input to setkey() or encrypt() functions and to map results back to 8 bit characters.

Returned value

If the value of flag is zero, __cnvblk() functions without error checking.

If the value of flag is nonzero, __cnvblk() checks for errors, and if found, sets errno to one of the following values:
Error Code
Description
EINVAL
The value of a byte in the array bytes is not 0x00 or 0x01.
Note: Because __cnvblk() returns no values, applications wishing to check for errors should set errno to 0, call __cnvblk(), then test errno and, if it is nonzero, assume an error has occurred.

Related information