Trusted Solaris Developer's Guide

Regular

This example translates the binary process clearance to hexadecimal and back.

#include <tsol/label.h>

main()
{
	int          retval;
	bclear_t     hclear;
	char         *string ;

	retval = getclearance(&hclear);

	if((string = bcleartoh(&hclear)) != 0)
		printf("Hex string = %s\n", string);

	retval = htobclear(string, &hclear);
	printf("Return Value = %d\n", retval);
}

The first printf statement prints the binary clearance in the following hexadecimal format:


Hex string = 0xClearance hexadecimal value

The second printf statement prints the following where non-zero indicates a successful translation:


Return Value = 1