|
|
1.1 root 1: .\" @(#)Clib.ms 6.1 (Berkeley) 5/14/86
2: .\"
3: .so /k3/unx/MACROS/cmac1
4: .CH 3 "C LIBRARIES"
5: .H 1 "C LIBRARIES"
6: .H 2 "GENERAL"
7: .P
8: This chapter and Chapter 4 describe the libraries that
9: are supported on the UNIX operating system.
10: A library is a collection of related functions and/or declarations
11: that simplify programming effort
12: by linking only what is needed,
13: allowing use of locally produced functions, etc.
14: All of the functions described are also described in
15: Part 3 of the
16: .I "UNIX System Programmer Reference Manual" .
17: Most of the declarations described are in Part 5 of the
18: .I "UNIX System Programmer Reference Manual" .
19: The three main libraries on the UNIX system are:
20: .tr ~
21: .VL 20
22: .LI ~\fBC~library\fR
23: This is the basic library for C language programs.
24: The C library is composed of functions and declarations used for file access,
25: string testing and manipulation, character testing and manipulation, memory allocation, and other functions.
26: This library is described later in this chapter.
27: .tr ~
28: .LE
29: .VL 20
30: .LI ~\fBObject~file\fR
31: This library provides functions for the access and manipulation of
32: object files.
33: This library is described in Chapter 4.
34: .tr ~
35: .LE
36: .VL 20
37: .LI ~\fBMath~library\fR
38: This library provides exponential, bessel functions, logarithmic,
39: hyperbolic, and trigonometric functions.
40: This library is described in Chapter 4.
41: .LE
42: .P
43: Some libraries consist of two portions - functions and declarations.
44: In some cases, the user must request that the functions (and/or declarations) of a specific library be included
45: in a program being compiled.
46: In other cases, the functions (and/or declarations) are included automatically.
47: .H 3 "Including Functions"
48: .br
49: .P
50: When a program is being compiled, the compiler will
51: automatically search the C language library
52: to locate and include functions that are used in the program.
53: This is the case only for the C library and no other library.
54: In order for the compiler to locate and include functions from other libraries,
55: the user must specify these libraries on the command line for the compiler.
56: For example, when using functions of the math library, the user must request that the
57: math library be searched by including the argument \fB-lm\fR on the command line, such as:
58: .DS I
59: cc file.c -lm
60: .DE
61: The argument \fB-lm\fR must come after all files that
62: reference functions in the math library in order for
63: the link editor to know which functions to include in
64: the a.out file.
65: .P 0
66: This method should be used for all functions that are not part of the C language library.
67: .H 3 "Including Declarations"
68: .br
69: .P
70: Some functions require a set of declarations in order to operate properly.
71: A set of declarations is stored in a file under the \fI/usr/include\fR
72: directory.
73: These files are referred to as \fIheader files\fR.
74: In order to include a certain header file, the user must specify this request within the C language program.
75: The request is in the form:
76: .DS I
77: #include <file.h>
78: .DE
79: .P 0
80: where \fIfile.h\fR is the name of the file.
81: Since the header files define the type of the functions and
82: various preprocessor constants, they must be included
83: before invoking the functions they declare.
84: .P
85: The remainder of this chapter describes the functions and
86: header files of the C Library.
87: The description of the library begins with the actions required by the user to include the functions
88: and/or header files in a program being compiled (if any).
89: Following the description of the actions required is information
90: in three-column format of the form:
91: .DS L
92: \fBfunction\fR\^ \fBreference\fR\^(N) Brief description.
93: .SP
94: .DE
95: .P 0
96: The functions are grouped by type while the
97: reference refers to section `N' in the
98: .I "UNIX System Programmer Reference Manual" .
99: Following this, are descriptions of the header files associated with these
100: functions (if any).
101: .H 2 "THE C LIBRARY"
102: .P
103: The C library consists of several types of functions.
104: All the functions of the C library are loaded automatically by the compiler.
105: Various declarations must sometimes be included by the user as required.
106: The functions of the C library are divided into the following types:
107: .BL 6 1
108: .LI
109: Input/output control
110: .LI
111: String manipulation
112: .LI
113: Character manipulation
114: .LI
115: Time functions
116: .LI
117: Miscellaneous functions.
118: .LE
119: .H 3 "Input/Output Control"
120: .br
121: .P
122: These functions of the C library
123: are automatically included as needed
124: during the compiling of
125: a C language program.
126: No command line request is needed.
127: .P
128: The
129: header file required by the input/output functions should be included in the
130: program being compiled.
131: This is accomplished by including the line:
132: .DS I
133: #include <stdio.h>\fR
134: .DE
135: .P 0
136: near the beginning of each file that references
137: an input or output function.
138: .P
139: The input/output functions are grouped into the following
140: categories:
141: .BL 6 1
142: .LI
143: File access
144: .LI
145: File status
146: .LI
147: Input
148: .LI
149: Output
150: .LI
151: Miscellaneous.
152: .LE
153: .H 3 "File Access Functions"
154: .br
155: .P 0
156: .TS
157: expand;
158: lll
159: lll.
160: .if n .ft B
161: .if t .ft BI
162: .SP 2
163: FUNCTION REFERENCE BRIEF DESCRIPTION
164: .ft R
165: .SP
166: \fBfclose\fR\^ \fBfclose\fR\^(3S) Close an open stream.
167: .SP
168: \fBfdopen\fR\^ \fBfopen\fR\^(3S) Associate stream with
169: an \fBopen\fR(2) ed file.
170: .SP
171: \fBfileno\fR\^ \fBferror\fR\^(3S) File descriptor associated
172: with an open stream.
173: .SP
174: \fBfopen\fR\^ \fBfopen\fR\^(3S) Open a file with
175: specified permissions.
176: \fBFopen\fR returns a pointer
177: to a stream which is
178: used in subsequent
179: references to the file.
180: .SP
181: \fBfreopen\fR\^ \fBfopen\fR\^(3S) Substitute named file
182: in place of open
183: stream.
184: .SP
185: \fBfseek\fR\^ \fBfseek\fR\^(3S) Reposition the file
186: pointer.
187: .SP
188: \fBpclose\fR\^ \fBpopen\fR\^(3S) Close a stream opened
189: by \fBpopen\fR.
190: .SP
191: \fBpopen\fR\^ \fBpopen\fR\^(3S) Create pipe as a stream
192: between calling process
193: and command.
194: .SP
195: \fBrewind\fR\^ \fBfseek\fR\^(3S) Reposition file
196: pointer at beginning
197: of file.
198: .SP
199: \fBsetbuf\fR\^ \fBsetbuf\fR\^(3S) Assign buffering to
200: stream.
201: .SP
202: \fBvsetbuf setbuf\fR(3S) Similar to \fBsetbuf\fR, but
203: allowing finer control.
204: .TE
205: .H 3 "File Status Functions"
206: .br
207: .P 0
208: .TS
209: expand;
210: lll
211: lll.
212: .if n .ft B
213: .if t .ft BI
214: .SP 2
215: FUNCTION REFERENCE BRIEF DESCRIPTION
216: .ft R
217: .SP
218: \fBclearerr\fR\^ \fBferror\fR\^(3S) Reset error condition on
219: stream.
220: .SP
221: \fBfeof\fB \fBferror\fR(3S) Test for ``end of file''
222: on stream.
223: .SP
224: \fBferror\fR\^ \fBferror\fR\^(3S) Test for error condition
225: on stream.
226: .SP
227: \fBftell\fR\^ \fBfseek\fR\^(3S) Return current position
228: in the file.
229: .TE
230: .H 3 "Input Functions"
231: .br
232: .P 0
233: .TS
234: expand;
235: lll
236: lll.
237: .if n .ft B
238: .if t .ft BI
239: .SP 2
240: FUNCTION REFERENCE BRIEF DESCRIPTION
241: .ft R
242: .SP
243: \fBfgetc\fR\^ \fBgetc\fR\^(3S) True function for \fBgetc\fR\^
244: (3S).
245: .SP
246: \fBfgets\fR\^ \fBgets\fR\^(3S) Read string from stream.
247: .SP
248: \fBfread\fR\^ \fBfread\fR\^(3S) General buffered read
249: from stream.
250: .SP
251: \fBfscanf\fR\^ \fBscanf\fR\^(3S) Formatted read from
252: stream.
253: .SP
254: \fBgetc\fR\^ \fBgetc\fR\^(3S) Read character from
255: stream.
256: .SP
257: \fBgetchar\fR\^ \fBgetc\fR\^(3S) Read character from
258: standard input.
259: .SP
260: \fBgets\fR\^ \fBgets\fR\^(3S) Read string from standard input.
261: .SP
262: \fBgetw\fR\^ \fBgetc\fR\^(3S) Read word from stream.
263: .SP
264: \fBscanf\fR\^ \fBscanf\fR\^(3S) Read using format from
265: standard input.
266: .SP
267: \fBsscanf\fR\^ \fBscanf\fR\^(3S) Formatted from
268: string.
269: .SP
270: \fBungetc\fR\^ \fBungetc\fR\^(3S) Put back one character on
271: stream.
272: .TE
273: .H 3 "Output Functions"
274: .br
275: .P 0
276: .TS
277: expand;
278: lll
279: lll.
280: .if n .ft B
281: .if t .ft BI
282: .SP 2
283: FUNCTION REFERENCE BRIEF DESCRIPTION
284: .ft R
285: .SP
286: \fBfflush\fR\^ \fBfclose\fR\^(3S) Write all currently buffered
287: characters from stream.
288: .SP
289: \fBfprintf\fR\^ \fBprintf\fR\^(3S) Formatted write to
290: stream.
291: .SP
292: \fBfputc\fR\^ \fBputc\fR\^(3S) True function for \fBputc\fR\^
293: (3S).
294: .SP
295: \fBfputs\fR\^ \fBputs\fR\^(3S) Write string to stream.
296: .SP
297: \fBfwrite\fR\^ \fBfread\fR\^(3S) General buffered write to
298: stream.
299: .SP
300: \fBprintf\fR\^ \fBprintf\fR\^(3S) Print using format to
301: standard output.
302: .SP
303: \fBputc\fR\^ \fBputc\fR\^(3S) Write character to
304: standard output.
305: .SP
306: \fBputchar\fR\^ \fBputc\fR\^(3S) Write character to
307: standard output.
308: .SP
309: \fBputs\fR\^ \fBputs\fR\^(3S) Write string to
310: standard output.
311: .SP
312: \fBputw\fR\^ \fBputc\fR\^(3S) Write word to stream.
313: .SP
314: \fBsprintf\fR\^ \fBprintf\fR\^(3S) Formatted write to
315: string.
316: .SP
317: \fBvfprintf vprint\fR(3C) Print using format to
318: stream by \fBvarargs\fR(5)
319: argument list.
320: .SP
321: \fBvprintf vprint\fR(3C) Print using format to
322: standard output by
323: \fBvarargs\fR(5) argument list.
324: .SP
325: \fBvsprintf vprintf\fR(3C) Print using format to
326: stream string by
327: \fBvarargs\fR(5) argument list.
328: .TE
329: .H 3 "Miscellaneous Functions"
330: .br
331: .P 0
332: .TS
333: expand;
334: lll
335: lll.
336: .if n .ft B
337: .if t .ft BI
338: .SP 2
339: FUNCTION REFERENCE BRIEF DESCRIPTION
340: .ft R
341: .SP
342: \fBctermid\fR\^ \fBctermid\fR\^(3S) Return file name for
343: controlling terminal.
344: .SP
345: \fBcuserid\fR\^ \fBcuserid\fR\^(3S) Return login name for
346: owner of current process.
347: .SP
348: \fBsystem\fR\^ \fBsystem\fR\^(3S) Execute shell command.
349: .SP
350: \fBtempnam\fR\^ \fBtempnam\fR\^(3S) Create temporary file
351: name using directory and
352: prefix.
353: .SP
354: \fBtmpnam\fR\^ \fBtmpnam\fR\^(3S) Create temporary file
355: name.
356: .SP
357: \fBtmpfile\fR\^ \fBtmpfile\fR\^(3S) Create temporary file.
358: .TE
359: .H 3 "String Manipulation Functions"
360: .br
361: .P
362: These functions are
363: used to locate characters within a string, copy,
364: concatenate, and compare strings.
365: These functions are automatically located and loaded during the compiling of
366: a C language program.
367: No command line request is needed
368: since these functions are part of the C library.
369: The string manipulation functions are declared in a header file that
370: may be included in the program being compiled.
371: This is accomplished by including the line:
372: .DS I
373: #include <string.h>
374: .DE
375: near the beginning of each file that uses one
376: of these functions.
377: .sp
378: .P 0
379: .TS
380: expand;
381: lll
382: lll.
383: .if n .ft B
384: .if t .ft BI
385: .SP 2
386: FUNCTION REFERENCE BRIEF DESCRIPTION
387: .ft R
388: .SP
389: \fBstrcat\fR\^ \fBstring\fR\^(3C) Concatenate two strings.
390: .SP
391: \fBstrchr\fR\^ \fBstring\fR\^(3C) Search string for
392: character.
393: .SP
394: \fBstrcmp\fR\^ \fBstring\fR\^(3C) Compares two strings.
395: .SP
396: \fBstrcpy\fR\^ \fBstring\fR\^(3C) Copy string.
397: .SP
398: \fBstrcspn\fR\^ \fBstring\fR\^(3C) Length of initial string
399: not containing set of
400: characters.
401: .SP
402: \fBstrlen\fR\^ \fBstring\fR\^(3C) Length of string.
403: .SP
404: \fBstrncat\fR\^ \fBstring\fR\^(3C) Concatenate two strings
405: with a maximum length.
406: .SP
407: \fBstrncmp\fR\^ \fBstring\fR\^(3C) Compares two strings
408: with a maximum length.
409: .SP
410: \fBstrncpy\fR\^ \fBstring\fR\^(3C) Copy string over string
411: with a maximum length.
412: .SP
413: \fBstrpbrk\fR\^ \fBstring\fR\^(3C) Search string for any
414: set of characters.
415: .SP
416: \fBstrrchr\fR\^ \fBstring\fR\^(3C) Search string backwards
417: for character.
418: .SP
419: \fBstrspn\fR\^ \fBstring\fR\^(3C) Length of initial string
420: containing set of
421: characters.
422: .SP
423: \fBstrtok\fR\^ \fBstring\fR\^(3C) Search string for token
424: separated by any of a
425: set of characters.
426: .TE
427: .H 3 "Character Manipulation"
428: .br
429: .P
430: The following functions and declarations are used for
431: testing and translating ASCII characters.
432: These functions are located and loaded automatically during the compiling of
433: a C language program.
434: No command line request is needed
435: since these functions are part of the C library.
436: .P
437: The declarations associated with these functions should be included in the
438: program being compiled.
439: This is accomplished by including the line:
440: .DS I
441: #include <ctype.h>
442: .DE
443: .P 0
444: near the beginning of the file being compiled.
445: .H 3 "Character Testing Functions"
446: .br
447: .P
448: These functions can be used to identify characters as uppercase or
449: lowercase letters, digits, punctuation, etc.
450: .P 0
451: .TS
452: expand;
453: lll
454: lll.
455: .if n .ft B
456: .if t .ft BI
457: .SP 2
458: FUNCTION REFERENCE BRIEF DESCRIPTION
459: .ft R
460: .SP
461: \fBisalnum\fR\^ \fBctype\fR\^(3C) Is character
462: alphanumeric?
463: .SP
464: \fBisalpha\fR\^ \fBctype\fR\^(3C) Is character alphabetic?
465: .SP
466: \fBisascii\fR\^ \fBctype\fR\^(3C) Is integer ASCII
467: character?
468: .SP
469: \fBiscntrl\fR\^ \fBctype\fR\^(3C) Is character a control
470: character?
471: .SP
472: \fBisdigit\fR\^ \fBctype\fR\^(3C) Is character a digit?
473: .SP
474: \fBisgraph\fR\^ \fBctype\fR\^(3C) Is character a printable
475: character?
476: .SP
477: \fBislower\fR\^ \fBctype\fR\^(3C) Is character a
478: lowercase letter?
479: .SP
480: \fBisprint\fR\^ \fBctype\fR\^(3C) Is character a printing
481: character including
482: space?
483: .SP
484: \fBispunct\fR\^ \fBctype\fR\^(3C) Is character a
485: punctuation character?
486: .SP
487: \fBisspace\fR\^ \fBctype\fR\^(3C) Is character a white
488: space character?
489: .SP
490: \fBisupper\fR\^ \fBctype\fR\^(3C) Is character an uppercase
491: letter?
492: .SP
493: \fBisxdigit\fR\^ \fBctype\fR\^(3C) Is character a hex digit?
494: .TE
495: .H 3 "Character Translation Functions"
496: .br
497: .P
498: These functions provide
499: translation of uppercase to lowercase, lowercase to uppercase,
500: and integer to ASCII.
501: .P 0
502: .TS
503: expand;
504: lll
505: lll.
506: .if n .ft B
507: .if t .ft BI
508: .SP 2
509: FUNCTION REFERENCE BRIEF DESCRIPTION
510: .ft R
511: .SP
512: \fBtoascii\fR\^ \fBconv\fR\^(3C) Convert integer to
513: ASCII character.
514: .SP
515: \fBtolower\fR\^ \fBconv\fR\^(3C) Convert character to
516: lowercase.
517: .SP
518: \fBtoupper\fR\^ \fBconv\fR\^(3C) Convert character to
519: uppercase.
520: .TE
521: .H 3 "Time Functions"
522: .br
523: .P
524: These functions are used for
525: accessing
526: and reformatting the systems idea of the current date and time.
527: These functions are located and loaded automatically during the compiling of
528: a C language program.
529: No command line request is needed
530: since these functions are part of the C library.
531: .P
532: The header file associated with these functions should be included in the
533: program being compiled.
534: This is accomplished by including the line:
535: .DS I
536: .ne 4
537: #include <time.h>
538: .DE
539: .P 0
540: near the beginning of any file using the time functions.
541: .P
542: These functions (except \fBtzset\fR) convert a time such as returned
543: by \fBtime\fR(2).
544: .ne 6
545: .P 0
546: .TS
547: expand;
548: lll
549: lll.
550: .if n .ft B
551: .if t .ft BI
552: .SP 2
553: .ne 4
554: FUNCTION REFERENCE BRIEF DESCRIPTION
555: .ft R
556: .SP
557: .ne 4
558: \fBasctime\fR\^ \fBctime\fR\^(3C) Return string
559: representation
560: of date and time.
561: .SP
562: .ne 4
563: \fBctime\fR\^ \fBctime\fR\^(3C) Return string
564: representation of
565: date and time, given
566: integer form.
567: .SP
568: .ne 4
569: \fBgmtime\fR\^ \fBctime\fR\^(3C) Return Greenwich
570: Mean Time.
571: .SP
572: .ne 4
573: \fBlocaltime\fR\^ \fBctime\fR\^(3C) Return local time.
574: .SP
575: .ne 4
576: \fBtzset\fR\^ \fBctime\fR\^(3C) Set time zone field
577: from environment
578: variable.
579: .TE
580: .P 0
581: .H 3 "Miscellaneous Functions"
582: .br
583: .P
584: These functions support a wide variety of operations.
585: Some of these are numerical conversion, password file and group file access,
586: memory allocation, random number generation, and table management.
587: These functions are automatically located and included in a program being compiled.
588: No command line request is needed since these functions are part of the C library.
589: .P
590: Some of these functions require declarations to be included.
591: These are described following the descriptions of the functions.
592: .H 3 "Numerical Conversion"
593: .br
594: .P
595: The following functions perform numerical conversion.
596: .P 0
597: .TS
598: expand;
599: lll
600: lll.
601: .if n .ft B
602: .if t .ft BI
603: .SP 2
604: .ne 4
605: FUNCTION REFERENCE BRIEF DESCRIPTION
606: .ft R
607: .SP
608: .ne 4
609: \fBa64l\fR\^ \fBa64l\fR\^(3C) Convert string to
610: base 64 ASCII.
611: .SP
612: .ne 4
613: \fBatof\fR\^ \fBatof\fR\^(3C) Convert string to
614: floating.
615: .SP
616: .ne 4
617: \fBatoi\fR\^ \fBatof\fR\^(3C) Convert string to
618: integer.
619: .SP
620: .ne 4
621: \fBatol\fR\^ \fBatof\fR\^(3C) Convert string to long.
622: .SP
623: .ne 4
624: \fBfrexp\fR\^ \fBfrexp\fR\^(3C) Split floating into
625: mantissa and exponent.
626: .SP
627: .ne 4
628: \fBl3tol\fR\^ \fBl3tol\fR\^(3C) Convert 3-byte integer
629: to long.
630: .SP
631: .ne 4
632: \fBltol3\fR\^ \fBl3tol\fR\^(3C) Convert long to 3-byte
633: integer.
634: .SP
635: .ne 4
636: \fBldexp\fR\^ \fBfrexp\fR\^(3C) Combine mantissa and
637: exponent.
638: .SP
639: .ne 4
640: \fBl64a\fR\^ \fBa64l\fR\^(3C) Convert base 64 ASCII
641: to string.
642: .SP
643: .ne 4
644: \fBmodf\fR\^ \fBfrexp\fR\^(3C) Split mantissa into
645: integer and fraction.
646: .TE
647: .H 3 "DES Algorithm Access"
648: .br
649: .P
650: The following functions allow access to the Data Encryption Standard (DES) algorithm
651: used on the UNIX operating system.
652: The DES algorithm is implemented with variations to frustrate use of
653: hardware implementations of the DES for key search.
654: .P 0
655: .TS
656: expand;
657: lll
658: lll.
659: .if n .ft B
660: .if t .ft BI
661: .SP 2
662: .ne 4
663: FUNCTION REFERENCE BRIEF DESCRIPTION
664: .ft R
665: .SP
666: .ne 4
667: \fBcrypt\fR\^ \fBcrypt\fR\^(3C) Encode string.
668: .SP
669: .ne 4
670: \fBencrypt\fR\^ \fBcrypt\fR\^(3C) Encode/decode string of
671: 0s and 1s.
672: .SP
673: .ne 4
674: \fBsetkey\fR\^ \fBcrypt\fR\^(3C) Initialize for subsequent
675: use of \fBencrypt\fR.
676: .TE
677: .H 3 "Group File Access"
678: .br
679: .P
680: The following functions are used to obtain entries from the group file.
681: Declarations for these functions must be included in the program being
682: compiled with the line:
683: .DS I
684: #include <grp.h>
685: .DE
686: .P 0
687: .P 0
688: .TS
689: expand;
690: lll
691: lll.
692: .if n .ft B
693: .if t .ft BI
694: .SP 2
695: .ne 4
696: FUNCTION REFERENCE BRIEF DESCRIPTION
697: .ft R
698: .SP
699: .ne 4
700: \fBendgrent\fR\^ \fBgetgrent\fR\^(3C) Close group file being
701: processed.
702: .SP
703: .ne 4
704: \fBgetgrent\fR\^ \fBgetgrent\fR\^(3C) Get next group file
705: entry.
706: .SP
707: .ne 4
708: \fBgetgrgid\fR\^ \fBgetgrent\fR\^(3C) Return next group with
709: matching gid.
710: .SP
711: .ne 4
712: \fBgetgrnam\fR\^ \fBgetgrent\fR\^(3C) Return next group with
713: matching name.
714: .SP
715: .ne 4
716: \fBsetgrent\fR\^ \fBgetgrent\fR\^(3C) Rewind group file being
717: processed.
718: .SP
719: .ne 4
720: \fBfgetgrent getgrent\fR(3C) Get next group file entry
721: from a specified file.
722: .TE
723: .H 3 "Password File Access"
724: .br
725: .P
726: These functions are used to search and access information stored in the
727: password file (/etc/passwd).
728: Some functions require declarations that can be included in the program
729: being compiled by adding the line:
730: .DS I
731: #include <pwd.h>
732: .DE
733: .P 0
734: .P 0
735: .TS
736: expand;
737: lll
738: lll.
739: .if n .ft B
740: .if t .ft BI
741: .SP 2
742: .ne 4
743: FUNCTION REFERENCE BRIEF DESCRIPTION
744: .ft R
745: .SP
746: .ne 4
747: \fBendpwent\fR\^ \fBgetpwent\fR\^(3C) Close password file
748: being processed.
749: .SP
750: .ne 4
751: \fBgetpw\fR\^ \fBgetpw\fR\^(3C) Search password file
752: for uid.
753: .SP
754: .ne 4
755: \fBgetpwent\fR\^ \fBgetpwent\fR\^(3C) Get next password file
756: entry.
757: .SP
758: .ne 4
759: \fBgetpwnam\fR\^ \fBgetpwent\fR\^(3C) Return next entry with
760: matching name.
761: .SP
762: .ne 4
763: \fBgetpwuid\fR\^ \fBgetpwent\fR\^(3C) Return next entry with
764: matching uid.
765: .SP
766: .ne 4
767: \fBputpwent\fR\^ \fBputpwent\fR\^(3C) Write entry on stream.
768: .SP
769: .ne 4
770: \fBsetpwent\fR\^ \fBgetpwent\fR\^(3C) Rewind password file
771: being accessed.
772: .SP
773: .ne 4
774: .ne 3
775: \fBfgetpwent getpwent\fR(3C) Get next password file
776: entry from a specified
777: file.
778: .TE
779: .H 3 "Parameter Access"
780: .br
781: .P
782: The following functions provide access to several different types of
783: paramenters.
784: None require any declarations.
785: .P 0
786: .TS
787: expand;
788: lll
789: lll.
790: .if n .ft B
791: .if t .ft BI
792: .SP 2
793: .ne 4
794: FUNCTION REFERENCE BRIEF DESCRIPTION
795: .ft R
796: .SP
797: .ne 4
798: \fBgetopt\fR\^ \fBgetopt\fR\^(3C) Get next option from
799: option list.
800: .SP
801: .ne 4
802: \fBgetcwd\fR\^ \fBgetcwd\fR\^(3C) Return string
803: representation of
804: current working directory.
805: .SP
806: .ne 4
807: \fBgetenv\fR\^ \fBgetenv\fR\^(3C) Return string value
808: associated with
809: environment variable.
810: .SP
811: .ne 4
812: \fBgetpass\fR\^ \fBgetpass\fR\^(3C) Read string from terminal
813: without echoing.
814: .SP
815: .ne 4
816: \fBputenv putenv\fR(3C) Change or add value
817: of an environment
818: variable.
819: .TE
820: .H 3 "Hash Table Management"
821: .br
822: .P
823: The following functions are used to manage hash search tables.
824: The header file associated with these functions should be included
825: in the program being compiled.
826: This is accomplished by including the line:
827: .DS I
828: #include <search.h>
829: .DE
830: near the beginning of any file using the search functions.
831: .P 0
832: .TS
833: expand;
834: lll
835: lll.
836: .if n .ft B
837: .if t .ft BI
838: .SP 2
839: .ne 4
840: FUNCTION REFERENCE BRIEF DESCRIPTION
841: .ft R
842: .SP
843: .ne 4
844: \fBhcreate\fR\^ \fBhsearch\fR\^(3C) Create hash table.
845: .SP
846: .ne 4
847: \fBhdestroy\fR\^ \fBhsearch\fR\^(3C) Destroy hash table.
848: .SP
849: .ne 4
850: \fBhsearch\fR\^ \fBhsearch\fR\^(3C) Search hash table for
851: entry.
852: .TE
853: .H 3 "Binary Tree Management"
854: .br
855: .P
856: The following functions are used to manage a binary tree.
857: The header file associated with these functions should be included
858: in the program being compiled.
859: This is accomplished by including the line:
860: .DS I
861: #include <search.h>
862: .DE
863: near the beginning of any file using the search functions.
864: .P 0
865: .TS
866: expand;
867: lll
868: lll.
869: .if n .ft B
870: .if t .ft BI
871: .SP 2
872: .ne 4
873: FUNCTION REFERENCE BRIEF DESCRIPTION
874: .ft R
875: .SP
876: .ne 4
877: \fBtdelete\fR\^ \fBtsearch\fR\^(3C) Deletes nodes from
878: binary tree.
879: .SP
880: .ne 4
881: \fBtfind tsearch\fR(3C) Find element in
882: binary tree.
883: .SP
884: .ne 4
885: \fBtsearch\fR\^ \fBtsearch\fR\^(3C) Look for and add
886: element to binary
887: tree.
888: .SP
889: .ne 4
890: \fBtwalk\fR\^ \fBtsearch\fR\^(3C) Walk binary tree.
891: .TE
892: .H 3 "Table Management"
893: .br
894: .P
895: The following functions are used to manage a table.
896: Since none of these functions allocate storage, sufficient
897: memory must be allocated before using these functions.
898: The header file associated with these functions should be included
899: in the program being compiled.
900: This is accomplished by including the line:
901: .DS I
902: #include <search.h>
903: .DE
904: near the beginning of any file using the search functions.
905: .P 0
906: .TS
907: expand;
908: lll
909: lll.
910: .if n .ft B
911: .if t .ft BI
912: .SP 2
913: .ne 4
914: FUNCTION REFERENCE BRIEF DESCRIPTION
915: .ft R
916: .SP
917: .ne 4
918: \fBbsearch\fR\^ \fBbsearch\fR\^(3C) Search table using
919: binary search.
920: .SP
921: .ne 4
922: \fBlfind lsearch\fR(3C) Find element in
923: library tree.
924: .SP
925: .ne 4
926: \fBlsearch\fR\^ \fBlsearch\fR\^(3C) Look for and add
927: element in binary
928: tree.
929: .SP
930: .ne 4
931: \fBqsort\fR\^ \fBqsort\fR\^(3C) Sort table using
932: quick-sort algorithm.
933: .TE
934: .H 3 "Memory Allocation"
935: .br
936: .P
937: The following functions provide a means by which memory can be
938: dynamically allocated or freed.
939: .P 0
940: .TS
941: expand;
942: lll
943: lll.
944: .if n .ft B
945: .if t .ft BI
946: .SP 2
947: .ne 4
948: FUNCTION REFERENCE BRIEF DESCRIPTION
949: .ft R
950: .SP
951: .ne 4
952: \fBcalloc\fR\^ \fBmalloc\fR\^(3C) Allocate zeroed storage.
953: .SP
954: .ne 4
955: \fBfree\fR\^ \fBmalloc\fR\^(3C) Free previously allocated
956: storage.
957: .SP
958: .ne 4
959: \fBmalloc\fR\^ \fBmalloc\fR\^(3C) Allocate storage.
960: .SP
961: .ne 4
962: \fBrealloc\fR\^ \fBmalloc\fR\^(3C) Change size of allocated
963: storage.
964: .TE
965: The following is another set of memory allocation functions
966: available.
967: .P 0
968: .TS
969: expand;
970: lll
971: lll.
972: .if n .ft B
973: .if t .ft BI
974: .SP 2
975: .ne 4
976: FUNCTION REFERENCE BRIEF DESCRIPTION
977: .ft R
978: .SP
979: .ne 4
980: \fBcalloc malloc\fR(3X) Allocate zeroed storage.
981: .SP
982: .ne 4
983: \fBfree malloc\fR(3X) Free previously allocated
984: storage.
985: .SP
986: .ne 4
987: \fBmalloc malloc\fR(3X) Allocate storage.
988: .SP
989: .ne 4
990: \fBmallopt malloc\fR(3X) Control allocation
991: algorithm.
992: .SP
993: .ne 4
994: \fBmallinfo malloc\fR(3X) Space usage.
995: .SP
996: .ne 4
997: \fBrealoc malloc\fR(3X) Change size of
998: allocated storage.
999: .TE
1000: .H 3 "Pseudorandom Number Generation"
1001: .br
1002: .P
1003: The following functions are used to generate pseudorandom numbers.
1004: The functions that end with \fB48\fR are a family of interfaces to
1005: a pseudorandom number generator based upon the linear congruent
1006: algorithm and 48-bit integer arithmetic.
1007: The \fBrand\fR\^ and \fBsrand\fR\^ functions provide an interface to
1008: a multiplicative congruential random number generator with period of
1009: 232.
1010: .P 0
1011: .TS
1012: expand;
1013: lll
1014: lll.
1015: .if n .ft B
1016: .if t .ft BI
1017: .SP 2
1018: .ne 4
1019: FUNCTION REFERENCE BRIEF DESCRIPTION
1020: .ft R
1021: .SP
1022: .ne 4
1023: \fBdrand48\fR\^ \fBdrand48\fR\^(3C) Random double over
1024: the interval [0 to 1).
1025: .SP
1026: .ne 4
1027: \fBlcong48\fR\^ \fBdrand48\fR\^(3C) Set parameters for
1028: \fBdrand48\fR\^, \fBlrand48\fR\^,
1029: and \fBmrand48\fR.
1030: .SP
1031: .ne 4
1032: \fBlrand48\fR\^ \fBdrand48\fR\^(3C) Random long over the
1033: interval [0 to 2\v'-0.3'31\v'0.3').
1034: .SP
1035: .ne 4
1036: \fBmrand48\fR\^ \fBdrand48\fR\^(3C) Random long over the
1037: interval [-2\v'-0.3'31\v'0.3' to 2\v'-0.3'31\v'0.3').
1038: .SP
1039: .ne 4
1040: \fBrand\fR\^ \fBrand\fR\^(3C) Random integer over the
1041: interval [0 to 32767).
1042: .SP
1043: .ne 4
1044: \fBseed48\fR\^ \fBdrand48\fR\^(3C) Seed the generator for
1045: \fBdrand48\fR\^, \fBlrand48\fR\^, and
1046: \fBmrand48\fR.
1047: .SP
1048: .ne 4
1049: \fBsrand\fR\^ \fBrand\fR\^(3C) Seed the generator
1050: for \fBrand\fR.
1051: .SP
1052: .ne 4
1053: \fBsrand48\fR\^ \fBdrand48\fR\^(3C) Seed the generator for
1054: \fBdrand48\fR\^, \fBlrand48\fR\^, and
1055: \fBmrand48\fR using a long.
1056: .SP
1057: .ne 4
1058: .TE
1059: .sp
1060: .sp
1061: .sp
1062: .sp
1063: .tr ~
1064: .sp
1065: .H 3 "Signal Handling Functions"
1066: .br
1067: .P
1068: The functions \fBgsignal\fR\^ and \fBssignal\fR\^ implement a software
1069: facility similar to \fBsignal\fR(2) in the
1070: .I "UNIX System Programmer Reference Manual" .
1071: This facility enables users to indicate the disposition of error
1072: conditions and allows users to handle signals for their own purposes.
1073: The declarations associated with these functions can be included in the
1074: program being complied by the line
1075: .DS I
1076: #include <signal.h>
1077: .DE
1078: .P 0
1079: These declarations define ASCII names for the 15 software signals.
1080: .P 0
1081: .TS
1082: expand;
1083: lll
1084: lll.
1085: .SP 2
1086: .ne 4
1087: .if n .ft B
1088: .if t .ft BI
1089: FUNCTION REFERENCE BRIEF DESCRIPTION
1090: .ft R
1091: .SP
1092: .ne 4
1093: \fBgsignal\fR\^ \fBssignal\fR\^(3C) Send a software signal.
1094: .SP
1095: .ne 4
1096: \fBssignal\fR\^ \fBssignal\fR\^(3C) Arrange for handling
1097: of software signals.
1098: .TE
1099: .H 3 "Miscellaneous"
1100: .br
1101: .P
1102: The following functions do not fall into any previously described
1103: category.
1104: .P 0
1105: .TS
1106: expand;
1107: lll
1108: lll.
1109: .SP 2
1110: .ne 4
1111: .if n .ft B
1112: .if t .ft BI
1113: FUNCTION REFERENCE BRIEF DESCRIPTION
1114: .ft R
1115: .SP
1116: .ne 4
1117: \fBabort\fR\^ \fBabort\fR\^(3C) Cause an IOT signal
1118: to be sent to the
1119: process.
1120: .SP
1121: .ne 4
1122: \fBabs\fR\^ \fBabs\fR\^(3C) Return the absolute
1123: integer value.
1124: .SP
1125: .ne 4
1126: \fBecvt\fR\^ \fBecvt\fR\^(3C) Convert double to
1127: string.
1128: .SP
1129: .ne 4
1130: \fBfcvt\fR\^ \fBecvt\fR\^(3C) Convert double to
1131: string using Fortran
1132: Format.
1133: .SP
1134: .ne 4
1135: \fBgcvt\fR\^ \fBecvt\fR\^(3C) Convert double to
1136: string using Fortran
1137: F or E format.
1138: .SP
1139: .ne 4
1140: \fBisatty\fR\^ \fBttyname\fR\^(3C) Test whether integer
1141: file descriptor is
1142: associated with a
1143: terminal.
1144: .SP
1145: .ne 4
1146: \fBmktemp\fR\^ \fBmktemp\fR\^(3C) Create file name
1147: using template.
1148: .SP
1149: .ne 4
1150: \fBmonitor\fR\^ \fBmonitor\fR\^(3C) Cause process to record
1151: a histogram of program
1152: counter location.
1153: .SP
1154: .ne 4
1155: \fBswab\fR\^ \fBswab\fR\^(3C) Swap and copy bytes.
1156: .SP
1157: .ne 4
1158: \fBttyname\fR\^ \fBttyname\fR\^(3C) Return pathname of
1159: terminal associated with
1160: integer file descriptor.
1161: .TE
1162: .TC 2 1 3 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.