From e4adbfb0914fff443547e34eeefa9d755a179983 Mon Sep 17 00:00:00 2001 From: jruoho Date: Tue, 30 Nov 2010 20:50:28 +0000 Subject: [PATCH] Add c(7). Pillaged from FreeBSD. Written by Gabor Kovesdan. --- distrib/sets/lists/man/mi | 17 +++- share/man/man7/Makefile | 9 +- share/man/man7/c.7 | 195 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 218 insertions(+), 3 deletions(-) create mode 100644 share/man/man7/c.7 diff --git a/distrib/sets/lists/man/mi b/distrib/sets/lists/man/mi index 763508b1f4c4..859014c2abbf 100644 --- a/distrib/sets/lists/man/mi +++ b/distrib/sets/lists/man/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1256 2010/11/30 20:19:30 jruoho Exp $ +# $NetBSD: mi,v 1.1257 2010/11/30 20:50:28 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -1956,6 +1956,11 @@ ./usr/share/man/cat5/ypserv.acl.0 man-obsolete obsolete ./usr/share/man/cat7/ascii.0 man-reference-catman .cat ./usr/share/man/cat7/atf.0 man-atf-catman .cat,atf +./usr/share/man/cat7/c.0 man-reference-catman .cat +./usr/share/man/cat7/c78.0 man-reference-catman .cat +./usr/share/man/cat7/c89.0 man-reference-catman .cat +./usr/share/man/cat7/c90.0 man-reference-catman .cat +./usr/share/man/cat7/c99.0 man-reference-catman .cat ./usr/share/man/cat7/des_modes.0 man-reference-catman crypto,.cat ./usr/share/man/cat7/environ.0 man-reference-catman .cat ./usr/share/man/cat7/hier.0 man-reference-catman .cat @@ -4562,6 +4567,11 @@ ./usr/share/man/html5/wtmpx.html man-sys-htmlman html ./usr/share/man/html7/ascii.html man-reference-htmlman html ./usr/share/man/html7/atf.html man-atf-htmlman html,atf +./usr/share/man/html7/c.html man-reference-htmlman html +./usr/share/man/html7/c78.html man-reference-htmlman html +./usr/share/man/html7/c89.html man-reference-htmlman html +./usr/share/man/html7/c90.html man-reference-htmlman html +./usr/share/man/html7/c99.html man-reference-htmlman html ./usr/share/man/html7/des_modes.html man-reference-htmlman crypto,html ./usr/share/man/html7/environ.html man-reference-htmlman html ./usr/share/man/html7/hier.html man-reference-htmlman html @@ -7144,6 +7154,11 @@ ./usr/share/man/man5/ypserv.acl.5 man-obsolete obsolete ./usr/share/man/man7/ascii.7 man-reference-man .man ./usr/share/man/man7/atf.7 man-atf-man .man,atf +./usr/share/man/man7/c.7 man-reference-man .man +./usr/share/man/man7/c78.7 man-reference-man .man +./usr/share/man/man7/c89.7 man-reference-man .man +./usr/share/man/man7/c90.7 man-reference-man .man +./usr/share/man/man7/c99.7 man-reference-man .man ./usr/share/man/man7/des_modes.7 man-reference-man crypto,.man ./usr/share/man/man7/environ.7 man-reference-man .man ./usr/share/man/man7/hier.7 man-reference-man .man diff --git a/share/man/man7/Makefile b/share/man/man7/Makefile index 3008222da229..8236657ea84c 100644 --- a/share/man/man7/Makefile +++ b/share/man/man7/Makefile @@ -1,11 +1,16 @@ -# $NetBSD: Makefile,v 1.23 2010/11/30 20:19:31 jruoho Exp $ +# $NetBSD: Makefile,v 1.24 2010/11/30 20:50:28 jruoho Exp $ # @(#)Makefile 8.1 (Berkeley) 6/5/93 # missing: eqnchar.7 man.7 ms.7 term.7 -MAN= ascii.7 environ.7 hier.7 hostname.7 intro.7 mailaddr.7 \ +MAN= ascii.7 c.7 environ.7 hier.7 hostname.7 intro.7 mailaddr.7 \ nls.7 operator.7 orders.7 pkgsrc.7 release.7 \ script.7 setuid.7 signal.7 sticky.7 symlink.7 sysctl.7 \ tests.7 +MLINKS+=c.7 c78.7 \ + c.7 c89.7 \ + c.7 c90.7 \ + c.7 c99.7 + .include diff --git a/share/man/man7/c.7 b/share/man/man7/c.7 new file mode 100644 index 000000000000..23f23cadc2ad --- /dev/null +++ b/share/man/man7/c.7 @@ -0,0 +1,195 @@ +.\" +.\" +.\" Copyright (C) 2007, 2010 Gabor Kovesdan. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD: src/share/man/man7/c99.7,v 1.1 2010/06/17 12:05:47 gabor Exp $ +.\" +.Dd November 30, 2010 +.Dt C 7 +.Os +.Sh NAME +.Nm c, c78, c89, c90, c99 +.Nd The C programming language +.Sh DESCRIPTION +C is a general purpose programming language, which has a strong connection +with the UNIX operating system and its derivatives, since the vast +majority of those systems were written in the C language. +The C language contains some basic ideas from the BCPL language through +the B language written by Ken Thompson in 1970 for the DEC PDP-7 machines. +The development of the UNIX operating system was started on a PDP-7 +machine in assembly language, but it made very difficult to port the existing +code to other systems. +.Pp +In 1972 Dennis M. Ritchie worked out the C programming language for +further development of the UNIX operating system. +The idea was to implement only the C compiler for different +platforms, and implement most part of the operating system +in the new programming language to simplify the portability between +different architectures. +It follows that C is very eligible for (but not limited to) writing +operating systems and low-level applications. +.Pp +The C language did not have a specification or standardized version for +a long time. +It went through a lot of changes and improvements for ages. +In 1978, Brian W. Kernighan and Dennis M. Ritchie published the +first book about C under the title "The C Programming Language". +We can think of this book as the first specification of the language. +This version is often referred as K&R C after the names of the authors. +Sometimes it is referred as C78, as well, after the publishing year of +the first edition of the book. +.Pp +It is important to notice, that the instruction set of the language is +limited to the most fundamental elements for simplicity. +Handling of the standard I/O and such common functions are implemented in +the libraries shipped with the compiler. +As these functions are also widely used, it was demanded to include into +the description what requisites the library should conform to, not just +strictly the language itself. +Accordingly, the aforementioned standards cover the library elements, as well. +The elements of this standard library is still not enough for more +complicated tasks. +In this case the provided system calls of the given operating system can be +used. +To not loose the portability by using these system calls, the POSIX +(Portable Operating System Interface) standard evolved. +It describes what functions should be available to keep portability. +Note, that POSIX is not a C standard, but an operating system standard +and thus is beyond the scope of this manual. +The standards discussed below are all C standards and only cover +the C programming language and the accompanying library. +.Pp +After the publication of the book mentioned before, +the American National Standards Institute (ANSI) started to work on +standardizing the language, and they announced ANSI X3.159-1989 +in 1989. +It is usually referred as ANSI C or C89. +The main difference in this standard were the function prototypes, +which is a new way of declaring functions. +With the old-style function declarations, the compiler was unable to +check the sanity of the actual parameters at a function call. +The old syntax was highly error-prone because incompatible parameters +were hard to detect in the program code and the problem only showed up +at run-time. +.Pp +In 1990, the International Organization for Standardization (ISO) adopted +the ANSI standard as ISO/IEC 9899:1990 in 1990. +This is also referred as ISO C or C90. +It only contains negligible minor modifications against ANSI C, +so the two standards often considered to be fully equivalent. +This was a very important milestone in the history of the C language, but the +development of the language did not stop. +.Pp +The ISO C standard was later extended with an amendment as +ISO/IEC 9899 AM1 in 1995. +This contained, for example, the wide-character support in wchar.h and +wctype.h. +Two corregenda were also published: Technical Corrigendum 1 as +ISO/IEC 9899 TCOR1 in 1995 and Technical Corrigendum 2 as ISO/IEC 9899 TCOR1 +in 1996. +The continuous development and growth made it necessary to work out a new +standard, which contains the new features and fixes the known defects and +deficiencies of the language. +As a result, ISO/IEC 9899:1999 was born in 1999. +Similarly to the other standards, this is referred after the +publication year as C99. +The improvements include the following: +.Bl -bullet -offset indent +.It +Inline functions +.It +Support for variable length arrays +.It +New high-precision integer type named long long int, and other integer types +defined in stdint.h +.It +New boolen data type implemented in stdbool.h +.It +One line comments taken from the C++ language +.It +Some new preprocessor features +.It +New variables can be declared anywhere, not just in the beginning of the +program or program blocks +.It +No implicit int type +.El +.Pp +Since then new standards have not been published, but the C language is still +evolving. +New and useful features have been showed up in the most famous +C compiler: GNU C. +Most of the UNIX-like operating systems use GNU C as a system compiler, +but those addition in GNU C should not be considered as +standard features. +.Sh SEE ALSO +.Xr cc 1 , +.Xr c89 1 , +.Xr c99 1 +.Rs +.%A Brian W. Kernighan +.%A Dennis M. Ritchie +.%B The C Programming Language +.%D 1988 +.%N Second Edition, 40th printing +.%I Prentice Hall +.Re +.Sh STANDARDS +.Rs +.%A ANSI +.%T X3.159-1989 +.Re +.Pp +.Rs +.%A ISO/IEC +.%T 9899:1990, Programming languages -- C +.Re +.Pp +.Rs +.%A ISO/IEC +.%T 9899 AM1 +.Re +.Pp +.Rs +.%A ISO/IEC +.%T 9899 TCOR1, Programming languages -- C, Technical Corrigendum 1 +.Re +.Pp +.Rs +.%A ISO/IEC +.%T 9899 TCOR2, Programming languages -- C, Technical Corrigendum 2 +.Re +.Pp +.Rs +.%A ISO/IEC +.%T 9899:1999, Programming languages -- C +.Re +.Sh HISTORY +This manual page first appeared in +.Fx 9.0 +and +.Nx 6.0 . +.Sh AUTHORS +This manual page was written by +.An Gabor Kovesdan Aq gabor@FreeBSD.org .