Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
C standard library
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Standardization == {{Main article|C (programming language)#History|l1=C (programming language) § History}} The original [[C (programming language)|C language]] provided no built-in functions such as I/O operations, unlike traditional languages such as [[COBOL]] and [[Fortran]].{{Citation needed|date=November 2010}} Over time, user communities of C shared ideas and implementations of what is now called C standard libraries. Many of these ideas were incorporated eventually into the definition of the standardized C language. Both [[Unix]] and C were created at [[Bell Labs|AT&T's Bell Laboratories]] in the late 1960s and early 1970s. During the 1970s the C language became increasingly popular. Many universities and organizations began creating their own variants of the language for their own projects. By the beginning of the 1980s compatibility problems between the various C implementations became apparent. In 1983 the [[American National Standards Institute]] (ANSI) formed a committee to establish a standard specification of C known as "[[ANSI C]]". This work culminated in the creation of the so-called C89 standard in 1989. Part of the resulting standard was a set of [[software libraries]] called the ANSI C standard library. === POSIX standard library === {{Main article|C POSIX library}} [[POSIX]], as well as [[Single Unix Specification|SUS]], specify a number of routines that should be available over and above those in the basic C standard library. The POSIX specification includes header files for, among other uses, [[POSIX Threads|multi-threading]], [[Berkeley sockets|networking]], and [[regular expression]]s. These are often implemented alongside the C standard library functionality, with varying degrees of closeness. For example, [[glibc]] implements functions such as <code>[[fork (operating system)|fork]]</code> within <code>libc.so</code>, but before [[NPTL]] was merged into glibc it constituted a separate library with its own linker flag argument. Often, this POSIX-specified functionality will be regarded as part of the library; the basic C library may be identified as the ANSI or [[International Organization for Standardization|ISO]] C library. === BSD libc === '''BSD libc''' is a superset of the POSIX standard library supported by the C libraries included with [[BSD]] [[operating system]]s such as [[FreeBSD]], [[NetBSD]], [[OpenBSD]] and [[macOS]]. BSD libc has some extensions that are not defined in the original standard, many of which first appeared in 1994's [[BSD#4.4BSD and descendants|4.4BSD]] release (the first to be largely developed after the first standard was issued in 1989). Some of the extensions of BSD libc are: * <code>sys/tree.h</code>{{snd}} contains an implementation of [[red–black tree]] and [[splay tree]]<ref>{{cite web |url=http://man.freebsd.org/tree |title=tree |website=Man.freebsd.org |date=27 December 2007 |access-date=25 August 2013}}</ref><ref>{{cite web |url=http://bxr.su/o/sys/sys/tree.h |title=Super User's BSD Cross Reference: /OpenBSD/sys/sys/tree.h |website=bxr.su}}</ref> * <code>sys/queue.h</code>{{snd}} implementations of [[Linked list]], [[queue (data structure)|queues]], [[tail queue]], etc.<ref>{{cite web |url=http://man.freebsd.org/queue |title=queue |website=Man.freebsd.org |date=13 May 2011 |access-date=25 August 2013}}</ref><ref>{{cite web |url=http://bxr.su/o/sys/sys/queue.h |title=Super User's BSD Cross Reference: /OpenBSD/sys/sys/queue.h |website=bxr.su}}</ref> * <code>fgetln()</code>{{snd}} defined in <code>stdio.h</code>. This can be used to read a file line by line.<ref>{{cite web |url=http://man.freebsd.org/fgetln |title=fgetln |website=Man.freebsd.org |date=19 April 1994 |access-date=25 August 2013}}</ref><ref>{{cite web |url=http://bxr.su/o/lib/libc/stdio/fgetln.c#fgetln |title=Super User's BSD Cross Reference: /OpenBSD/lib/libc/stdio/fgetln.c |website=bxr.su}}</ref><ref>{{cite web |url=http://bxr.su/o/include/stdio.h |title=Super User's BSD Cross Reference: /OpenBSD/include/stdio.h |website=bxr.su}}</ref> * <code>fts.h</code>{{snd}} contains some functions to traverse a file hierarchy<ref>{{cite web |url=http://man.freebsd.org/fts |title=fts|website=Man.freebsd.org |date=18 March 2012 |access-date=25 August 2013}}</ref><ref>{{cite web |url=http://bxr.su/o/include/fts.h |title=Super User's BSD Cross Reference: /OpenBSD/include/fts.h |website=bxr.su}}</ref> * <code>db.h</code>{{snd}} some functions to connect to the [[Berkeley DB]]<ref>{{cite web |url=http://man.freebsd.org/db |title=db |website=Man.freebsd.org |date=10 September 2010 |access-date=25 August 2013}}</ref><ref>{{cite web |url=http://bxr.su/o/include/db.h |title=Super User's BSD Cross Reference: /OpenBSD/include/db.h |website=bxr.su}}</ref> * <code>strlcat()</code> and <code>strlcpy()</code>{{snd}} secure alternatives for <code>strncat()</code> and <code>strncpy()</code><ref>Miller, Todd C. and Theo de Raadt. [http://www.usenix.org/events/usenix99/millert.html strlcpy and strlcat - consistent, safe, string copy and concatenation]. Proceedings of the 1999 USENIX Annual Technical Conference, June 6–11, 1999, pp. 175–178.</ref><ref>{{cite web |url=http://bxr.su/o/lib/libc/string/strlcat.c |title=Super User's BSD Cross Reference: /OpenBSD/lib/libc/string/strlcat.c |website=bxr.su}}</ref><ref>{{cite web |url=http://bxr.su/o/lib/libc/string/strlcpy.c |title=Super User's BSD Cross Reference: /OpenBSD/lib/libc/string/strlcpy.c |website=bxr.su}}</ref><ref>{{cite web |url=http://bxr.su/o/lib/libc/string/strncat.c |title=Super User's BSD Cross Reference: /OpenBSD/lib/libc/string/strncat.c |website=bxr.su}}</ref><ref>{{cite web |url=http://bxr.su/o/lib/libc/string/strncpy.c |title=Super User's BSD Cross Reference: /OpenBSD/lib/libc/string/strncpy.c |website=bxr.su}}</ref> * <code>err.h</code>{{snd}} contains some functions to print formatted error messages<ref>{{cite web |url=http://man.freebsd.org/err |title=err|website=Man.freebsd.org |date=29 March 2012 |access-date=25 August 2013}}</ref><ref>{{cite web |url=http://bxr.su/o/include/err.h |title=Super User's BSD Cross Reference: /OpenBSD/include/err.h |website=bxr.su}}</ref> * <code>vis.h</code>{{snd}} contains the <code>vis()</code> function. This function is used to display non-printable characters in a visual format.<ref>{{cite web |title=vis(3) |url=http://www.freebsd.org/cgi/man.cgi?query=vis&sektion=3&apropos=0&manpath=FreeBSD+9.1-RELEASE |website=Man.FreeBSD.org |access-date=14 September 2013}}</ref><ref>{{cite web |url=http://bxr.su/o/lib/libc/gen/vis.c#vis |title=Super User's BSD Cross Reference: /OpenBSD/lib/libc/gen/vis.c |website=bxr.su}}</ref><ref>{{cite web |url=http://bxr.su/o/include/vis.h |title=Super User's BSD Cross Reference: /OpenBSD/include/vis.h |website=bxr.su}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)