Use precise quoting for the shell commands

This commit is contained in:
Andrea Mazzoleni 2016-02-10 00:00:52 +01:00
parent 12b30c198e
commit 840ec7b1c3
5 changed files with 201 additions and 12 deletions

View file

@ -216,7 +216,7 @@ void printp(double v, size_t pad);
#define ESC_MAX (PATH_MAX*2+1)
/**
* Escape a string.
* Escape a string for the log.
*
* \param buffer Preallocated buffer of ESC_MAX size.
*
@ -224,6 +224,16 @@ void printp(double v, size_t pad);
*/
const char* esc(const char* str, char* buffer);
#define QUOTE_MAX (PATH_MAX*2+1)
/**
* Quote a string for the shell.
*
* \param prefix Char to prefix at the string.
* \param buffer Preallocated buffer of QUOTE_MAX size.
*/
const char* quote(char prefix, const char* str, char* buffer);
/**
* Polish a string.
*