diff --git a/libc/functions/README.md b/libc/functions/README.md index d9c88509..ee20ad4f 100644 --- a/libc/functions/README.md +++ b/libc/functions/README.md @@ -1,6 +1,6 @@ # Functions -## _ +## \_ [`_exit`](./_/_Exit.part-impl.md) [`_Exit`](./_/_Exit.part-impl.md) @@ -99,6 +99,7 @@ endthread, [`fputc`](./f/fputc.part-impl.md), [`fputs`](./f/fputs.part-impl.md), [`fread`](./f/fread.part-impl.md), +[`free`](./f/free.part-impl.md), [`freeaddrinfo`](./g/getaddrinfo.part-impl.md), [`freopen`](./f/freopen.part-impl.md), [`frexp`](./f/frexp.part-impl.md), @@ -106,6 +107,7 @@ endthread, [`fscanf`](./f/fscanf.part-impl.md), [`fseek`](./f/fseek.part-impl.md), [`fseeko`](./f/fseek.part-impl.md), +[`fstat`](./f/fstat.part-impl.md), [`fstatat`](./s/stat.part-impl.md), [`fsync`](./f/fsync.not-impl.md), [`ftell`](./f/ftell.part-impl.md), @@ -146,8 +148,20 @@ gettime, ## i interrupt, +[`isalnum`](./i/isalnum.part-impl.md), +[`isalpha`](./i/isalpha.part-impl.md), [`isatty`](./i/isatty.part-impl.md), [`ioctl`](./i/ioctl.part-impl.md), +[`isblank`](./i/isblank.part-impl.md), +[`iscntrl`](./i/iscntrl.part-impl.md), +[`isdigit`](./i/isdigit.part-impl.md), +[`isgraph`](./i/isgraph.part-impl.md), +[`islower`](./i/islower.part-impl.md), +[`isprint`](./i/isprint.part-impl.md), +[`ispunct`](./i/ispunct.part-impl.md), +[`isspace`](./i/isspace.part-impl.md), +[`isupper`](./i/isupper.part-impl.md), +[`isxdigit`](./i/isxdigit.part-impl.md), ## k @@ -285,6 +299,8 @@ resourceDestroy, [`strcoll`](./s/strcoll.part-impl.md), [`strcpy`](./s/strcpy.part-impl.md), [`strcspn`](./s/strcspn.part-impl.md), +[`strdup`](./s/strdup.part-impl.md), +[`strerror`](./s/strerror.part-impl.md), [`strlen`](./s/strlen.part-impl.md), [`strncat`](./s/strncat.part-impl.md), [`strncmp`](./s/strncmp.part-impl.md), @@ -292,6 +308,7 @@ resourceDestroy, [`strncpy`](./s/strncpy.part-impl.md), [`strpbrk`](./s/strpbrk.part-impl.md), [`strrchr`](./s/strrchr.part-impl.md), +[`strsignal`](./s/strsignal.part-impl.md), [`strspn`](./s/strspn.part-impl.md), [`strstr`](./s/strstr.part-impl.md), [`strtod`](./s/strtod.part-impl.md), @@ -325,6 +342,8 @@ timeGet, timeSet, [`tmpfile`](./t/tmpfile.part-impl.md), [`tmpnam`](./t/tmpnam.part-impl.md), +[`tolower`](./t/tolower.part-impl.md), +[`toupper`](./t/toupper.part-impl.md), [`truncate`](./t/truncate.part-impl.md), [`ttyname`](./t/ttyname.not-impl.md), [`ttyname_r`](./t/ttyname.not-impl.md), diff --git a/libc/functions/f/free.impl.md b/libc/functions/f/free.impl.md deleted file mode 100644 index 9041c0d4..00000000 --- a/libc/functions/f/free.impl.md +++ /dev/null @@ -1,25 +0,0 @@ -###Synopsis - -`#include ` - -`void free(void *ptr);` - -###Description - -The function deallocates the memory previously allocated by a call to `calloc()`, `malloc()`, or `realloc()`. If ptr is a `NULL` pointer, no operation is performed. - -Arguments: - -ptr - the pointer to the allocated earlier memory. - -###Return value - -None. - -###Errors - -No errors are defined. - -###Implementation tasks - -* None. diff --git a/libc/functions/f/free.part-impl.md b/libc/functions/f/free.part-impl.md new file mode 100644 index 00000000..867d170d --- /dev/null +++ b/libc/functions/f/free.part-impl.md @@ -0,0 +1,36 @@ +# Synopsis + +`#include ` + +`void free(void *ptr);` + +## Description + +The `free()` function shall cause the space pointed to by _ptr_ to be deallocated; that is, made available for further +allocation. +If _ptr_ is a null pointer, no action shall occur. Otherwise, if the argument does not match a pointer earlier returned +by a function in `POSIX.1-2017` that allocates memory as if by `malloc()`, or if the space has been deallocated by a +call to `free()` or `realloc()`, the behavior is undefined. + +Any use of a pointer that refers to freed space results in undefined behavior. + +## Return value + +The `free()` function shall not return a value. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/f/fstat.part-impl.md b/libc/functions/f/fstat.part-impl.md new file mode 100644 index 00000000..54d6695a --- /dev/null +++ b/libc/functions/f/fstat.part-impl.md @@ -0,0 +1,65 @@ +# Synopsis + +`#include ` + +`int fstat(int fildes, struct stat *buf);` + +## Description + +The `fstat()` function shall obtain information about an open file associated with the file descriptor _fildes_, and +shall write it to the area pointed to by _buf_. + +If _fildes_ references a shared memory object, the implementation shall update in the _stat_ structure pointed to by the +_buf_ argument the `st_uid`, `st_gid`, `st_size`, and `st_mode` fields, and only the `S_IRUSR`, `S_IWUSR`, `S_IRGRP`, +`S_IWGRP`, `S_IROTH`, and `S_IWOTH` file permission bits need be valid. The implementation may update other fields +and flags. + +If _fildes_ references a typed memory object, the implementation shall update in the stat structure pointed to by the +_buf_ argument the `st_uid`, `st_gid`, `st_size`, and `st_mode` fields, and only the `S_IRUSR`, `S_IWUSR`, `S_IRGRP`, +`S_IWGRP`, `S_IROTH`, and `S_IWOTH` file permission bits need be valid. The implementation may update other fields and +flags. + +The _buf_ argument is a pointer to a _stat_ structure, as defined in ``, into which information is placed +concerning the file. + +For all other file types defined in this volume of `POSIX.1-2017`, the structure members `st_mode`, `st_ino`, `st_dev`, +`st_uid`, `st_gid`, `st_atim`, `st_ctim`, and `st_mtim` shall have meaningful values and the value of the `st_nlink` +member shall be set to the number of links to the file. + +An implementation that provides additional or alternative file access control mechanisms may, under +implementation-defined conditions, cause `fstat()` to fail. + +The `fstat()` function shall update any time-related fields, before writing into the _stat_ structure. + +## Return value + +Upon successful completion, `0` shall be returned. Otherwise, `-1` shall be returned and _errno_ set to indicate the +error. + +## Errors + +The `fstat()` function shall fail if: + +- `[EBADF]` - The _fildes_ argument is not a valid file descriptor. + +- `[EIO]` - An _I/O_ error occurred while reading from the file system. + +- `[EOVERFLOW]` - The file size in bytes or the number of blocks allocated to the file or the file serial number cannot +be represented correctly in the structure pointed to by _buf_. + +The `fstat()` function may fail if: + +- `[EOVERFLOW]`- One of the values is too large to store into the structure pointed to by the _buf_ argument. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isalnum.part-impl.md b/libc/functions/i/isalnum.part-impl.md new file mode 100644 index 00000000..dd75cd4c --- /dev/null +++ b/libc/functions/i/isalnum.part-impl.md @@ -0,0 +1,33 @@ +# Synopsis + +`#include ` + +`int isalnum(int c);` + +## Description + +The `isalnum()` function shall test whether _c_ is a character of class _alpha_ or _digit_ in the current locale. + +The _c_ argument is an `int`, the value of which the application shall ensure is representable as an `unsigned char` or +equal to the value of the macro `EOF`. If the argument has any other value, the behavior is undefined. + +## Return value + +The `isalnum()` function shall return non-zero if _c_ is an alphanumeric character, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isalpha.part-impl.md b/libc/functions/i/isalpha.part-impl.md new file mode 100644 index 00000000..19a3b1ec --- /dev/null +++ b/libc/functions/i/isalpha.part-impl.md @@ -0,0 +1,33 @@ +# Synopsis + +`#include ` + +`int isalpha(int c);` + +## Description + +The `isalpha()` function shall test whether _c_ is a character of class _alpha_ in the current locale. + +The _c_ argument is an `int`, the value of which the application shall ensure is representable as an `unsigned char` or +equal to the value of the macro `EOF`. If the argument has any other value, the behavior is undefined. + +## Return value + +The `isalpha()` function shall return non-zero if _c_ is an alphanumeric character, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isatty.part-impl.md b/libc/functions/i/isatty.part-impl.md index a11a94d1..56991878 100644 --- a/libc/functions/i/isatty.part-impl.md +++ b/libc/functions/i/isatty.part-impl.md @@ -1,39 +1,34 @@ -# Synopsis +# Synopsis + `#include `
-` int isatty(int fildes);`
+`int isatty(int fildes);`
## Status + Partially implemented + ## Conformance + IEEE Std 1003.1-2017 -## Description +## Description -The `isatty()` function shall test whether fildes, an open file descriptor, is associated with a terminal +The `isatty()` function shall test whether _fildes_, an open file descriptor, is associated with a terminal device. - ## Return value - -The `isatty()` function shall return 1 if fildes is associated with a terminal; otherwise, it shall return 0 and may +The `isatty()` function shall return 1 if _fildes_ is associated with a terminal; otherwise, it shall return 0 and may set errno to indicate the error. - ## Errors - The `isatty()` function may fail if: +* `EBADF` - The _fildes_ argument is not a valid open file descriptor. - * `EBADF` - The fildes argument is not a valid open file descriptor. - - * `ENOTTY` - The file associated with the fildes argument is not a terminal. - - - - +* `ENOTTY` - The file associated with the _fildes_ argument is not a terminal. ## Tests @@ -43,6 +38,7 @@ Untested None -## See Also +## See Also + 1. [Standard library functions](../README.md) 2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isblank.part-impl.md b/libc/functions/i/isblank.part-impl.md new file mode 100644 index 00000000..f646ef54 --- /dev/null +++ b/libc/functions/i/isblank.part-impl.md @@ -0,0 +1,34 @@ +# Synopsis + +`#include ` + +`int isblank(int c);` + +## Description + +The `isblank()` function shall test whether _c_ is a character of class _blank_ in the current locale. + +The _c_ argument is a type `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `isblank()` function shall return non-zero if _c_ is a ``, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/iscntrl.part-impl.md b/libc/functions/i/iscntrl.part-impl.md new file mode 100644 index 00000000..0e36b69d --- /dev/null +++ b/libc/functions/i/iscntrl.part-impl.md @@ -0,0 +1,34 @@ +# Synopsis + +`#include ` + +`int iscntrl(int c);` + +## Description + +The `iscntrl()` function shall test whether _c_ is a character of class _cntrl_ in the current locale. + +The _c_ argument is a type `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `iscntrl()` function shall return non-zero if _c_ is a control character, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isdigit.part-impl.md b/libc/functions/i/isdigit.part-impl.md new file mode 100644 index 00000000..62b3235f --- /dev/null +++ b/libc/functions/i/isdigit.part-impl.md @@ -0,0 +1,34 @@ +# Synopsis + +`#include ` + +`int isdigit(int c);` + +## Description + +The `isdigit()` function shall test whether _c_ is a character of class _digit_ in the current locale. + +The _c_ argument is an `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `isdigit()` function shall return non-zero if _c_ is decimal digit, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isgraph.part-impl.md b/libc/functions/i/isgraph.part-impl.md new file mode 100644 index 00000000..c5ee9162 --- /dev/null +++ b/libc/functions/i/isgraph.part-impl.md @@ -0,0 +1,35 @@ +# Synopsis + +`#include ` + +`int isgraph(int c);` + +## Description + +The `isgraph()` functions shall test whether _c_ is a character of class _graph_ in the current locale. + +The _c_ argument is an `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `isgraph()` function shall return non-zero if _c_ is a character with a visible representation, otherwise shall +return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/islower.part-impl.md b/libc/functions/i/islower.part-impl.md new file mode 100644 index 00000000..e6942366 --- /dev/null +++ b/libc/functions/i/islower.part-impl.md @@ -0,0 +1,34 @@ +# Synopsis + +`#include ` + +`int islower(int c);` + +## Description + +The `islower()` function shall test whether _c_ is a character of class _lower_ in the current locale. + +The _c_ argument is an `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `islower()` function shall return non-zero if _c_ is a lowercase letter, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isprint.part-impl.md b/libc/functions/i/isprint.part-impl.md new file mode 100644 index 00000000..2b41f2af --- /dev/null +++ b/libc/functions/i/isprint.part-impl.md @@ -0,0 +1,34 @@ +# Synopsis + +`#include ` + +`int isprint(int c);` + +## Description + +The `isprint()` function shall test whether _c_ is a character of class _print_ in the current locale. + +The _c_ argument is an `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `isprint()` function shall return non-zero if _c_ is a lowercase letter, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/ispunct.part-impl.md b/libc/functions/i/ispunct.part-impl.md new file mode 100644 index 00000000..4bbef0eb --- /dev/null +++ b/libc/functions/i/ispunct.part-impl.md @@ -0,0 +1,34 @@ +# Synopsis + +`#include ` + +`int ispunct(int c);` + +## Description + +The `ispunct()` function shall test whether _c_ is a character of class `punct` in the current locale. + +The _c_ argument is an `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `ispunct()` function shall return non-zero if _c_ is a punctuation character, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isspace.part-impl.md b/libc/functions/i/isspace.part-impl.md new file mode 100644 index 00000000..a951c499 --- /dev/null +++ b/libc/functions/i/isspace.part-impl.md @@ -0,0 +1,35 @@ +# Synopsis + +`# include ` + +`int isspace(int c);` + +## Description + +The `isspace()` function shall test whether _c_ is a character of class _space_ in the current +_locale_. + +The _c_ argument is an `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `isspace()` function shall return non-zero if _c_ is a white-space character; otherwise, they shall return 0. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isupper.part-impl.md b/libc/functions/i/isupper.part-impl.md new file mode 100644 index 00000000..e2e7f63d --- /dev/null +++ b/libc/functions/i/isupper.part-impl.md @@ -0,0 +1,34 @@ +# Synopsis + +`#include ` + +`int isupper(int c);` + +## Description + +The `isupper()` function shall test whether _c_ is a character of class `upper` in the current locale. + +The _c_ argument is an `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `isupper()` function shall return non-zero if _c_ is an uppercase letter, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/i/isxdigit.part-impl.md b/libc/functions/i/isxdigit.part-impl.md new file mode 100644 index 00000000..67e98b48 --- /dev/null +++ b/libc/functions/i/isxdigit.part-impl.md @@ -0,0 +1,34 @@ +# Synopsis + +`#include ` + +`int isxdigit(int c);` + +## Description + +The `isxdigit()` function shall test whether _c_ is a character of class `xdigit` in the current locale. + +The _c_ argument is an `int`, the value of which the application shall ensure is a character representable as an +`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is +undefined. + +## Return value + +The `isxdigit()` function shall return non-zero if _c_ is a hexadecimal digit, otherwise shall return `0`. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/s/strdup.part-impl.md b/libc/functions/s/strdup.part-impl.md new file mode 100644 index 00000000..d4082531 --- /dev/null +++ b/libc/functions/s/strdup.part-impl.md @@ -0,0 +1,50 @@ +# Synopsis + +`#include ` + +`char *strdup(const char *s);` + +`char *strndup(const char *s, size_t size);` + +## Description + +The `strdup()` function shall return a pointer to a new string, which is a duplicate of the string pointed to by _s_. +The returned pointer can be passed to `free()`. A `null` pointer is returned if the new string cannot be created. + +The `strndup()` function shall be equivalent to the `strdup()` function, duplicating the provided _s_ in a new block of +memory allocated as if by using `malloc()`, with the exception being that `strndup()` copies at most _size_ plus one +byte into the newly allocated memory, terminating the new string with a `NUL` character. + +If the length of _s_ is larger than _size_, only _size_ bytes shall be duplicated. + +If _size_ is larger than the length of _s_, all bytes in _s_ shall be copied into the new memory buffer, including the +terminating `NUL` character. + +The newly created string shall always be properly terminated. + +## Return value + +The `strdup()` function shall return a pointer to a new string on success. Otherwise, it shall return a null pointer and +set errno to indicate the error. + +Upon successful completion, the `strndup()` function shall return a pointer to the newly allocated memory containing the +duplicated string. Otherwise, it shall return a null pointer and set errno to indicate the error. + +## Errors + +These functions shall fail if: + +- `[ENOMEM]` - Storage space available is insufficient. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/s/strerror.part-impl.md b/libc/functions/s/strerror.part-impl.md new file mode 100644 index 00000000..71c666df --- /dev/null +++ b/libc/functions/s/strerror.part-impl.md @@ -0,0 +1,83 @@ +# Synopsis + +`#include ` + +`char *strerror(int errnum);` + +`char *strerror_l(int errnum, locale_t locale);` + +`int strerror_r(int errnum, char *strerrbuf, size_t buflen);` + +## Description + +The `strerror()` function shall map the error number in _errnum_ to a locale-dependent error message string and shall +return a pointer to it. Typically, the values for _errnum_ come from errno, but `strerror()` shall map any value of +type int to a message. + +The application shall not modify the string returned. The returned string pointer might be invalidated, or the string +content might be overwritten by a subsequent call to `strerror()`, or by a subsequent call to `strerror_l()` in the same +thread. The returned pointer and the string content might also be invalidated if the calling thread is terminated. + +The string may be overwritten by a subsequent call to `strerror_l()` in the same thread. + +The contents of the error message strings returned by `strerror()` should be determined by the setting of the +`LC_MESSAGES` category in the current _locale_. + +The implementation shall behave as if no function defined in this volume of POSIX.1-2017 calls `strerror()`. + +The `strerror()` and `strerror_l()` functions shall not change the setting of errno if successful. + +Since no return value is reserved to indicate an error of `strerror()`, an application wishing to check for error +situations should set errno to 0, then call `strerror()`, then check errno. Similarly, since `strerror_l()` is +required to return a string for some errors, an application wishing to check for all error situations should set errno +to 0, then call `strerror_l()`, then check errno. + +The `strerror()` function need not be thread-safe. + +The `strerror_l()` function shall map the error number in _errnum_ to a locale-dependent error message string in the +_locale_ represented by _locale_ and shall return a pointer to it. + +The `strerror_r()` function shall map the error number in _errnum_ to a locale-dependent error message string and shall +return the string in the buffer pointed to by _strerrbuf_, with length _buflen_. + +If the value of _errnum_ is a valid error number, the message string shall indicate what error occurred; if the value of +_errnum_ is zero, the message string shall either be an empty string or indicate that no error occurred; otherwise, if +these functions complete successfully, the message string shall indicate that an unknown error occurred. + +The behavior is undefined if the _locale_ argument to `strerror_l()` is the special _locale_ object `LC_GLOBAL_LOCALE` +or is not a valid _locale_ object handle. + +## Return value + +Upon completion, whether successful or not, `strerror()` shall return a pointer to the generated message string. On +error errno may be set, but no return value is reserved to indicate an error. + +Upon successful completion, `strerror_l()` shall return a pointer to the generated message string. If errnum is not a +valid error number, errno may be set to `[EINVAL]`, but a pointer to a message string shall still be returned. If any +other error occurs, errno shall be set to indicate the error and a null pointer shall be returned. + +Upon successful completion, `strerror_r()` shall return `0`. Otherwise, an error number shall be returned to indicate +the error. + +## Errors + +These functions may fail if: + +- `[EINVAL]` The value of _errnum_ is neither a valid error number nor zero. + +The `strerror_r()` function may fail if: + +- `[ERANGE]` Insufficient storage was supplied via _strerrbuf_ and _buflen_ to contain the generated message string. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/s/strsignal.part-impl.md b/libc/functions/s/strsignal.part-impl.md new file mode 100644 index 00000000..6a87035e --- /dev/null +++ b/libc/functions/s/strsignal.part-impl.md @@ -0,0 +1,46 @@ +# Synopsis + +`#include ` + +`char *strsignal(int signum);` + +## Description + +The `strsignal()` function shall map the signal number in _signum_ to an implementation-defined string and shall return +a pointer to it. It shall use the same set of messages as the `psignal()` function. + +The application shall not modify the string returned. The returned pointer might be invalidated, or the string content +might be overwritten by a subsequent call to `strsignal()` or `setlocale()`. The returned pointer might also be +invalidated if the calling thread is terminated. + +The contents of the message strings returned by `strsignal()` should be determined by the setting of the `LC_MESSAGES` + category in the current locale. + +The implementation shall behave as if no function defined in this standard calls `strsignal()`. + +Since no return value is reserved to indicate an error, an application wishing to check for error situations should set +errno to `0`, then call `strsignal()`, then check errno. + +The `strsignal()` function need not be thread-safe. + +## Return value + +Upon successful completion, `strsignal()` shall return a pointer to a string. Otherwise, if _signum_ is not a valid +signal number, the return value is unspecified. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/t/tolower.part-impl.md b/libc/functions/t/tolower.part-impl.md new file mode 100644 index 00000000..def1bd7e --- /dev/null +++ b/libc/functions/t/tolower.part-impl.md @@ -0,0 +1,40 @@ +# Synopsis + +`#include ` + +`int tolower(int c);` + +## Description + +The `tolower()` function has as a domain a type `int`, the value of which is representable as a `unsigned char` or the +value of `EOF`. + +If the argument has any other value, the behavior is undefined. + +If the argument of `tolower()` represents an uppercase letter, and there exists a corresponding lowercase letter as +defined by character type information in the current locale respectively the result shall be the corresponding lowercase +letter. + +All other arguments in the domain are returned unchanged. + +## Return value + +Upon successful completion, the `tolower()` function shall return the lowercase letter corresponding to the argument +passed, otherwise, they shall return the argument unchanged. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md) diff --git a/libc/functions/t/toupper.part-impl.md b/libc/functions/t/toupper.part-impl.md new file mode 100644 index 00000000..977cf63e --- /dev/null +++ b/libc/functions/t/toupper.part-impl.md @@ -0,0 +1,40 @@ +# Synopsis + +`#include ` + +`int toupper(int c);` + +## Description + +The `toupper()` function has as a domain a type `int`, the value of which is representable as a `unsigned char` or the +value of `EOF`. + +If the argument has any other value, the behavior is undefined. + +If the argument of `toupper()` represents a lowercase letter, and there exists a corresponding uppercase letter as +defined by character type information in the current locale respectively the result shall be the corresponding uppercase +letter. + +All other arguments in the domain are returned unchanged. + +## Return value + +Upon successful completion, the `toupper()` function shall return the uppercase letter corresponding to the argument +passed, otherwise, they shall return the argument unchanged. + +## Errors + +No errors are defined. + +## Tests + +Tested + +## Known bugs + +None + +## See Also + +1. [Standard library functions](../README.md) +2. [Table of Contents](../../../README.md)