42 int n = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);
43 WCHAR *ucs16 =
gc_malloc(n *
sizeof(WCHAR),
false,
gc);
44 MultiByteToWideChar(CP_UTF8, 0, utf8, -1, ucs16, n);
49#define CMD_QUOTE_TRIGGERS " &|<>^%()!"
54 for (
const char *c = str; *c !=
'\0'; ++c)
78 for (
i = 0;
i <
a->argc; ++
i)
80 const char *arg =
a->argv[
i];
93 for (
i = 0;
i <
a->argc; ++
i)
95 const char *arg =
a->argv[
i];
153 const int c1 =
pre[
i];
169 return c2 ==
'\0' || c2 ==
'.';
236 msg(
M_WARN,
"Could not get temporary directory. Path is too long."
237 " Consider using --tmp-dir");
268 return next ==
L'\\' || next ==
L'/';
bool buf_printf(struct buffer *buf, const char *format,...)
printf-style append to a buffer with overflow check.
void * gc_malloc(size_t size, bool clear, struct gc_arena *a)
Allocate memory and, optionally, zero it.
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
Allocate a buffer of the given size under garbage collection.
bool string_mod(char *str, const unsigned int inclusive, const unsigned int exclusive, const char replace)
Modifies a string in place by replacing certain classes of characters of it with a specified characte...
Buffer management functions and garbage collection.
#define CC_DOUBLE_QUOTE
double quote
#define BSTR(buf)
Return the buffer content pointer cast to char *.
#define CC_CRLF
carriage return or newline
static void check_malloc_return(void *p)
Abort if a memory allocation returned NULL.
#define CC_PRINT
printable (>= 32, != 127)
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Garbage collection arena used to keep track of dynamically allocated memory.
bool win_path_in_dir(const WCHAR *path, const WCHAR *dir)
Check whether path resides within directory dir.
char * utf16to8(const wchar_t *utf16, struct gc_arena *gc)
static bool cmp_prefix(const char *str, const bool n, const char *pre)
bool win_safe_filename(const char *fn)
const char * win_get_tempdir(void)
#define CMD_QUOTE_TRIGGERS
WCHAR * wide_string(const char *utf8, struct gc_arena *gc)
WCHAR * wide_cmd_line(const struct argv *a, struct gc_arena *gc)
static bool argv_element_needs_quotes(const char *str)