DDraceNetwork Documentation
Loading...
Searching...
No Matches
OS

Classes

class  CCmdlineFix

Functions

void cmdline_fix (int *argc, const char ***argv)
void cmdline_free (int argc, const char **argv)
int os_open_link (const char *link)
int os_open_file (const char *path)
bool os_version_str (char *version, size_t length)
void os_locale_str (char *locale, size_t length)

Detailed Description

OS specific functionality.

Function Documentation

◆ cmdline_fix()

void cmdline_fix ( int * argc,
const char *** argv )

Fixes the command line arguments to be encoded in UTF-8 on all systems.

Parameters
argcA pointer to the argc parameter that was passed to the main function.
argvA pointer to the argv parameter that was passed to the main function.
Remarks
You need to call cmdline_free once you're no longer using the results.

◆ cmdline_free()

void cmdline_free ( int argc,
const char ** argv )

Frees memory that was allocated by cmdline_fix.

Parameters
argcThe argc obtained from cmdline_fix.
argvThe argv obtained from cmdline_fix.

◆ os_locale_str()

void os_locale_str ( char * locale,
size_t length )

Returns a string of the preferred locale of the user / operating system. The string conforms to RFC 3066 and only contains the characters a-z, A-Z, 0-9 and -. If the preferred locale could not be determined this function falls back to the locale "en-US".

Parameters
localeBuffer to use for the output.
lengthLength of the output buffer.
Remarks
The strings are treated as null-terminated strings.

◆ os_open_file()

int os_open_file ( const char * path)

Opens a file or directory with the default program.

Parameters
pathThe file or folder to open with the default program.
Returns
1 on success, 0 on failure.
Remarks
The strings are treated as null-terminated strings.
This may not be called with untrusted input or it'll result in arbitrary code execution, especially on Windows.

◆ os_open_link()

int os_open_link ( const char * link)

Opens a link in the browser.

Parameters
linkThe link to open in a browser.
Returns
1 on success, 0 on failure.
Remarks
The strings are treated as null-terminated strings.
This may not be called with untrusted input or it'll result in arbitrary code execution, especially on Windows.

◆ os_version_str()

bool os_version_str ( char * version,
size_t length )

Returns a human-readable version string of the operating system.

Parameters
versionBuffer to use for the output.
lengthLength of the output buffer.
Returns
true on success, false on failure.