INTRO(3) SysV INTRO(3)
NAME
intro - introduction to functions and libraries
DESCRIPTION
This section describes functions found in various libraries, other than
those functions that directly invoke UNIX system primitives, which are
described in Section 2. Certain major collections are identified by a
letter after the section number:
(3C) The C compiler, cc(1), loads the libraries containing these
functions automatically. Declarations for some of these functions
may be obtained from #include files indicated on the appropriate
pages.
(3S) These functions constitute the "standard I/O package" (see
stdio(3S)). These functions also are loaded automatically by the
C compiler. Declarations for these functions may be obtained from
the #include file <stdio.h>.
(3M) Declarations for these functions may be obtained from the include
file <math.h>.
(3N) This contains sets of functions constituting the Network Services
library. These sets provide protocol independent interfaces to
networking services based on the service definitions of the OSI
(Open Systems Interconnection) reference model. Application
developers access the function sets that provide services at a
particular level.
At present, this library contains the Transport Interface (TI)
function set. It provides the services of the OSI Transport
Layer. These services provide reliable end-to-end data
transmission using the services of an underlying network.
Applications written using the TI functions are independent of the
underlying protocols. Declarations for these functions may be
obtained from the #include file <tiuser.h>. The link editor ld(1)
searches this library under the -lnsl option.
(3X) Various specialized libraries. The files in which these libraries
are found are given on the appropriate pages.
(3F) These functions constitute the FORTRAN intrinsic function library,
libF77. These functions are automatically available to the
FORTRAN programmer and require no special invocation of the
compiler.
DEFINITIONS
A "character" is any bit pattern able to fit into a byte on the machine.
The "null character" is a character with value 0, represented in the C
language as "\0". A "character array" is a sequence of characters. A
"null-terminated character array" is a sequence of characters, the last
of which is the null character. A null terminated character array is
also called a "string". The "null string" is a character array containing
only the null character. A "letter" is a printing character in the
execution character set corresponding to any of the 52 required lowercase
and uppercase letters in the source character set, listed in Section
2.2.1 of ANS X3.159-1989. The "decimal-point character" is the character
used by functions that convert floating-point numbers to or from
character sequences to denote the beginning of the fractional part of
such character sequences. The manual pages uses a period, but may be
changed by setlocale.
A NULL pointer is the value that is obtained by casting 0 into a pointer.
The C language guarantees that this value will not match that of any
legitimate pointer, so many functions that return pointers return it to
indicate an error. NULL is defined as "0" in <stdio.h>; the user can
include an appropriate definition if not using <stdio.h>.
Many groups of FORTRAN intrinsic functions have generic function names
that do not require explicit or implicit type declaration. The type of
the function will be determined by the type of its argument(s). For
example, the generic function max will return an integer value if given
integer arguments (max0), a real value if given real arguments (amax1),
or a double-precision value if given double-precision arguments (dmax1).
netbuf. In the Network Services library, netbuf is a structure used in
various Transport Interface (TI) functions to send and receive data and
information. It contains the following members:
unsigned int maxlen;
unsigned int len;
char *buf;
buf points to a user input and/or output buffer. len generally specifies
the number of bytes contained in the buffer. If the structure is used
for both input and output, the function will replace the user value of
len on return.
maxlen generally has significance only when buf is used to receive output
from the TI function. In this case, it specifies the physical size of
the buffer, the maximum value of len that can be set by the function. If
maxlen is not large enough to hold the returned information, an TBUFOVFLW
error will generally result. However, certain functions may return part
of the data and not generate an error.
BUILT-IN CODE
Domain C supports "built-in" code for the fabs, sin, cos, tan, log, exp,
atan, atan2, and sqrt math routines and for the strcpy, strncpy, strncat,
strcat, strcmp, strncmp, and strlen string handling routines. <math.h>
makes the defining of the built-in math routines conditional upon your
defining the _MATH_BUILTINS macro, which you can do either by adding the
line
#define _MATH_BUILTINS
to your program or compiling it with the -D_MATH_BUILTINS option.
<string.h> makes the defining of the built-in string routines conditional
upon your defining the _STRING_BUILTINS macro, which you can do either by
adding the line
#define _STRING_BUILTINS
to your program or compiling it with the -D_STRING_BUILTINS option. Both
_MATH_BUILTINS and _STRING_BUILTINS get defined if you define _BUILTINS.
<apollo/builtins.h> defines both the built-in math and string routines
unconditionally.
Using these built-in routines can result in much faster executables,
particularly when double-precision math functions are used heavily.
However, they create somewhat longer object files and do no error
checking. Therefore, do not use the built-in math functions if your
programs rely on matherr(3M) error handling.
FILES
LIBDIR usually /lib
LIBDIR/libc
LIBDIR/clib global libraries
/usr/lib/libnsl.a (3N)
SEE ALSO
ar(1), cc(1), f77(1), ld(1), nm(1), intro(2), stdio(3S), math(5).
Domain C Language Reference.
DIAGNOSTICS
C library and math functions (3C and 3M) may return the conventional
values 0 or +HUGE_VAL when the function is undefined for the given
arguments or when the value is not representable. (HUGE_VAL is a
positive double expression. Although the <math.h> header file currently
sets HUGE_VAL equal to FLT_MAX (see limits(4)), HUGE_VAL may not be
representable as a float in future implementations of Domain/OS SysV.)
In these cases, the external variable errno (see intro(2)) is set to the
value EDOM or ERANGE.