diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-05-23 21:02:30 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-05-23 21:02:30 +0100 |
commit | 19a3a9ee20d09d7210ef278d908913fca60575b7 (patch) | |
tree | af84111c7c9e43e821c6d274a1d16869bb46ec25 | |
parent | e817821104b886de7afdf7c365aeced134d6d966 (diff) | |
parent | f3e01ecc42e34a914ee390658625e920d321734a (diff) |
Merge branch 'obsd-master'
-rw-r--r-- | cfg.c | 1 | ||||
-rw-r--r-- | cmd-parse.y | 4 | ||||
-rw-r--r-- | cmd-show-options.c | 4 | ||||
-rw-r--r-- | utf8.c | 4 |
4 files changed, 8 insertions, 5 deletions
@@ -125,6 +125,7 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags, memset(&pi, 0, sizeof pi); pi.flags = flags; pi.file = path; + pi.line = 1; pr = cmd_parse_from_file(f, &pi); fclose(f); diff --git a/cmd-parse.y b/cmd-parse.y index e576d776..e9ca376c 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -356,7 +356,7 @@ command : assignment TOKEN $$ = xcalloc(1, sizeof *$$); $$->name = $2; - $$->line = ps->input->line; + $$->line = ps->input->line - 1; } | assignment TOKEN arguments @@ -365,7 +365,7 @@ command : assignment TOKEN $$ = xcalloc(1, sizeof *$$); $$->name = $2; - $$->line = ps->input->line; + $$->line = ps->input->line - 1; $$->argc = $3.argc; $$->argv = $3.argv; diff --git a/cmd-show-options.c b/cmd-show-options.c index 37a9ca7b..756f763c 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -208,8 +208,8 @@ cmd_show_options_print(struct cmd *self, struct cmdq_item *item, if (args_has(self->args, 'v')) cmdq_print(item, "%s", value); else if (options_isstring(o)) { - utf8_stravis(&escaped, value, VIS_OCTAL|VIS_TAB|VIS_NL|VIS_DQ); - cmdq_print(item, "%s \"%s\"", name, escaped); + escaped = args_escape(value); + cmdq_print(item, "%s %s", name, escaped); free(escaped); } else cmdq_print(item, "%s %s", name, value); @@ -209,7 +209,9 @@ utf8_strvis(char *dst, const char *src, size_t len, int flag) src -= ud.have; } if (src[0] == '$' && src < end - 1) { - if (isalpha((u_char)src[1]) || src[1] == '_') + if (isalpha((u_char)src[1]) || + src[1] == '_' || + src[1] == '{') *dst++ = '\\'; *dst++ = '$'; } else if (src < end - 1) |