diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/c89/c89.1 | 125 | ||||
-rwxr-xr-x | usr.bin/c89/c89.sh | 29 |
2 files changed, 133 insertions, 21 deletions
diff --git a/usr.bin/c89/c89.1 b/usr.bin/c89/c89.1 index bd7eba1..75b4c77 100644 --- a/usr.bin/c89/c89.1 +++ b/usr.bin/c89/c89.1 @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: c89.1,v 1.1.1.1 1997/09/17 20:44:54 joerg Exp $ .\" " .Dd September 17, 1997 .Os @@ -50,23 +50,118 @@ This is the name of the C language compiler as required by the .St -p1003.2 . standard. .Pp -Since the standard demands that any program conforming to the C language -standard must be acceptable, the -.Xr cc 1 -options -.Fl ansi -and -.Fl trigraphs -are always in effect, and an attempt to call +The .Nm -with the -.Fl traditional -will be rejected. +compiler accepts the following options: +.Bl -tag -offset indent -width "-D name = value" +.It Fl c +Suppress the link-edit phase of the compilation, and do not remove any +object files that are produced. +.It Fl D Ar name Ns Op Ar =value +Define name as if by a C-language +.Ql #define +directive. If +no +.Ar =value +is given, a value of 1 will be used. The +.Fl D +option has lower precedence than the +.Fl U +option. That is, if +.Ar name +is used in both a +.Fl U +and a +.Fl D +option, +.Ar name +will be undefined regardless of the order of the options. The +.Fl D +option may be specified more than once. +.It Fl E +Copy C-language source files to the standard output, expanding all +preprocessor directives; no compilation will be performed. +.It Fl g +Produce symbolic information in the object or executable files. +.It Fl I Ar directory +Change the algorithm for searching for headers whose names are not +absolute pathnames to look in the directory named by the +.Ar directory +pathname 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 +.Ql #include +line, then in +directories named in +.Fl I +options, and last in the usual places. For +headers whose names are enclosed in angle brackets (<>), the header +will be searched for only in directories named in +.Fl I +options and then in the usual places. Directories named in +.Fl I +options shall be searched in the order specified. The +.Fl I +option may be specified more than once. +.It Fl L Ar directory +Change the algorithm of searching for the libraries named in the +.Fl l +objects to look in the directory named by the +.Ar directory +pathname before looking in the usual places. Directories named in +.Fl L +options will be searched in the order specified. The +.Fl L +option may be specified more than once. +.It Fl o Ar outfile +Use the pathname +.Ar outfile , +instead of the default +.Pa a.out , +for the executable file produced. +.It Fl O +Optimize the compilation. +.It Fl s +Produce object and/or executable files from which symbolic and other +information not required for proper execution has been removed +(stripped). +.It Fl U Ar name +Remove any initial definition of +.Ar name . +The +.Fl U +option may be specified more than once. +.El .Pp -See the manual page for -.Xr cc 1 -for a complete description. +An operand is either in the form of a pathname or the form +.Fl l +library. At least one operand of the pathname form needs to be +specified. Supported operands are of the form: +.Bl -tag -offset indent -width "-l library" +.It Pa file Ns \&.c +A C-language source file to be compiled and optionally linked. The +operand must be of this form if the +.Fl c +option is used. +.It Pa file Ns \&.a +A library of object files, as produced by +.Xr ar 1 , +passed directly to the link editor. +.It Pa file Ns \&.o +An object file produced by +.Nm +.Fl c , +and passed directly to the link editor. +.It Fl l Pa library +Search the library named +.Dl lib Ns Em library Ns \&.a +A library will be searched when its name is encountered, so the +placement of a +.Fl l +operand is significant. +.El .Sh SEE ALSO +.Xr ar 1 , .Xr cc 1 .Sh STANDARDS The diff --git a/usr.bin/c89/c89.sh b/usr.bin/c89/c89.sh index 49111f5..735dc82 100755 --- a/usr.bin/c89/c89.sh +++ b/usr.bin/c89/c89.sh @@ -24,17 +24,34 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -# $Id$ +# $Id: c89.sh,v 1.1.1.1 1997/09/17 20:44:53 joerg Exp $ # # This is the Posix.2 mandated C compiler. Basically, a hook to the # cc(1) command. -if echo "$*" | grep -q -- -traditional -then - echo "c89: non-standard C not supported by the Posix compiler version"\ - 1>&2 +usage() +{ + echo "usage: c89 [-c] [-D name[=value]] [...] [-E] [-g] [-I directory ...] + [-L directory ...] [-o outfile] [-O] [-s] [-U name ...] operand ..." 1>&2 exit 64 +} + +while getopts "cD:EgI:L:o:OsU:" opt +do + case $opt in + [cDEgILoOsU]) + ;; + *) + usage + ;; + esac +done + +if [ $(($OPTIND - 1)) = $# ] +then + echo "Missing operand" 1>&2 + usage fi -exec cc -ansi -trigraphs "$@" +exec cc -ansi -pedantic -trigraphs "$@" |