.Dd\r
.Dt abort 3\r
.Os\r
-\r
+.\"\r
.Sh NAME\r
.Nm abort\r
.Nd abnormal process termination\r
-\r
+.\"\r
.Sh SYNOPSIS\r
.In stdlib.h\r
.Fn "noreturn void abort" "void"\r
-\r
+.\"\r
.Sh DESCRIPTION\r
.Fn abort\r
causes abnormal process termination to occur.\r
-\r
+.\"\r
.Pp\r
First,\r
.Dv SIGABRT\r
It is implementation defined whether any open\r
.Vt FILE\r
streams are flushed before the process exits.\r
-\r
+.\"\r
.Sh IMPLEMENTATION NOTES\r
PDCLib implements termination (in the case that the \r
.Dv SIGABRT\r
.Nm\r
follow those defined for\r
.Fn _Exit .\r
-\r
+.\"\r
.Sh SEE ALSO\r
.Xr exit 3\r
.Xr quick_exit 3\r
.Xr _Exit 3\r
.Xr raise 3\r
-\r
+.\"\r
.Sh STANDARDS\r
.Fn abort\r
is first defined in\r
.Dd\r
.Dt assert 3\r
.Os\r
-\r
+.\"\r
.Sh NAME\r
.Nm assert\r
.Nd validate assertion\r
-\r
+.\"\r
.Sh SYNOPSIS\r
.In assert.h\r
.Fn "void assert" "<scalar expression>"\r
-\r
+.\"\r
.Sh DESCRIPTION\r
If\r
.Dv NDEBUG\r
.Nm\r
will only be printed in the error message when compiling for C99, or a later\r
revision of the C standard. \r
-\r
+.\"\r
.Sh SEE ALSO\r
.Xr _Exit 3\r
.Xr quick_exit 3\r
.Xr exit 3\r
.Xr abort 3\r
-\r
+.\"\r
.Sh STANDARDS\r
Conforming to\r
.St -isoC-90 ,\r
.Dd\r
.Dt atexit 3\r
.Os\r
-\r
+.\"\r
.Sh NAME\r
.Nm atexit\r
.Nd registration of functions to be invoked before process termination\r
-\r
+.\"\r
.Sh SYNOPSIS\r
.In stdlib.h\r
.Fn "int atexit" "void (*handler)(void)"\r
.Fn "int at_quick_exit" "void (*handler)(void)" \r
(C11, C++11)\r
-\r
+.\"\r
.Sh DESCRIPTION\r
These functions register a function to be called when the corresponding process\r
exit function is invoked. For\r
.Fn at_quick_exit\r
the function will be invoked when the process is terminated by calling\r
.Fn quick_exit .\r
-\r
+.\"\r
.Pp\r
These functions are used in order to permit a program to perform actions before\r
a process is terminated; for example, releasing an interprocess semaphore. \r
is to support the abandonning of a process when normal process termination might\r
not be possible; at_quick_exit handlers should therefore be used sparingly and\r
only when their use is essential.\r
-\r
+.\"\r
.Pp\r
The standard guarantees that \r
.Fn atexit\r
and\r
.Fn at_quick_exit\r
may each be called at least 32 times successfully.\r
-\r
+.\"\r
.Pp\r
.Fn atexit \r
and\r
handlers are called in reverse order of the order they were registered in. For\r
precise details of their ordering, see\r
.Xr exit 3 .\r
-\r
+.\"\r
.Pp\r
The result of exiting from a handler registered with\r
.Fn atexit\r
should throw, \r
.Fn std::terminate\r
is invoked.\r
-\r
+.\"\r
.Pp\r
Undefined behaviour results if an \r
.Fn atexit\r
.Fn exit\r
or\r
.Fn quick_exit . \r
-\r
+.\"\r
.Sh RETURN VALUES\r
Returns 0 to indicate success; nonzero returns indicate failure.\r
-\r
+.\"\r
.Sh ERRORS\r
No errors are defined\r
-\r
+.\"\r
.Sh SEE ALSO\r
.Xr abort 3\r
.Xr exit 3\r
.Xr quick_exit 3\r
.Xr _Exit 3\r
-\r
+.\"\r
.Sh STANDARDS\r
.Fn atexit\r
is first defined in\r
.Dd\r
.Dt ERRNO 3\r
.Os\r
-\r
+.\"\r
.Sh NAME\r
.Nm errno\r
.Nd library error result\r
-\r
+.\"\r
.Sh SYNOPSIS\r
.In errno.h\r
.Pp\r
.Va extern int errno .\r
This is no longer supported by the POSIX or C standards, and will not work on \r
the majority of implementations, including this one.\r
-\r
+.\"\r
.Sh SEE ALSO\r
.Xr errno.h 3\r
.Xr abort 3\r
.Dd\r
.Dt exit 3\r
.Os\r
-\r
+.\"\r
.Sh NAME\r
.Nm exit\r
.Nd terminates the process\r
-\r
+.\"\r
.Sh SYNOPSIS\r
.In stdlib.h\r
.Fn "noreturn void exit" "int status"\r
.Fn "noreturn void quick_exit" "int status"\r
.Fn "noreturn void _Exit" "int exitcode"\r
-\r
+.\"\r
.Sh DESCRIPTION\r
Calling any of these three functions terminates the current process, returning \r
the exit code passed as a parameter. The interpretation of the exit code is \r
shall indicate successful completion and\r
.Dv EXIT_FAILURE\r
shall indicate a non-successful completion.\r
-\r
+.\"\r
.Pp\r
.Fn exit\r
first destroys all objects with C++ thread local storage duration (the C \r
are\r
.Sy not\r
called.\r
-\r
+.\"\r
.Pp\r
.Fn quick_exit\r
invokes any functions registered with\r
.Fn _Exit .\r
No signal handlers are called, nor are any functions registered with\r
.Fn atexit .\r
-\r
+.\"\r
.Pp\r
.Fn _Exit\r
returns control to the controlling environment without invoking any functions\r
objects of static storage duration. Whether or not any open \r
.Vt FILE\r
streams with unwritten data are flushed or not is undefined.\r
-\r
+.\"\r
.Pp\r
The result of aborting a call to \r
.Fn exit\r
should throw, \r
.Fn std::terminate\r
is invoked.\r
-\r
+.\"\r
.Pp\r
Undefined behaviour results if, while a call to\r
.Fn exit\r
or\r
.Fn quick_exit\r
is made. \r
-\r
+.\"\r
.Sh IMPLEMENTATION NOTES\r
PDCLib implements the process of flushing streams in\r
.Fn _Exit ,\r
calls it after all\r
.Fn atexit\r
handlers have been invoked.\r
-\r
+.\"\r
.Sh SEE ALSO\r
.Xr abort 3\r
.Xr atexit 3\r
.Xr at_quick_exit 3\r
-\r
+.\"\r
.Sh STANDARDS\r
.Fn exit\r
is first defined in\r
.Dd\r
.Dt flockfile 3\r
.Os\r
-\r
+.\"\r
.Sh NAME\r
.Nm flockfile, ftrylockfile, funlockfile\r
.Nd stdio file locking\r
-\r
+.\"\r
.Sh SYNOPSIS\r
.Sy #define _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || _SVID_SOURCE || _BSD_SOURCE\r
-\r
+.\"\r
.In stdio.h\r
.Fn "void flockfile" "FILE *file"\r
.Fn "int ftrylockfile" "FILE *file"\r
.Fn "void funlockfile" "FILE *file"\r
-\r
+.\"\r
.Sh DESCRIPTION\r
.Fn flockfile\r
locks the passed FILE stream for access by the calling thread, potentially \r
.\"\r
.Pp\r
No other thread may do I/O through the locked file while it is locked.\r
-\r
+.\"\r
.Sh IMPLEMENTATION NOTES\r
PDCLib implements the file locking on top of the Mutex primitives added by C11\r
-\r
+.\"\r
.Sh SEE ALSO\r
.Xr fopen 3\r
.Xr fclose 3\r
.Xr unlocked_stdio 3\r
.Xr mtx_t 3\r
-\r
+.\"\r
.Sh STANDARDS\r
The locked I/O routines were initially introduced in \r
.St -svid4 ,\r
and incorporated into POSIX in \r
-.St -p1003.1-2001 .\r
+.St -p1003.1-2001 .
\ No newline at end of file
.Dd\r
.Dt PDCLIB 3\r
.Os\r
-\r
+.\"\r
.Sh NAME\r
.Nm PDCLib\r
.Nd Public domain, portable C library\r
-\r
+.\"\r
.Sh LIBRARY\r
.Lb pdclib\r
.Sh SYNOPSIS\r
.In threads.h\r
.In time.h\r
.In wchar.h\r
-\r
+.\"\r
.Sh DESCRIPTION\r
The\r
.Nm\r
.br\r
.Fn "char * strdup" "const char *"\r
.Ed\r
-\r
+.\"\r
it is documented that defining either \r
.Dv _XOPEN_SOURCE\r
or\r
.In string.h\r
will expose a definition of the function\r
.Fn strdup\r
-\r
+.\"\r
.Sh SEE ALSO\r
.Xr cc 1 ,\r
.Xr c++ 7\r
.Mt pdclib@owenshepherd.net .\r
Based upon work by\r
.An Martin "Solar" Baute ,\r
-.Mt solar@rootdirectory.de .\r
+.Mt solar@rootdirectory.de .
\ No newline at end of file
.Dd\r
.Dt strdup 3\r
.Os\r
-\r
+.\"\r
.Sh NAME\r
.Nm strdup\r
.Nd string duplication\r
-\r
+.\"\r
.Sh SYNOPSIS\r
.Sy #define _XOPEN_SOURCE || _POSIX_C_SOURCE >= 200809L\r
.In string.h\r
.Sy #define _POSIX_C_SOURCE >= 200809L\r
.In string.h\r
.Fn "char *strndup" "const char *str" "size_t len"\r
-\r
+.\"\r
.Sh DESCRIPTION\r
.Fn strdup\r
allocates a new buffer of sufficient size as to be able to hold the entirety of\r
including the terminating character, and copies the contents of\r
.Va str\r
into it.\r
-\r
+.\"\r
.Pp\r
.Fn strndup\r
allocates a buffer large enough to contain\r
characters of \r
.Va str\r
are then copied into it, and a null character appended.\r
-\r
+.\"\r
.Pp\r
The buffers returned by these functions must be released by a call to\r
.Fn free .\r
-\r
+.\"\r
.Sh SEE ALSO\r
.Xr free 3\r
.Xr malloc 3\r
.Xr strcpy 3\r
.Xr strncpy 3\r
-\r
+.\"\r
.Sh STANDARDS\r
.Fn strdup\r
first specified in \r
and the preprocessor constant\r
.Dv NULL\r
shall be defined.\r
-\r
+.\"\r
.Pp\r
The following shall be defined as functions:\r
.br\r