Texcaller
|
Functions | |
static const char * | escape_latex_char (char c) |
Escape a single character for LaTeX. | |
static char * | sprintf_alloc (const char *format,...) |
Variant of sprintf() that allocates the needed memory automatically. | |
static int | remove_directory_recursively (char **error, const char *dirname) |
Remove a directory recursively like rm -r . | |
static void | read_file (char **result, size_t *result_size, char **error, const char *path) |
Read a file completely into a buffer that can be used as a string. | |
static int | write_file (char **error, const char *path, const char *source, size_t source_size) |
Write a buffer completely into a file. |
static const char* escape_latex_char | ( | char | c | ) | [static] |
Escape a single character for LaTeX.
c | the character to escape |
NULL
if the character doesn't need to be replaced. static char* sprintf_alloc | ( | const char * | format, |
... | |||
) | [static] |
Variant of sprintf()
that allocates the needed memory automatically.
format | format string for sprintf() |
... | further arguments to sprintf() |
sprintf()
, or NULL
when out of memory or sprintf() failed. static int remove_directory_recursively | ( | char ** | error, |
const char * | dirname | ||
) | [static] |
Remove a directory recursively like rm -r
.
error | On failure, error will be set to a newly allocated string that contains the error message. On success, or when out of memory, error will be set to NULL . |
dirname | the directory to remove |
static void read_file | ( | char ** | result, |
size_t * | result_size, | ||
char ** | error, | ||
const char * | path | ||
) | [static] |
Read a file completely into a buffer that can be used as a string.
result | will be set to a newly allocated buffer that contains the complete content of the file, with a '\0' added to the end. If an error occured, result will be set to NULL . |
result_size | will be set to the size of result , not counting the added '\0' . If an error occured, result_size will be set to 0 . |
error | On failure, error will be set to a newly allocated string that contains the error message. On success, or when out of memory, error will be set to NULL . |
path | path of the file to read |
static int write_file | ( | char ** | error, |
const char * | path, | ||
const char * | source, | ||
size_t | source_size | ||
) | [static] |
Write a buffer completely into a file.
If the file already exists, it will be overwritten.
error | On failure, error will be set to a newly allocated string that contains the error message. On success, or when out of memory, error will be set to NULL . |
path | path of the file to write to |
source | buffer to write |
source_size | size of source |