mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Add path test windows and escape in double quote.
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
"linux-x64" : {
|
||||
"cflags": "-fPIE"
|
||||
},
|
||||
"windows-x64" : { }
|
||||
"windows-x64" : {
|
||||
"c-include-dirs": ["C:\\"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@ static char *assemble_linker_command(const char **args, bool extra_quote)
|
||||
if (arg == quote_arg)
|
||||
{
|
||||
scratch_buffer_append_char('"');
|
||||
scratch_buffer_append(args[++i]);
|
||||
scratch_buffer_append_in_quote(args[++i]);
|
||||
scratch_buffer_append_char('"');
|
||||
continue;
|
||||
}
|
||||
@@ -717,8 +717,8 @@ static char *assemble_linker_command(const char **args, bool extra_quote)
|
||||
if (arg == quote_concat_arg)
|
||||
{
|
||||
scratch_buffer_append_char('"');
|
||||
scratch_buffer_append(args[++i]);
|
||||
scratch_buffer_append(args[++i]);
|
||||
scratch_buffer_append_in_quote(args[++i]);
|
||||
scratch_buffer_append_in_quote(args[++i]);
|
||||
scratch_buffer_append_char('"');
|
||||
continue;
|
||||
}
|
||||
@@ -726,7 +726,7 @@ static char *assemble_linker_command(const char **args, bool extra_quote)
|
||||
{
|
||||
scratch_buffer_append(args[++i]);
|
||||
scratch_buffer_append_char('"');
|
||||
scratch_buffer_append(args[++i]);
|
||||
scratch_buffer_append_in_quote(args[++i]);
|
||||
scratch_buffer_append_char('"');
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -156,6 +156,7 @@ void scratch_buffer_clear(void);
|
||||
void scratch_buffer_append(const char *string);
|
||||
void scratch_buffer_append_len(const char *string, size_t len);
|
||||
void scratch_buffer_append_char(char c);
|
||||
void scratch_buffer_append_in_quote(const char *string);
|
||||
void scratch_buffer_append_char_repeat(char c, size_t count);
|
||||
void scratch_buffer_append_signed_int(int64_t i);
|
||||
void scratch_buffer_append_double(double d);
|
||||
|
||||
@@ -384,6 +384,25 @@ void scratch_buffer_printf(const char *format, ...)
|
||||
scratch_buffer.len += len_needed;
|
||||
}
|
||||
|
||||
void scratch_buffer_append_in_quote(const char *string)
|
||||
{
|
||||
size_t len = strlen(string);
|
||||
for (size_t i = 0; i < len; )
|
||||
{
|
||||
char c = string[i++];
|
||||
switch (c)
|
||||
{
|
||||
case '"':
|
||||
scratch_buffer_append("\\\"");
|
||||
continue;
|
||||
case '\\':
|
||||
scratch_buffer_append("\\\\");
|
||||
continue;
|
||||
}
|
||||
scratch_buffer_append_char(c);
|
||||
}
|
||||
}
|
||||
|
||||
void scratch_buffer_append_char(char c)
|
||||
{
|
||||
if (scratch_buffer.len + 1 > MAX_STRING_BUFFER - 1)
|
||||
|
||||
Reference in New Issue
Block a user