From: Jonas Fonseca Date: Wed, 14 Jun 2006 19:38:03 +0000 (+0200) Subject: Allow strings to be enclosed in either ' or " X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3cc9a4d495afa80795222848b1f3941dd539f63d;p=tig.git Allow strings to be enclosed in either ' or " So now you can use both: set commit-encoding = "UTF-8" set commit-encoding = 'UTF-8' set commit-encoding = UTF-8 --- diff --git a/tig.c b/tig.c index cda8a71..a3b92c8 100644 --- a/tig.c +++ b/tig.c @@ -946,8 +946,22 @@ option_set_command(int argc, char *argv[]) } if (!strcmp(argv[0], "commit-encoding")) { - string_copy(opt_encoding, argv[2]); - return OK; + char *arg = argv[2]; + int delimiter = *arg; + int i; + + switch (delimiter) { + case '"': + case '\'': + for (arg++, i = 0; arg[i]; i++) + if (arg[i] == delimiter) { + arg[i] = 0; + break; + } + default: + string_copy(opt_encoding, arg); + return OK; + } } config_msg = "Unknown variable name";