TNS/R Native Application Migration Guide

C and C++ Migration Tasks
TNS/R Native Application Migration Guide523745-001
3-11
Replacing Calls to Obsolete C Library Guardian
Alternate-Model I/O Functions
Replacing Calls to Obsolete C Library
Guardian Alternate-Model I/O Functions
The TNS Guardian C library alternate-model I/O functions provide an I/O facility similar
to but not identical to the UNIX file descriptor model. To enable improved
interoperability between the Guardian and OSS environments, the native environment
does not support the Guardian alternate-model I/O functions. There are three options
available to programs that use the alternate-model I/O functions:
Rewrite your code to use the Open System Services (OSS) versions of these
functions.
Rewrite your code to use ANSI-model I/O functions.
Rewrite your code to call Guardian system procedures.
Using the OSS versions of these functions is usually the easiest. Instead of specifying
files in the Guardian file system using Guardian file name syntax
($VOL.SUBVOL.FILE), you specify files in the Guardian file system using OSS
pathname syntax (/G/VOL/SUBVOL/FILE). To use this option, OSS must be installed
on the system running the program. See the function’s reference page online or in the
Open System Services Library Calls Reference Manual for details.
The obsolete Guardian alternate-model I/O functions and replacement options are
listed in Table 3-2 on page 3-12.
stcu_d() Replace stcu_d() with a call to sprintf() with a %u
conversion specifier.
stpblk() Replace stpblk() with a call to strspn() with a string of
space characters.
stpbrk() Replace stpbrk() with a call to strpbrk().
stpchr() Replace stpchr() with a call to strchr(). The order and
type of parameters and the return value for these two functions
are different.
stpsym() Replace stpsym() with a call to strspn() with a string
containing alphanumeric characters. Pass the return value of
strspn() to strncpy() to copy the correct string length.
stptok() Replace stptok() with a series of calls to strtok() to find
a token and strncpy() to append a token to another string.
stscmp() Replace stscmp() with a call to strcmp().
trap_overflows() Delete trap_overflows(). The trap handling mechanism is
replaced by signals in native processes.
Table 3-1. Obsolete C Supplementary Functions (page 3 of 3)
Obsolete Function Suggested Replacement