posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
POSIX_C_LIB_EXT

POSIX C Library Extension option group. More...

Files

file  monetary.h
 POSIX monetary formatting functions (<monetary.h>)
 

Macros

#define FNM_NOMATCH   1
 Return value of fnmatch() indicating the string did not match the pattern.
 
#define FNM_NOESCAPE   0x01
 Flag: treat backslash as an ordinary character rather than an escape character.
 
#define FNM_PATHNAME   0x02
 Flag: a slash must be matched by a slash (not '?' or '*' or a bracket expression).
 
#define FNM_PERIOD   0x04
 Flag: a leading '.
 
#define FNM_IGNORECASE   FNM_CASEFOLD
 Alias for FNM_CASEFOLD.
 

Functions

int fnmatch (const char *pattern, const char *string, int flags)
 Match a filename or path against a shell-style pattern.
 
ssize_t strfmon (char *ZRESTRICT s, size_t maxsize, const char *ZRESTRICT format,...)
 Format a monetary value into a string according to the current locale.
 
ssize_t strfmon_l (char *ZRESTRICT s, size_t maxsize, locale_t locale, const char *ZRESTRICT format,...)
 Format a monetary value using the specified locale.
 
int getsubopt (char **optionp, char *const *keylistp, char **valuep)
 Parse sub-options from a command-line argument string.
 
size_t strftime_l (char *ZRESTRICT s, size_t maxsize, const char *ZRESTRICT format, const struct tm *ZRESTRICT timeptr, locale_t locale)
 Format broken-down time into a string using the specified locale.
 
int getopt (int argc, char *const argv[], const char *optstring)
 Parse command-line options.
 

Variables

char * optarg
 Argument for the current option from getopt().
 
int opterr
 Error flag for getopt() (non-zero enables error messages).
 
int optind
 Index of the next element to be processed by getopt().
 
int optopt
 Unrecognised option character from getopt().
 

Detailed Description

POSIX C Library Extension option group.

Macro Definition Documentation

◆ FNM_IGNORECASE

#define FNM_IGNORECASE   FNM_CASEFOLD

Alias for FNM_CASEFOLD.

Definition at line 40 of file fnmatch.h.

◆ FNM_NOESCAPE

#define FNM_NOESCAPE   0x01

Flag: treat backslash as an ordinary character rather than an escape character.

Definition at line 26 of file fnmatch.h.

◆ FNM_NOMATCH

#define FNM_NOMATCH   1

Return value of fnmatch() indicating the string did not match the pattern.

Definition at line 24 of file fnmatch.h.

◆ FNM_PATHNAME

#define FNM_PATHNAME   0x02

Flag: a slash must be matched by a slash (not '?' or '*' or a bracket expression).

Definition at line 28 of file fnmatch.h.

◆ FNM_PERIOD

#define FNM_PERIOD   0x04

Flag: a leading '.

' must be matched explicitly.

Definition at line 30 of file fnmatch.h.

Function Documentation

◆ fnmatch()

int fnmatch ( const char *  pattern,
const char *  string,
int  flags 
)

Match a filename or path against a shell-style pattern.

Parameters
patternShell pattern (using ?, *, and bracket expressions).
stringString to test against pattern.
flagsCombination of FNM_* flags, or 0 for default matching.
Returns
0 if string matches pattern, FNM_NOMATCH if it does not, or a non-zero value on error.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fnmatch.html

◆ getopt()

int getopt ( int  argc,
char *const  argv[],
const char *  optstring 
)

◆ getsubopt()

int getsubopt ( char **  optionp,
char *const *  keylistp,
char **  valuep 
)

Parse sub-options from a command-line argument string.

Modifies *optionp in place, separating comma-delimited sub-options.

Parameters
optionpPointer to the option string; advanced past each parsed token.
keylistpNULL-terminated array of recognised keyword strings.
valuepOutput: pointer to the value part after '=', or NULL.
Returns
Index into keylistp of the matched keyword, or -1 if not found.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html

◆ strfmon()

ssize_t strfmon ( char *ZRESTRICT  s,
size_t  maxsize,
const char *ZRESTRICT  format,
  ... 
)

Format a monetary value into a string according to the current locale.

Parameters
sOutput buffer.
maxsizeMaximum number of bytes (including NUL) to write.
formatConversion format string (%-based, similar to printf).
...Monetary values to format (type double).
Returns
Number of bytes written (excluding NUL) on success, or -1 on error.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html

◆ strfmon_l()

ssize_t strfmon_l ( char *ZRESTRICT  s,
size_t  maxsize,
locale_t  locale,
const char *ZRESTRICT  format,
  ... 
)

Format a monetary value using the specified locale.

Parameters
sOutput buffer.
maxsizeMaximum number of bytes (including NUL) to write.
localeLocale to use for formatting.
formatConversion format string.
...Monetary values to format (type double).
Returns
Number of bytes written (excluding NUL) on success, or -1 on error.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon_l.html

◆ strftime_l()

size_t strftime_l ( char *ZRESTRICT  s,
size_t  maxsize,
const char *ZRESTRICT  format,
const struct tm *ZRESTRICT  timeptr,
locale_t  locale 
)

Format broken-down time into a string using the specified locale.

Parameters
sOutput buffer.
maxsizeMaximum number of bytes to write including the NUL terminator.
formatFormat string (same syntax as strftime()).
timeptrBroken-down time to format.
localeLocale to use for formatting.
Returns
Number of bytes written (excluding NUL) on success, or 0 if maxsize was exceeded.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime_l.html

Variable Documentation

◆ optarg

char* optarg
extern

Argument for the current option from getopt().

◆ opterr

int opterr
extern

Error flag for getopt() (non-zero enables error messages).

◆ optind

int optind
extern

Index of the next element to be processed by getopt().

◆ optopt

int optopt
extern

Unrecognised option character from getopt().