mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-04 05:40:14 -05:00
Use precise quoting for the shell commands
This commit is contained in:
parent
12b30c198e
commit
840ec7b1c3
5 changed files with 201 additions and 12 deletions
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue