HP C/iX Reference Manual (31506-90011)
Chapter 8 127
Compiling and Running HP C/iX Programs
Running HP C/iX Programs
argv[0] = "MYPROG.MYGROUP.MYACCT" /* name of program */
argv[1] = "FILE1.MYGROUP.MYACCT" /* @ */
argv[2] = "FILEX.MYGROUP.MYACCT" /* @ */
argv[3] = "MYFILE.MYGROUP.MYACCT" /* @ */
argv[4] = "MYPROG.MYGROUP.MYACCT" /* @ */
argv[5] = "FILE1.MYGROUP.MYACCT" /* FILE# */
argv[6] = "FILE1.MYGROUP.MYACCT" /* FILE? */
argv[7] = "FILEX.MYGROUP.MYACCT" /* FILE? */
argv[8] = NULL
argc = 8
info = "@ FILE# FILE?"
If no files are found in the fileset, or an error occurs in attempting to expand a wildcard
fileset, a diagnostic message is printed to $STDLIST and the process terminates
immediately. Attempting to use a wildcard fileset that would expand the number of argv
elements beyond the 1023 element maximum also results in an error.
Escaping Special INFO String Characters
Special INFO string characters are characters that have special meaning to the C INFO
string parser. They include the standard I/O redirection characters <, >, and &, as well as
the fileset wildcard characters @, ?, and # if the wildcard feature is enabled. If you wish to
pass strings containing these characters into a program in the argv vectors, you must
enclose these strings with either single or double quotes. Use single quotes if your INFO
string is delimited with double quotes, and double quotes if your INFO string is delimited
with single quotes. This will disable their special functions and cause the INFO string
parser to pass them along to the main program.
Example
RUN MYPROG; INFO ="'@' '<IDENTIFIER>'"
yields:
argv[0] = "MYPROG.MYGROUP.MYACCT"
argv[1] = "@"
argv[2] = "<IDENTIFIER>"
argv[3] = NULL
argc = 3
info = "'@' '<IDENTIFIER>'"
HP C/iX and Job Control Words
When an HP C/iX program terminates normally, a special job control word, CJCW, is set to
the exit value of the program. It contains the value of the parameter passed to the C
library routine exit, or _exit, or the value returned from the function main if exit is not
explicitly called. The convention for C programs is to exit with a nonzero value if an error
condition has occurred, or exit with zero if no errors have occurred. CJCW could be used for
checking the exit value of a program in a job file, or programmatically checking the exit
value of a child process. The value of CJCW is unpredictable if the function main does not
take care to return a value or if the exit function is not explicitly called. Examples
main() {