c89(CP)
c89 --
invokes the Standard C compiler
Syntax
c89 [option]
...
file
...
[option file]
...
Description
c89(CP)
is the Standard C compiler command, and is used to
compile C source code conforming to the ISO C standard.
It compiles source files named by the file arguments,
and creates executable programs by linking the compiled object
files and copying the produced executable program to a.out by
default.
The file argument must be C or assembly language source files,
object files, or library files.
Any files with a .c extension are treated as
C source files; any files with a .s extension
are treated as
assembly language source files;
and any files with a .a extension are treated as library files.
A library file can be specified in the form -l library
and a library file of the name liblibrary.a
will be searched.
The object file produced by
c89 has the same basename as the source file. The extension
of the object file is .o.
The result of a successful compilation is always copied to the object file
if the option -c is specified.
c89 invokes the Standard C compiler for each C source file.
For each assembly source file with extension .s,
c89 invokes the assembler
as(CP).
Object and library files are ignored until all
source files have been compiled or assembled.
Provided that options like -c or -E
that prevent the link editing are not used and that all files
are compiled without error,
c89 links all the object files it has created together with
object files and libraries given on the command line to
produce a single program.
The executable is a.out unless the option
-o outfile
is used,
in which case outfile will be the filename of the executable.
The file permissions of the executable is set to:
S_IRWXO | S_IRWXG | S_IRWXU
Options
The available options are:
-c-
Produce an object file for each source file.
The link editing phase is suppressed and no executable program is produced.
-g-
Include additional symbol table information for debuggers
in the output object or executable files.
-s-
Strip symbol table information not required by
exec(S)
family routines from the executable or object output files.
This option overrides the -g option if both are
specified on the command line.
-o outfile-
Use outfile as the name of the final
executable program. The default name for the executable program is
a.out.
-D name[=string]-
Define name to the preprocessor. This has the
same effect as if name were defined by
a #define statement in each source file.
name is set to the value of string if the format
``-D name=string'' is used.
Otherwise, name has the value of 1.
Multiple -D can be used on the command line.
At least 256 names and 2,048 bytes of
definitions may be defined through the -D option on the command
line.
-E-
Preprocess each C source file and
copy the result to standard output.
c89 also places a #line directive with the
current input line number and source file name at the
beginning of the output for each file.
-I directory-
Search directory for an #include file
before the standard list of directories are searched.
If the filename of the #include file is enclosed
in double quotes ("), the directory of the file containing
the #include line is searched before directory
is searched. If the filename of the #include file
is enclosed in angle brackets (< >), only directory
is searched, and then the standard list of directories are searched.
At least ten -I can be used,
but each instance of -I affects only source files appearing
after it on the command line.
Directories named in -I options are searched in the order
they appear on the command line.
-l name-
Search library file libname.a for
unresolved routine references. The placement of -l
is important: libname.a is
searched for unresolved routine references only for files
appearing before the -l name option on the command line.
The following letters in name are recognized as
standard libraries:
-l c-
Search the XPG4 conforming library libc.a.
Routines declared in
<math.h> are not searched in this library. This library
is always searched, regardless of whether the
option -l c is used.
-l m-
Search the XPG4 conforming library libm.a
for routines declared in <math.h>.
This library is searched by default.
-l l-
Search the library libl.a for all other routines
referenced by C source files produced by
lex(CP)
which are not in libc.a.
-l y-
Search the library liby.a for all other routines
referenced by C source files produced by
yacc(CP)
which are not in libc.a.
-L directory-
Search directories listed in directory for library files
before the standard list of library directories are searched.
At least ten -L options can be used.
These additional directories are searched in the same order
in which they appear on the command line.
NOTE:
If any one of the
directories following -L has files also named as libc.a,
libm.a, libl.a, or liby.a, these
library files will be searched first.
If an unresolved symbol is found in these library files, their contents will
replace those in the standard libraries.
-O-
Optimize the object code.
-U name-
Remove or un-define initially defined name.
If options -D and -U use the same name,
name will be undefined.
Environment variables
Several environment variables may be used to change the default behavior
of c89 and provide a default directory pathname for temporary
files:
LANG-
Set the default value for
all internationalization variables (of the form LC_*) that
are either null or have not been set a value.
The default value for LANG is taken from the
system configured default locale,
and this default value is used if LANG is null or has not been set.
See
locale(M)
for how to set a system default locale.
If any one of the internationalization variables has been set incorrectly,
c89 treats all these internationalization variables
as if they have not been set.
LC_ALL-
If LC_ALL has been set to a non-empty string,
it is the locale used for
all other internationalization variables even when
they are set.
LC_CTYPE-
Use this locale in mapping
sequences of bytes (in both arguments and input text files) to characters.
The mapping follows the
character classifications defined in the named locale.
LC_MESSAGES-
Use this locale for standard error messages.
The conventions are defined by the message catalogs
for this locale. Both the format and contents of diagnostic messages
may be affected by LC_MESSAGES.
NLSPATH-
A pathname template for message catalogues.
TMPDIR-
The default pathname value for a directory to hold temporary
files, if there are any.
Limits on external symbols
The first 31 bytes of an external symbol is significant to
both the compiler and link editor invoked by c89.
Each source or object file can have at least 511 external symbols.
A program can have at least a total of 4,095 external symbols.
Exit values
The c89 command returns an
exit value of 0 if no error occurred,
otherwise it returns a value greater than zero.
Diagnostics
If there is a compilation error, c89 produces an
error message and continues on to the next source file.
The link phase is suppressed if there are any compilation errors.
If the program cannot be linked successfully, an error message
is generated and c89 exits. Because any program
that detects the error may produce an error message,
some error messages may also be from the assembler or the
linker.
Files
/bin/c89-
See also
ar(CP),
as(CP),
cc(CP),
chmod(S),
ld(CP),
locale(M),
nm(CP),
strip(CP),
umask(C)
Standards conformance
c89 is conformant with:
X/Open CAE Specification, Commands and Utilities,
Issue 4, 1992.
© 2003 Commands for Programming (CP)
SCO OpenServer Release 5.0.7 -- 11 February 2003