Open System Services Porting Guide (G06.24+, H06.03+)

Table Of Contents
Interoperating Between User Environments
Open System Services Porting Guide520573-006
4-13
Compiling and Linking Programs From OSS
In the following example, the -o parameter limits the output to those spool jobs queued
to a specific printer location (in this case, $S.#LASER):
lpstat -o laser
These examples specify the spool destination using an alias; this is true for both lp
and lpstat utilities. The definitions of the spool location abbreviations are specified in
the /etc/printcap file. Your system administrator is responsible for setting up and
maintaining this file. If the /etc/printcap file contains the alias of laser for the
spool location $S.#LASER, then the output goes to the printer called #LASER,
controlled by the Guardian process named $S.
Compiling and Linking Programs From OSS
There are two native-mode C compilers: one runs in the OSS environment and one
runs in the Guardian environment. Each compiler compiles OSS and Guardian
programs and produces identical code. However, each compiler has different default
pragma settings.
Compiling and linking programs for the OSS environment is done using the c89 utility,
a compilation driver program. OSS uses a naming convention in which a name is
formatted into two parts, separated by a period. The first part is a name chosen by the
user; the second part is a one-letter suffix, identifying the file’s contents. For
C programming, the most common suffixes are:
Examples
The following command compiles the C source code file testprg.c. By default, c89
produces the executable a.out file:
c89 testprg.c
The Guardian equivalents to this example would be similar to the following commands,
which produces an executable file called OBJECT by default. (The code produced in
each environment is not identical, but equivalent in function.)
TNS/R native:
NMC /IN TESTPRGC, OUT LISTFILE/ AOUT; RUNNABLE
TNS/E native:
CCOMP /IN TESTPRGC, OUT LISTFILE/ AOUT; RUNNABLE
The TNS C compiler equivalent would be:
C /IN TESTPRGC, OUT LISTFILE/ AOUT; RUNNABLE, WIDE
Suffix Description
c C source file
h Header or include file
o Compiled but unbound code, usually referred to as an “object file”