• Aucun résultat trouvé

STANDARDS CONFORMANCE cat: SVID2, XPG2, XPG3

Dans le document HP-UX Reference (Page 142-151)

User Commands

STANDARDS CONFORMANCE cat: SVID2, XPG2, XPG3

120 (Section 1) - 2 - HP-UX Release 7.0: September 1989

CB(1) CB(1)

NAME

cb - C program beautifier, formatter SYNOPSIS

cb [ -s

1 [

-j

1 [

-1 leng

1 [

file ...

1

DESCRIPTION

Cb reads C programs either from its arguments or from the standard input and writes them on the standard output with spacing and indentation that displays the structure of the code. Under default options, cb preserves all user new-lines. Under the -s flag cb converts the code to the canonical style of Kernighan and Ritchie in The C Programming Language. The -j flag causes split lines to be put back together. The -1 flag causes cb to split lines that are longer than [eng.

SEE ALSO cc(l).

The C Programming Language by B. W. Kernighan and D. M. Ritchie.

BUGS

Hidden punctuation in preprocessor statements causes indentation errors.

EXTERNAL INFLUENCES Environment Variables

LC_CTYPE determines the interpretation of comments and string literals as single and/or multi-byte characters.

If LC_CTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of IICII (see lang(5)) is used instead of LANG. If any internationaliza-tion variable contains an invalid setting cb behaves as if all internationalization variables are set to IICII. See environ(5).

International Code Set Support

Single- and multi-byte character code sets are supported.

CC(1) CC(1)

NAME

cc - C compiler SYNOPSIS

cc [ options ] files DESCRIPTION

Cc is the HP-UX C compiler. It accepts several types of arguments as files:

Arguments whose names end with .c are understood to be C source files. Each is compiled and the resulting object file is left in a file having the corresponding name, but suffixed with .0 instead of .c. However, if a single C file is compiled and linked all in one step, the .0 file is deleted.

Similarly, arguments whose names end with .s are understood to be assembly source files and are assembled, producing a .0 file for each .s file.

Arguments whose names end with .i are taken to be the output of cpp(l). (See the -p option below.) They are compiled without again invoking cpp(l). Each object file is left in a file having the corresponding name, but suffixed .0 instead of .i.

Arguments of the form -Ix that cause the linker to search the library libx.a in an attempt to resolve currently unresolved external references. Because a library is searched when its name is encountered, placement of a -1 is significant. If a file contains an unresolved external reference, the library containing the definition must be placed after the file on the command line. See Id(l) for further details.

All other arguments, such as those whose names end with .0 or .a, are taken to be relocatable object files that are to be included in the link operation.

Arguments and options can be passed to the compiler through the CCOPTS environment vari-able as well as on the command line. The compiler picks up the value of CCOPTS and places its contents before any arguments on the command line. For example (in sh(l) notation),

CCOPTS=~v

export CCOPTS cc -g prog.c is equivalent to

cc -v -g prog.c

When set, the TMPDIR environment variable specifies a directory to be used for temporary files, overriding the default directories jtmp and jusrjtmp.

Options

122

The following options are recognized by cc:

-Amode Specify the compilation standard to be used by the compiler. The mode can be one of the following letters:

-c

(Section 1)

c Compile in a mode compatibile with HP-UX releases prior to 7.0. (See The C Programming Language, First Edition by Kernighan and Ritchie).

This option is the default for release 7.0 of HPUX. However the default may change in future releases.

a Compile under ANSI mode (December 7, 1988 Draft proposed ANSI C standard.)

Suppress the link edit phase of the compilation, and force an object (.0) file to be produced for each .c file even if only one program is compiled. Object files produced from C programs must be linked before being executed.

- 1 - HP-UX Release 7.0: September 1989

CC(l)

Cause the compiler to generate additional information needed by the symbolic debugger. This option cancels the effect of any specified optimization options.

Prepare object files for profiling with gprof (see gprof(1)).

Change the algorithm used by the preprocessor for finding include files to also search in directory dir. See cpp(1) for details.

Refer to item (4) at the beginning of the DESCRIPTION section.

Change the algorithm used by the linker to search for libx .a. The - L option

Name the output file from the linker outfile. The default name is a.out.

Invoke the optimizer.

Arrange for the compiler to produce code that counts the number of times each routine is called. Also, if link editing takes place, replace the standard startoff routine by one that automatically calls monitor(3C) at the start and arranges to write out a mon.out file at normal termination of execution of the object pro-gram. An execution profile can then be generated by use of prof(1).

Run only cpp(1) on the named C files and leave the result on corresponding files suffixed.i. The -P option is also passed along to cpp(1).

Cause the output file from the linker to be marked as demand loadable. For details and system defaults, see Id(1).

Cause the output file from the linker to be marked as not demand loadable.

For details and system defaults, see Id(l).

Cause the output of the linker to be stripped of symbol table information. The use of this option prevents the use of a symbolic debugger on the resulting program. See Id(1) for more details.

Compile the named C files, and leave the assembly language output on corresponding files suffixed .s.

Substitute or insert subprocess x with name where x is one or more of a set of identifiers indicating the subprocess(es). This option works in two modes: 1) if x is a single identifier, name represents the full path name of the new subpro-cess; 2) if x is a set of identifiers, name represents a prefix to which the stan-dard suffixes are concatenated to construct the full path names of the new sub-processes.

CC(1)

124

CC(l)

The x can take one or more of the values:

p Preprocessor (standard suffix is cpp) c Compiler body (standard suffix is ccom)

o

Same as c

a Assembler (standard suffix is as) 1 Linker (standard suffix is Id) -Uname

Remove any initial definition of name in the preprocessor. See cpp(l) for details.

-v Enable verbose mode, which produces a step-by-step description of the compilation additional, implementation-specific options to be recognized by the compiler driver. For example, on the Series 300,

-Wc,-M

causes the compiler to generate calls to math library routines instead of inline code for the MC6881 math coprocessor. For some options, a shorthand notation for this mechan-ism can be used by placing "+" in front of the option name as in

+M

which is equivalent to the previous option example. Some other commonly used sub-process options can also be abbreviated in a similar fashion. Note that for simplicity, this shorthand must be applied to each option individually. Options that can be abbre-viated using "+" are implementation dependent, and are listed under DEPENDENCIES.

-y Generate additional information needed by static analysis tools, and ensure that the program is linked as required for static analysis. This option is incompatible with optimization.

-Y Enable support of 16-bit characters inside string literals and comments. Note that 8-bit parsing is always supported. See hpnls(5) for more details on International Support.

-z Do not bind anything to address zero. This option allows runtime detection of null pointers. See the note on pointers below.

-Z Allow dereferencing of null pointers. See the note on pointers below.

Any other options encountered generate a warning to standard error.

Other arguments are taken to be C-compatible object programs, typically produced by an earlier cc run, or perhaps libraries of C-compatible routines. These programs, together with the results of any compilations specified, are linked (in the order given) to produce an executable program with the name a.out.

The first edition of "The C Programming Language", by Kernighan and Ritchie, and the various addenda to it, are intentionally ambiguous in some areas. HP-UX specifies some of these below for compatability mode compilations.

char The char type is treated as signed by default. It may be declared unsigned.

pointers

CC(1)

Identifiers are significant up to 255 characters.

Certain programs require that a type be a specific number of bits wide. It can be assumed that an int can hold at least as much information as a short, and that a long can hold at least as much information as an int. Additionally, either an int or a long can hold a pointer.

DIAGNOSTICS

The diagnostics produced by C itself are intended to be self-explanatory. Occasional messages may be produced by the assembler or the link editor.

If any errors occur before cc is completed, a non-zero value is returned. Otherwise, zero is returned.

EXAMPLES

The following compiles the C file prog.c, to create a prog.o file, and then invoke the link editor /d(1) to link prog.o and procedure.o with all the C startup routines in /lib/crtO.o and library routines from the C library libc.a. The resulting executable program is output in prog:

cc prog.c procedure.o - 0 prog WARNINGS

Options not recognized by cc are not passed on to the link editor. The option - W l,arg can be used to pass any such option to the link editor.

By default, the return value from a C program is completely random. The only two guaranteed

The default is to allow null pointer dereferencing, hence using -Z has no effect.

The compiler supports the following options, which may also be passed to it from cc accelerator card. This code does not run unless the card is installed.

+M Cause the compiler not to generate inline code for the MC68881 math coprocessor. Library routines are referenced for matherr capability.

+N<secondary><n>

Adjust the size of internal compiler tables. The compiler uses fixed size arrays for certain internal tables. Secondary is one of the letters from the set {abdepstw}, and n is an integer value. Secondary and n are not optional. The table sizes can be re-specified using one of the secondary letters and the number n as follows:

CCO)

Maximum size of the asciz table. Default is 10000 table entries.

Maximum size of the bc table. This table saves break and con-tinue labels within loops and switch statements. Default is 100 table entries.

d Initial size of the dimtab table. This table maintains information about the definitions of all structures, unions, and arrays. Default is 1000 table entries.

Maximum size of the tasciz table. Default is 20000 table entries.

w Maximum size of the switch table stack. Default is 250 table same as subprocess c (standard suffix is cpass1).

1 Second pass of the compiler with level 2 optimization (standard suffix is cpass2).

g Level 2 global optimizer. (standard suffix is c1) 2 Peephole optimizer (standard suffix is c2)

Cause source code lines to be printed on the assembly (.s) file as assem-bly comments, thus showing the correspondence between C source and the resulting assembly code. This option is incompatible with optimiza-tion.

The default is to allow null pointer dereferencing, hence using -Z has no effect.

Nonsharable, executable files generated with the -N option cannot be executed via exec (2). For details and system defaults, see Id(l).

The compiler supports the following additional options. The +optl notation can be used as a shorthand notation for some -W options.

+a or -W d,-a When processing files which have been written in assembly language, does not assemble with the prefix file which sets up the space and sub-space structure required by the linker. Files assembled with this option cannot be linked unless they contain the equivalent information.

+e or -W c,-e Enables HP value added features while compiling in ANSI C mode, - Aa.

This option is ignored with -Ac since these features are already

(Section 1) - 5 - HP-UX Release 7.0: September 1989

CC(1)

The nesting level of each statement

The postprocessed source file with expanded macros, included files, and no user comments (unless the -C option is used).

If the -Aa option is used to compile under ANSI C, the listing will show the original source file rather than the postprocessed source file.

Print a listing as described above, but show the postprocessed source file even if one of the ANSI compilation levels is selected. This option is ineffective if the -y option is used.

+m or -W c,-m

Cause the identifier maps to be printed. First, all global identifiers are listed, then all the other identifiers are listed by function at the end of the listing. For struct and union members, the address column contains B@b, where B is the byte offset and b is the bit offset. Both Band b are in hex-adecimal.

+0

or -W c,-o Cause the code offsets to be printed in hexadecimal; they are grouped by function at the end of the listing.

+Oopt or -W c,-Oopt

Invoke optimizations selected by opt. If opt is 1, only level 1 optimiza-tions are handled. If opt is 2, all optimizations are performed. The option +02 is the same as -0. If opt is V all memory references are treated as if they were declared with the keyword "volatile," meaning that references to the object cannot be optimized away.

+r or -W c,-r Inhibits the automatic promotion of float to double when evaluating expressions and passing arguments. This option is ignored and a warning produced if the -Aa option is in effect.

2 Only warnings indicating that code generation might be affected are issued. Equivalent to the compiler default without any w opts.

3 No warnings are issued. Equivalent to the -w option.

input file object file linked output

CC(l)

startoff for profiling via prof(l) startoff for profiling via gprof(l)

standard C library, see HP-UX Reference Section (3).

pass 1 of the optimizing compiler pass 2 of the optimizing compiler

adb(l), as(l), cdb(l), cpp(l), gprof(1), Id(l), prof(l), exit(2), monitor(3C), matherr(3M).

B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall, 1978.

Draft Proposed American National Standard for Information Systems - Programming language C, December 7, 1988, Doc. No. X3Jll/88-090

EXTERNAL INFLUENCES Environment Variables

When the - Y option is invoked, LCCTYPE determines the interpretation of string literals and comments as single and/or multi-byte characters.

LANG determines the language in which messages are displayed.

If LCCTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationaliza-tion variable contains an invalid setting, cc behaves as if all internationalization variables are set to "C". See environ(5).

International Code Set Support

Single- and multi-byte character code sets are supported.

STANDARDS CONFORMANCE cc: SVID2, XPG2, XPG3

128 (Section 1) - 7 - HP-UX Release 7.0: September 1989

CD(l)

NAME

cd - change working directory SYNOPSIS

cd [ directory ] DESCRIPTION

CD(1)

If directory is not specified, the value of shell parameter $HOME is used as the new working directory. If directory specifies a complete path starting with I, " .. , directory becomes the new working directory. If neither case applies, cd tries to find the designated directory relative to one of the paths specified by the $CDP ATH shell variable. $CDP ATH has the same syntax as, and similar semantics to, the $P ATH shell variable. Cd must have execute (search) permission in directory .

Because a new process is created to execute each command, cd would be ineffective if it were written as a normal command; therefore, it is recognized and is internal to the shell.

EXAMPLES

To change the working directory to a directory at a lower level, type:

cd directoryname

To change the working directory to a directory at the same level, type:

cd .. Idirectoryname

To change from any working directory to the home directory, type:

Dans le document HP-UX Reference (Page 142-151)