svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
c99(1)
c99(1) User Commands c99(1)
NAME
c99 - compile standard C programs
SYNOPSIS
c99 [-c] [-Dname[=tokens]] [-E] [-g] [-Idirectory]
[-Ldirectory] [-Ooptlevel] [-ooutfile] [-s] [-Uname]
DESCRIPTION
This release of the c99 utility is compliant with the Standard for
Information Technology - Portable Operating System Interface (POSIX(R))
Shell and Utilities, Issue 6 (Volume 1: A to J) Approved 12 September
2001.
The c99 utility is an interface to the standard C compilation system;
it will accept source code conforming to the ISO C standard. The system
conceptually consists of a compiler and link editor. The files refer‐
enced by operands will be compiled and linked to produce an executable
file.
If the -c option is specified, for all pathname operands of the form
file.c,the files:
$(basename pathname .c).o
will be created as the result of successful compilation.
If there are no options that prevent link editing (such as -c or -E),
and all operands compile and link without error, the resulting exe‐
cutable file will be written according to the -o outfile option (if
present) or to the file a.out.
The file permissions for the executable file that is created are set
to:
S_IRWXO | S_IRWXG | S_IRWXU
and the bits specified by the umask of the process are cleared.
OPTIONS
The following affect the options for the c99 utility:
o The -l library operands have the format of options, but
their position within a list of operands affects the order
in which libraries are searched.
o The order of specifying the -I and -L options is signifi‐
cant.
o Portable applications must specify each option separately;
that is, grouping option letters (for example, -cO) need not
be recognized by all implementations.
The following options are supported:
-c
Suppress the link-edit phase of the compilation, and do not remove
any object files that are produced.
-D name[=value]
Define name as if by a C-language #define directive. If no =value
is given, a value of 1 will be used. The -D option has lower prece‐
dence than the -U option; that is, if name is used in both a -U and
a -D option, name will be undefined regardless of the order of the
options. c99 supports at least 2048 bytes of -D definitions and 256
names.
The following predefined names are valid in all modes:
__sparc (SPARC)
__i386 (x86)
__unix
__sun
__BUILTIN_VA_ARG_INCR
__SUNPRO_C=0x500
__SVR4
The following names are not predefined:
unix
sparc (SPARC)
i386 (x86)
sun
-E
Copy C-language source files to standard output, expanding all pre‐
processor directives; no compilation will be performed. An error
will occur if any operand is not a text file.
-g
Produce symbolic information in the object or executable files.
-I directory
Change the algorithm for searching for headers whose names are not
absolute pathnames to look in the directory named by the directory
path name before looking in the usual places. Thus, headers whose
names are enclosed in double-quotes ("") will be searched for first
in the directory of the file with the #include line, then in direc‐
tories named in -I options, and last in the usual places. For head‐
ers whose names are enclosed in angle brackets (<>), the header
will be searched for only in directories named in -I options and
then in the usual places. Directories named in -I options will be
searched in the order specified.
-L directory
Change the algorithm of searching for the libraries named in the -l
objects to look in the directory named by the directory path name
before looking in the usual places. Directories named in -L options
will be searched in the order specified.
-O optlevel
Specify the level of code optimization. If the optlevel option-
argument is the digit 0, all special code optimizations are dis‐
abled. See the cc(1) manpage for a description of the optimization
levels.
-o outfile
Use the pathname outfile, instead of the default a.out, for the
executable file produced. This option cannot be used with -c or -E.
-s
Produce object or executable files, or both, from which symbolic
and other information not required for proper execution using the
exec family has been removed (stripped). If both -g and -s options
are present, -s overrides -g.
-U name
Remove any initial definition of name.
Multiple instances of the -D, -I, -U, and -L options can be specified.
OPERANDS
An operand is either in the form of a path name or the form -l
library. At least one operand of the path name form must be specified.
The following operands are supported:
file.c
A C-language source file to be compiled and optionally linked. The
operand must be of this form if the -c option is used.
file.a
A library of object files typically produced by the ar(1) utility,
and passed directly to the link editor.
file.o
An object file produced by c99 -c and passed directly to the link
editor.
-l library
(The letter ell.) Search the library named liblibrary.a.
A library will be searched when its name is encountered, so the
placement of a -l operand is significant. Several standard
libraries can be specified in this manner. See Standard Libraries
in NOTES below.
USAGE
Since the c99 utility usually creates files in the current directory
during the compilation process, it is typically necessary to run the
c99 utility in a directory in which a file can be created.
c99 creates .o files when -c is not specified and more than one source
file is given.
Some historical implementations have permitted -L options to be inter‐
spersed with -l operands on the command line. For an application to
compile consistently on systems that do not behave like this, it is
necessary for a portable application to supply all -L options before
any of the -l options.
There is the possible implication that if a user supplies versions of
the standard library functions (before they would be encountered by an
implicit -l c or explicit -l m), that those versions would be used in
place of the standard versions. There are various reasons this might
not be true (functions defined as macros, manipulations for clean name
space, and so forth), so the existence of files named in the same man‐
ner as the standard libraries within the -L directories is explicitly
stated to produce unspecified behavior.
Setting the environment variable TMPDIR overrides the default temporary
directory.
OUTPUT
STDOUT
If more than one file operand ending in .c is given, for each such
file:
"%s:\n", <file>
may be written. These messages, if written, will precede the processing
of each input file; they will not be written to the standard output if
they are written to the standard error, as described in STDERR.
If the -E option is specified, the standard output will be a text file
that represents the results of the preprocessing stage of the language;
it may contain extra information appropriate for subsequent compilation
passes.
STDERR
Used only for diagnostic messages. If more than one file operand ending
in .c (or possibly other unspecified suffixes) is given, for each such
file:
"%s:\n", <file>
may be written to allow identification of the diagnostic and warning
messages with the appropriate input file. These messages, if written,
will precede the processing of each input file; they will not be writ‐
ten to the standard error if they are written to the standard output,
as described in STDOUT.
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables
that affect the execution of c99: LANG, LC_ALL,
LC_TYPE, LC_MESSAGES, and NLSPATH.
TMPDIR
Provide a path name that will override the default directory for
temporary files, if any.
EXIT STATUS
The following exit values are returned:
0 Successful compilation or link edit.
>0 An error occurred.
When c99 encounters a compilation error that causes an object file not
to be created, it will write a diagnostic to standard error and con‐
tinue to compile other source code operands, but it will not perform
the link phase and will return a non-zero exit status. If the link edit
is unsuccessful, a diagnostic message will be written to standard error
and c99 will exit with a non-zero status. A portable application must
rely on the exit status of c99, rather than on the existence or mode of
the executable file.
EXAMPLES
The following are examples of usage:
c99 -o foo foo.c
Compiles foo.c and creates the executable file foo.
c99 -c foo.c
Compiles foo.c and creates the object file foo.o.
c99 foo.c
Compiles foo.c and creates the executable file a.out.
c99 foo.c bar.o
Compiles foo.c, links it with bar.o, and creates the executable
file a.out. Also creates and leaves foo.o.
The following examples clarify the use and interactions of -L options
and -l operands: Consider the case in which module a.c calls function f
in library libQ.a, and module b.c calls function g in library libp.a.
Assume that both libraries reside in /a/b/c. The command line to com‐
pile and link in the desired way is:
c89 -L /a/b/c main.o a.c -l Q b.c -l p
In this case the -l Q operand need only precede the first -l p operand,
since both libQ.a and libp.a reside in the same directory. Multiple -L
operands can be used when library name collisions occur. Building on
the previous example, suppose that the user wants to use a new libp.a,
in /a/a/a, but still wants f from /a/b/c/libQ.a:
c89 -L /a/a/a -L /a/b/c main.o a.c -l Q b.c -l p
In this example, the linker searches the -L options in the order speci‐
fied, and finds /a/a/a/libp.a before /a/b/c/libp.a when resolving ref‐
erences for b.c. The order of the -l operands is still important, how‐
ever.
SEE ALSO
ar(1), cc(1), nm(1), strip(1), umask(1), environ(5)
NOTES
Standard Libraries
The c99 utility recognizes the following -l operands for standard
libraries:
-l c
This library contains all library functions except for those func‐
tions listed as residing in <math.h>. This operand is not required
to be present to cause a search of this library.
-l m
This library contains all functions referenced in math.h. An imple‐
mentation may search this library in the absence of this operand.
-l l
This library contains all functions required by the C-language out‐
put of lex that are not made available through the -l c operand.
-l pthread
This operand makes visible all functions referenced in <pthread.h>
and pthread_atfork() referenced in <unistd.h>. An implementation
may search this library in the absence of this operand.
-l rt
This operand makes visible all functions referenced in <aio.h>,
<mqueue.h>, <sched.h>, and <time.h>. An implementation may search
this library in the absence of this operand.
-l y
This library contains all functions required by the C-language out‐
put of yacc that are not made available through the -l c operand.
In the absence of options that inhibit invocation of the link editor,
such as -c or -E, the c99 utility will cause the equivalent of a -l c
operand to be passed to the link editor as the last -l operand, causing
it to be searched after all other object files and libraries are
loaded.
External Symbols
The C compiler and link editor support the significance of external
symbols up to a length of at least 31 bytes.
The compiler and link editor support a minimum of 511 external symbols
per source or object file, and a minimum of 4095 external symbols in
total. A diagnostic message will be written to the standard output if
the limit is exceeded.
Studio 12.6 2004/07/30 Release c99(1)