This example translate a binary clearance to text using long words. The process running at TS A B equals the clearance and needs no privilege.
The text input and output formats, rules, and flags are presented in "Binary and Text Label Translation".
#include <tsol/label.h>
main()
{
int retval, length = 0;
bclear_t pclear;
char *string = (char *)0;
retval = getclearance(&pclear);
retval = bcleartos(&pclear, &string, length, LONG_WORDS);
printf("Process clearance = %s\n", string);
}
The printf(1) statement prints the following:
Process clearance = TS ABLE BAKER |
This example clips the process label to five characters. The clipping occurs when the number of characters in pclear is greater than the specified length.
#include <tsol/label.h>
main()
{
int retval;
bclear_t pclear;
char *string = (char *)0;
retval = getclearance(&pclear);
string = sbcleartos(&pclear, 5);
printf("Clipped process clearance = %s\n", string);
}
The printf statement prints the following. The left arrow is a clipped indicator to show the name has been clipped. The number of characters to which the name is clipped includes two characters for the clipped indicator.
Clipped process clearance = TS<- |
This example translates a text string to a binary clearance.
#include <tsol/label.h>
main()
{
int retval, error;
bclear_t bclear;
char *labelstring = "TS ABLE BAKER";
retval = stobclear(labelstring, &bclear, NEW_LABEL, &error);
if (retval == 0)
printf("Error = %d\n", error);
else
printf("Retval = %d\n", retval);
}
The printf(1) statement prints the following:
Retval = 1 |