1 /* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 * ISO C Standard: 4.10 GENERAL UTILITIES <stdlib.h>
27 /* Get size_t, wchar_t and NULL from <stddef.h>. */
29 #ifndef __need_malloc_and_calloc
30 # define __need_wchar_t
37 #ifndef __need_malloc_and_calloc
40 /* Returned by `div'. */
43 int quot; /* Quotient. */
44 int rem; /* Remainder. */
47 /* Returned by `ldiv'. */
50 long int quot; /* Quotient. */
51 long int rem; /* Remainder. */
55 /* Returned by `lldiv'. */
56 __extension__ typedef struct
58 long long int quot; /* Quotient. */
59 long long int rem; /* Remainder. */
64 /* The largest number rand will return (same as INT_MAX). */
65 #define RAND_MAX 2147483647
68 /* We define these the same for all machines.
69 Changes from this to the outside world should be done in `_exit'. */
70 #define EXIT_FAILURE 1 /* Failing exit status. */
71 #define EXIT_SUCCESS 0 /* Successful exit status. */
74 /* Maximum length of a multibyte character in the current locale. */
75 #define MB_CUR_MAX (__ctype_get_mb_cur_max ())
76 extern int __ctype_get_mb_cur_max __P ((void));
79 /* Convert a string to a floating-point number. */
80 extern double atof __P ((__const char *__nptr));
81 /* Convert a string to an integer. */
82 extern int atoi __P ((__const char *__nptr));
83 /* Convert a string to a long integer. */
84 extern long int atol __P ((__const char *__nptr));
86 #if defined __USE_ISOC9X || (defined __GNUC__ && defined __USE_MISC)
87 /* These functions will part of the standard C library in ISO C 9X. */
88 __extension__ extern long long int atoll __P ((__const char *__nptr));
91 /* Convert a string to a floating-point number. */
92 extern double strtod __P ((__const char *__restrict __nptr,
93 char **__restrict __endptr));
96 /* Likewise for `float' and `long double' sizes of floating-point numbers. */
97 extern float strtof __P ((__const char *__restrict __nptr,
98 char **__restrict __endptr));
100 extern __long_double_t strtold __P ((__const char *__restrict __nptr,
101 char **__restrict __endptr));
104 /* Convert a string to a long integer. */
105 extern long int strtol __P ((__const char *__restrict __nptr,
106 char **__restrict __endptr, int __base));
107 /* Convert a string to an unsigned long integer. */
108 extern unsigned long int strtoul __P ((__const char *__restrict __nptr,
109 char **__restrict __endptr,
112 #if defined __GNUC__ && defined __USE_BSD
113 /* Convert a string to a quadword integer. */
115 extern long long int strtoq __P ((__const char *__restrict __nptr,
116 char **__restrict __endptr, int __base));
117 /* Convert a string to an unsigned quadword integer. */
119 extern unsigned long long int strtouq __P ((__const char *__restrict __nptr,
120 char **__restrict __endptr,
122 #endif /* GCC and use BSD. */
124 #if defined __USE_ISOC9X || (defined __GNUC__ && defined __USE_MISC)
125 /* These functions will part of the standard C library in ISO C 9X. */
127 /* Convert a string to a quadword integer. */
129 extern long long int strtoll __P ((__const char *__restrict __nptr,
130 char **__restrict __endptr, int __base));
131 /* Convert a string to an unsigned quadword integer. */
133 extern unsigned long long int strtoull __P ((__const char *__restrict __nptr,
134 char **__restrict __endptr,
136 #endif /* ISO C 9X or GCC and use MISC. */
140 /* The concept of one static locale per category is not very well
141 thought out. Many applications will need to process its data using
142 information from several different locales. Another application is
143 the implementation of the internationalization handling in the
144 upcoming ISO C++ standard library. To support this another set of
145 the functions using locale data exist which have an additional
148 Attention: all these functions are *not* standardized in any form.
149 This is a proof-of-concept implementation. */
151 /* Structure for reentrant locale using functions. This is an
152 (almost) opaque type for the user level programs. */
153 # include <xlocale.h>
155 /* Special versions of the functions above which take the locale to
156 use as an additional parameter. */
157 extern long int __strtol_l __P ((__const char *__restrict __nptr,
158 char **__restrict __endptr, int __base,
161 extern unsigned long int __strtoul_l __P ((__const char *__restrict __nptr,
162 char **__restrict __endptr,
163 int __base, __locale_t __loc));
166 extern long long int __strtoll_l __P ((__const char *__restrict __nptr,
167 char **__restrict __endptr, int __base,
171 extern unsigned long long int __strtoull_l __P ((__const char *__restrict
173 char **__restrict __endptr,
177 extern double __strtod_l __P ((__const char *__restrict __nptr,
178 char **__restrict __endptr, __locale_t __loc));
180 extern float __strtof_l __P ((__const char *__restrict __nptr,
181 char **__restrict __endptr, __locale_t __loc));
183 extern __long_double_t __strtold_l __P ((__const char *__restrict __nptr,
184 char **__restrict __endptr,
189 /* The internal entry points for `strtoX' take an extra flag argument
190 saying whether or not to parse locale-dependent number grouping. */
192 extern double __strtod_internal __P ((__const char *__restrict __nptr,
193 char **__restrict __endptr,
195 extern float __strtof_internal __P ((__const char *__restrict __nptr,
196 char **__restrict __endptr, int __group));
197 extern __long_double_t __strtold_internal __P ((__const char *
199 char **__restrict __endptr,
201 #ifndef __strtol_internal_defined
202 extern long int __strtol_internal __P ((__const char *__restrict __nptr,
203 char **__restrict __endptr,
204 int __base, int __group));
205 # define __strtol_internal_defined 1
207 #ifndef __strtoul_internal_defined
208 extern unsigned long int __strtoul_internal __P ((__const char *
210 char **__restrict __endptr,
211 int __base, int __group));
212 # define __strtoul_internal_defined 1
214 #if defined __GNUC__ || defined __USE_ISOC9X
215 # ifndef __strtoll_internal_defined
217 extern long long int __strtoll_internal __P ((__const char *__restrict __nptr,
218 char **__restrict __endptr,
219 int __base, int __group));
220 # define __strtoll_internal_defined 1
222 # ifndef __strtoull_internal_defined
224 extern unsigned long long int __strtoull_internal __P ((__const char *
230 # define __strtoull_internal_defined 1
234 #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \
235 && defined __USE_EXTERN_INLINES
236 /* Define inline functions which call the internal entry points. */
238 extern __inline double
239 strtod (__const char *__restrict __nptr, char **__restrict __endptr)
241 return __strtod_internal (__nptr, __endptr, 0);
243 extern __inline long int
244 strtol (__const char *__restrict __nptr, char **__restrict __endptr,
247 return __strtol_internal (__nptr, __endptr, __base, 0);
249 extern __inline unsigned long int
250 strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
253 return __strtoul_internal (__nptr, __endptr, __base, 0);
257 extern __inline float
258 strtof (__const char *__restrict __nptr, char **__restrict __endptr)
260 return __strtof_internal (__nptr, __endptr, 0);
262 extern __inline __long_double_t
263 strtold (__const char *__restrict __nptr, char **__restrict __endptr)
265 return __strtold_internal (__nptr, __endptr, 0);
270 __extension__ extern __inline long long int
271 strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
274 return __strtoll_internal (__nptr, __endptr, __base, 0);
276 __extension__ extern __inline unsigned long long int
277 strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
280 return __strtoull_internal (__nptr, __endptr, __base, 0);
284 # if defined __USE_MISC || defined __USE_ISOC9X
285 __extension__ extern __inline long long int
286 strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
289 return __strtoll_internal (__nptr, __endptr, __base, 0);
291 __extension__ extern __inline unsigned long long int
292 strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
295 return __strtoull_internal (__nptr, __endptr, __base, 0);
299 extern __inline double
300 atof (__const char *__nptr)
302 return strtod (__nptr, (char **) NULL);
305 atoi (__const char *__nptr)
307 return (int) strtol (__nptr, (char **) NULL, 10);
309 extern __inline long int
310 atol (__const char *__nptr)
312 return strtol (__nptr, (char **) NULL, 10);
315 # if defined __USE_MISC || defined __USE_ISOC9X
316 __extension__ extern __inline long long int
317 atoll (__const char *__nptr)
319 return strtoll (__nptr, (char **) NULL, 10);
322 #endif /* Optimizing and Inlining. */
325 #if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
326 /* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant
327 digit first. Returns a pointer to static storage overwritten by the
329 extern char *l64a __P ((long int __n));
331 /* Read a number from a string S in base 64 as above. */
332 extern long int a64l __P ((__const char *__s));
335 # include <sys/types.h> /* we need int32_t... */
337 /* These are the functions that actually do things. The `random', `srandom',
338 `initstate' and `setstate' functions are those from BSD Unices.
339 The `rand' and `srand' functions are required by the ANSI standard.
340 We provide both interfaces to the same random number generator. */
341 /* Return a random long integer between 0 and RAND_MAX inclusive. */
342 extern int32_t random __P ((void));
344 /* Seed the random number generator with the given number. */
345 extern void srandom __P ((unsigned int __seed));
347 /* Initialize the random number generator to use state buffer STATEBUF,
348 of length STATELEN, and seed it with SEED. Optimal lengths are 8, 16,
349 32, 64, 128 and 256, the bigger the better; values less than 8 will
350 cause an error and values greater than 256 will be rounded down. */
351 extern __ptr_t initstate __P ((unsigned int __seed, __ptr_t __statebuf,
354 /* Switch the random number generator to state buffer STATEBUF,
355 which should have been previously initialized by `initstate'. */
356 extern __ptr_t setstate __P ((__ptr_t __statebuf));
360 /* Reentrant versions of the `random' family of functions.
361 These functions all use the following data structure to contain
362 state, rather than global state variables. */
366 int32_t *fptr; /* Front pointer. */
367 int32_t *rptr; /* Rear pointer. */
368 int32_t *state; /* Array of state values. */
369 int rand_type; /* Type of random number generator. */
370 int rand_deg; /* Degree of random number generator. */
371 int rand_sep; /* Distance between front and rear. */
372 int32_t *end_ptr; /* Pointer behind state table. */
375 extern int random_r __P ((struct random_data *__buf, int32_t *__result));
377 extern int srandom_r __P ((unsigned int __seed, struct random_data *__buf));
379 extern int initstate_r __P ((unsigned int __seed, __ptr_t __statebuf,
380 size_t __statelen, struct random_data *__buf));
382 extern int setstate_r __P ((__ptr_t __statebuf, struct random_data *__buf));
383 # endif /* Use misc. */
384 #endif /* Use SVID || extended X/Open. */
387 /* Return a random integer between 0 and RAND_MAX inclusive. */
388 extern int rand __P ((void));
389 /* Seed the random number generator with the given number. */
390 extern void srand __P ((unsigned int __seed));
393 /* Reentrant interface according to POSIX.1. */
394 extern int rand_r __P ((unsigned int *__seed));
398 #if defined __USE_SVID || defined __USE_XOPEN
399 /* System V style 48-bit random number generator functions. */
401 /* Return non-negative, double-precision floating-point value in [0.0,1.0). */
402 extern double drand48 __P ((void));
403 extern double erand48 __P ((unsigned short int __xsubi[3]));
405 /* Return non-negative, long integer in [0,2^31). */
406 extern long int lrand48 __P ((void));
407 extern long int nrand48 __P ((unsigned short int __xsubi[3]));
409 /* Return signed, long integers in [-2^31,2^31). */
410 extern long int mrand48 __P ((void));
411 extern long int jrand48 __P ((unsigned short int __xsubi[3]));
413 /* Seed random number generator. */
414 extern void srand48 __P ((long int __seedval));
415 extern unsigned short int *seed48 __P ((unsigned short int __seed16v[3]));
416 extern void lcong48 __P ((unsigned short int __param[7]));
418 /* Data structure for communication with thread safe versions. */
421 unsigned short int x[3]; /* Current state. */
422 unsigned short int a[3]; /* Factor in congruential formula. */
423 unsigned short int c; /* Additive const. in congruential formula. */
424 unsigned short int old_x[3]; /* Old state. */
425 int init; /* Flag for initializing. */
429 /* Return non-negative, double-precision floating-point value in [0.0,1.0). */
430 extern int drand48_r __P ((struct drand48_data *__buffer, double *__result));
431 extern int erand48_r __P ((unsigned short int __xsubi[3],
432 struct drand48_data *__buffer, double *__result));
434 /* Return non-negative, long integer in [0,2^31). */
435 extern int lrand48_r __P ((struct drand48_data *__buffer, long int *__result));
436 extern int nrand48_r __P ((unsigned short int __xsubi[3],
437 struct drand48_data *__buffer, long int *__result));
439 /* Return signed, long integers in [-2^31,2^31). */
440 extern int mrand48_r __P ((struct drand48_data *__buffer, long int *__result));
441 extern int jrand48_r __P ((unsigned short int __xsubi[3],
442 struct drand48_data *__buffer, long int *__result));
444 /* Seed random number generator. */
445 extern int srand48_r __P ((long int __seedval, struct drand48_data *__buffer));
447 extern int seed48_r __P ((unsigned short int __seed16v[3],
448 struct drand48_data *__buffer));
450 extern int lcong48_r __P ((unsigned short int __param[7],
451 struct drand48_data *__buffer));
452 # endif /* Use misc. */
453 #endif /* Use SVID or X/Open. */
455 #endif /* don't just need malloc and calloc */
457 #ifndef __malloc_and_calloc_defined
458 #define __malloc_and_calloc_defined
459 /* Allocate SIZE bytes of memory. */
460 extern __ptr_t malloc __P ((size_t __size));
461 /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
462 extern __ptr_t calloc __P ((size_t __nmemb, size_t __size));
465 #ifndef __need_malloc_and_calloc
466 /* Re-allocate the previously allocated block
467 in __ptr_t, making the new block SIZE bytes long. */
468 extern __ptr_t realloc __P ((__ptr_t __ptr, size_t __size));
469 /* Free a block allocated by `malloc', `realloc' or `calloc'. */
470 extern void free __P ((__ptr_t __ptr));
473 /* Free a block. An alias for `free'. (Sun Unices). */
474 extern void cfree __P ((__ptr_t __ptr));
475 #endif /* Use misc. */
477 #if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
479 #endif /* Use GNU, BSD, or misc. */
481 #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
482 /* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */
483 extern __ptr_t valloc __P ((size_t __size));
487 /* Abort execution and generate a core-dump. */
488 extern void abort __P ((void)) __attribute__ ((__noreturn__));
491 /* Register a function to be called when `exit' is called. */
492 extern int atexit __P ((void (*__func) (void)));
495 /* Register a function to be called with the status
496 given to `exit' and the given argument. */
497 extern int __on_exit __P ((void (*__func) (int __status, __ptr_t __arg),
499 extern int on_exit __P ((void (*__func) (int __status, __ptr_t __arg),
503 /* Call all functions registered with `atexit' and `on_exit',
504 in the reverse of the order in which they were registered
505 perform stdio cleanup, and terminate program execution with STATUS. */
506 extern void exit __P ((int __status)) __attribute__ ((__noreturn__));
509 /* Return the value of envariable NAME, or NULL if it doesn't exist. */
510 extern char *getenv __P ((__const char *__name));
512 /* This function is similar to the above but returns NULL if the
513 programs is running with SUID or SGID enabled. */
514 extern char *__secure_getenv __P ((__const char *__name));
516 #if defined __USE_SVID || defined __USE_XOPEN
517 /* The SVID says this is in <stdio.h>, but this seems a better place. */
518 /* Put STRING, which is of the form "NAME=VALUE", in the environment.
519 If there is no `=', remove NAME from the environment. */
520 extern int putenv __P ((__const char *__string));
524 /* Set NAME to VALUE in the environment.
525 If REPLACE is nonzero, overwrite an existing value. */
526 extern int setenv __P ((__const char *__name, __const char *__value,
529 /* Remove the variable NAME from the environment. */
530 extern void unsetenv __P ((__const char *__name));
534 /* The `clearenv' was planned to be added to POSIX.1 but probably
535 never made it. Nevertheless the POSIX.9 standard (POSIX bindings
536 for Fortran 77) requires this function. */
537 extern int clearenv __P ((void));
541 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
542 /* Generate a unique temporary file name from TEMPLATE.
543 The last six characters of TEMPLATE must be "XXXXXX";
544 they are replaced with a string that makes the file name unique.
545 Returns TEMPLATE, or a null pointer if it cannot get a unique file name. */
546 extern char *mktemp __P ((char *__template));
548 /* Generate a unique temporary file name from TEMPLATE.
549 The last six characters of TEMPLATE must be "XXXXXX";
550 they are replaced with a string that makes the filename unique.
551 Returns a file descriptor open on the file for reading and writing,
552 or -1 if it cannot create a uniquely-named file. */
553 extern int mkstemp __P ((char *__template));
557 /* Execute the given line as a shell command. */
558 extern int system __P ((__const char *__command));
562 /* Return a malloc'd string containing the canonical absolute name of the
563 named file. The last file name component need not exist, and may be a
564 symlink to a nonexistent file. */
565 extern char *canonicalize_file_name __P ((__const char *__name));
568 #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
569 /* Return the canonical absolute name of file NAME. The last file name
570 component need not exist, and may be a symlink to a nonexistent file.
571 If RESOLVED is null, the result is malloc'd; otherwise, if the canonical
572 name is PATH_MAX chars or more, returns null with `errno' set to
573 ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, returns the
575 extern char *realpath __P ((__const char *__name, char *__resolved));
579 /* Shorthand for type of comparison functions. */
580 #ifndef __COMPAR_FN_T
581 # define __COMPAR_FN_T
582 typedef int (*__compar_fn_t) __PMT ((__const __ptr_t, __const __ptr_t));
585 typedef __compar_fn_t comparison_fn_t;
589 /* Do a binary search for KEY in BASE, which consists of NMEMB elements
590 of SIZE bytes each, using COMPAR to perform the comparisons. */
591 extern __ptr_t bsearch __PMT ((__const __ptr_t __key, __const __ptr_t __base,
592 size_t __nmemb, size_t __size,
593 __compar_fn_t __compar));
595 /* Sort NMEMB elements of BASE, of SIZE bytes each,
596 using COMPAR to perform the comparisons. */
597 extern void qsort __PMT ((__ptr_t __base, size_t __nmemb, size_t __size,
598 __compar_fn_t __compar));
601 /* Return the absolute value of X. */
602 extern int abs __P ((int __x)) __attribute__ ((__const__));
603 extern long int labs __P ((long int __x)) __attribute__ ((__const__));
605 __extension__ extern long long int llabs __P ((long long int __x))
606 __attribute__ ((__const__));
610 /* Return the `div_t', `ldiv_t' or `lldiv_t' representation
611 of the value of NUMER over DENOM. */
612 /* GCC may have built-ins for these someday. */
613 extern div_t div __P ((int __numer, int __denom)) __attribute__ ((__const__));
614 extern ldiv_t ldiv __P ((long int __numer, long int __denom))
615 __attribute__ ((__const__));
617 __extension__ extern lldiv_t lldiv __P ((long long int __numer,
618 long long int __denom))
619 __attribute__ ((__const__));
623 #if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
624 /* Convert floating point numbers to strings. The returned values are
625 valid only until another call to the same function. */
627 /* Convert VALUE to a string with NDIGIT digits and return a pointer to
628 this. Set *DECPT with the position of the decimal character and *SIGN
629 with the sign of the number. */
630 extern char *ecvt __P ((double __value, int __ndigit, int *__decpt,
633 /* Convert VALUE to a string rounded to NDIGIT decimal digits. Set *DECPT
634 with the position of the decimal character and *SIGN with the sign of
636 extern char *fcvt __P ((double __value, int __ndigit, int *__decpt,
639 /* If possible convert VALUE to a string with NDIGIT significant digits.
640 Otherwise use exponential representation. The resulting string will
641 be written to BUF. */
642 extern char *gcvt __P ((double __value, int __ndigit, char *__buf));
644 /* Long double versions of above functions. */
645 extern char *qecvt __P ((__long_double_t __value, int __ndigit, int *__decpt,
647 extern char *qfcvt __P ((__long_double_t __value, int __ndigit, int *__decpt,
649 extern char *qgcvt __P ((__long_double_t __value, int __ndigit, char *__buf));
653 /* Reentrant version of the functions above which provide their own
655 extern int ecvt_r __P ((double __value, int __ndigit, int *__decpt,
656 int *__sign, char *__buf, size_t __len));
657 extern int fcvt_r __P ((double __value, int __ndigit, int *__decpt,
658 int *__sign, char *__buf, size_t __len));
660 extern int qecvt_r __P ((__long_double_t __value, int __ndigit, int *__decpt,
661 int *__sign, char *__buf, size_t __len));
662 extern int qfcvt_r __P ((__long_double_t __value, int __ndigit, int *__decpt,
663 int *__sign, char *__buf, size_t __len));
665 #endif /* use MISC || use X/Open Unix */
668 /* Return the length of the multibyte character
669 in S, which is no longer than N. */
670 extern int mblen __P ((__const char *__s, size_t __n));
671 /* Return the length of the given multibyte character,
672 putting its `wchar_t' representation in *PWC. */
673 extern int mbtowc __P ((wchar_t *__restrict __pwc,
674 __const char *__restrict __s, size_t __n));
675 /* Put the multibyte character represented
676 by WCHAR in S, returning its length. */
677 extern int wctomb __P ((char *__s, wchar_t __wchar));
680 /* Convert a multibyte string to a wide char string. */
681 extern size_t mbstowcs __P ((wchar_t *__restrict __pwcs,
682 __const char *__restrict __s, size_t __n));
683 /* Convert a wide char string to multibyte string. */
684 extern size_t wcstombs __P ((char *__restrict __s,
685 __const wchar_t *__restrict __pwcs, size_t __n));
689 /* Determine whether the string value of RESPONSE matches the affirmation
690 or negative response expression as specified by the LC_MESSAGES category
691 in the program's current locale. Returns 1 if affirmative, 0 if
692 negative, and -1 if not matching. */
693 extern int rpmatch __P ((__const char *__response));
697 #ifdef __USE_XOPEN_EXTENDED
698 /* Parse comma separated suboption from *OPTIONP and match against
699 strings in TOKENS. If found return index and set *VALUEP to
700 optional value introduced by an equal sign. If the suboption is
701 not part of TOKENS return in *VALUEP beginning of unknown
702 suboption. On exit *OPTIONP is set to the beginning of the next
703 token or at the terminating NUL character. */
704 extern int getsubopt __P ((char **__optionp, __const char *__const *__tokens,
711 /* Setup DES tables according KEY. */
712 extern void setkey __P ((__const char *__key));
714 /* X/Open pseudo terminal handling. */
716 /* The next four functions all take a master pseudo-tty fd and
717 perform an operation on the associated slave: */
719 /* Chown the slave to the calling user. */
720 extern int grantpt __P ((int __fd));
722 /* Release an internal lock so the slave can be opened.
723 Call after grantpt(). */
724 extern int unlockpt __P ((int __fd));
726 /* Return the pathname of the pseudo terminal slave assoicated with
727 the master FD is open on, or NULL on errors.
728 The returned storage is good until the next call to this function. */
729 extern char *ptsname __P ((int __fd));
733 /* Store at most BUFLEN characters of the pathname of the slave pseudo
734 terminal associated with the master FD is open on in BUF.
735 Return 0 on success, otherwise an error number. */
736 extern int ptsname_r __P ((int __fd, char *__buf, size_t __buflen));
738 /* Open a master pseudo terminal and return its file descriptor. */
739 extern int getpt __P ((void));
742 #endif /* don't just need malloc and calloc */
743 #undef __need_malloc_and_calloc
747 #endif /* stdlib.h */