|
libmsngr
1.1
|
Functions | |
| char * | msngr_copy_string (const char *string) |
| Create a dynamically allocated copy of a string. | |
| char * | msngr_create_string (const char *format,...) |
| Create a new text string. | |
| char * | msngr_format_time (time_t secs1970, char *string) |
| Convert seconds since 1970 to a formatted time string. | |
| char * | msngr_format_va_list (const char *format, va_list args) |
| Create a text string from a format string and va_list. | |
| time_t | msngr_get_process_start_time (pid_t pid) |
| Get the start time of a process. | |
| int | msngr_make_path (const char *path, mode_t mode, size_t errlen, char *errstr) |
| Make the full path to a directory. | |
| int | msngr_vprintf (const char *format, va_list args) |
| Wrapper to vprintf that preserves the argument list. | |
| int | msngr_vfprintf (FILE *stream, const char *format, va_list args) |
| Wrapper to vfprintf that preserves the argument list. | |
| int | msngr_vsprintf (char *string, const char *format, va_list args) |
| Wrapper to vsprintf that preserves the argument list. | |
| int | msngr_vsnprintf (char *string, size_t nbytes, const char *format, va_list args) |
| Wrapper to vsnprintf that preserves the argument list. | |
| char* msngr_copy_string | ( | const char * | string | ) |
Create a dynamically allocated copy of a string.
The memory used by the returned string is dynamically allocated. It is the responsibility of the calling process to free this memory when it is no longer needed.
| string | - pointer to the string to copy |
Definition at line 65 of file msngr_utils.c.
| char* msngr_create_string | ( | const char * | format, |
| ... | |||
| ) |
Create a new text string.
This functions creates a new text string under the control of the format argument.
The memory used by the returned string is dynamically allocated. It is the responsibility of the calling process to free this memory when it is no longer needed.
| format | - format string (see printf) |
| ... | - arguments for the format string |
Definition at line 94 of file msngr_utils.c.
| char* msngr_format_time | ( | time_t | secs1970, |
| char * | string | ||
| ) |
Convert seconds since 1970 to a formatted time string.
This function will create a time string of the form:
'YYYY-MM-DD hh:mm:ss'.
The string argument must be large enough to hold at least 20 characters (19 plus the null terminator).
If an error occurs in this function, the message 'FORMATTING ERROR' will be copied into the text string.
| secs1970 | - seconds since 1970 |
| string | - time string to store the result in |
Definition at line 124 of file msngr_utils.c.
| char* msngr_format_va_list | ( | const char * | format, |
| va_list | args | ||
| ) |
Create a text string from a format string and va_list.
The memory used by the returned string is dynamically allocated. It is the responsibility of the calling process to free this memory when it is no longer needed.
| format | - format string (see printf) |
| args | - arguments for the format string |
Definition at line 161 of file msngr_utils.c.
| time_t msngr_get_process_start_time | ( | pid_t | pid | ) |
Get the start time of a process.
| pid | - process ID |
Definition at line 193 of file msngr_utils.c.
| int msngr_make_path | ( | const char * | path, |
| mode_t | mode, | ||
| size_t | errlen, | ||
| char * | errstr | ||
| ) |
Make the full path to a directory.
This function will create the specified path if it does not already exist.
The space pointed to by errstr should be large enough to hold MAX_LOG_ERROR bytes. Any less than that and the error message could be truncated.
If errlen is 0 then no error message is written to errstr and errstr can be NULL.
| path | - directory path to create |
| mode | - mode of the new directory |
| errlen | - length of the error message buffer |
| errstr | - output: error message |
Definition at line 229 of file msngr_utils.c.
| int msngr_vfprintf | ( | FILE * | stream, |
| const char * | format, | ||
| va_list | args | ||
| ) |
Wrapper to vfprintf that preserves the argument list.
| stream | - pointer to the output stream |
| format | - format string |
| args | - arguments for the format string |
Definition at line 314 of file msngr_utils.c.
| int msngr_vprintf | ( | const char * | format, |
| va_list | args | ||
| ) |
Wrapper to vprintf that preserves the argument list.
| format | - format string |
| args | - arguments for the format string |
Definition at line 293 of file msngr_utils.c.
| int msngr_vsnprintf | ( | char * | string, |
| size_t | nbytes, | ||
| const char * | format, | ||
| va_list | args | ||
| ) |
Wrapper to vsnprintf that preserves the argument list.
| string | - output string |
| nbytes | - the length of the output string |
| format | - format string |
| args | - arguments for the format string |
Definition at line 360 of file msngr_utils.c.
| int msngr_vsprintf | ( | char * | string, |
| const char * | format, | ||
| va_list | args | ||
| ) |
Wrapper to vsprintf that preserves the argument list.
| string | - output string |
| format | - format string |
| args | - arguments for the format string |
Definition at line 336 of file msngr_utils.c.