summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5b09a46)
raw | patch | inline | side by side (parent: 5b09a46)
author | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 6 Oct 2008 19:28:50 +0000 (21:28 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 6 Oct 2008 19:28:50 +0000 (21:28 +0200) |
tig.c | patch | blob | history |
index 25fb237c6b1d39a2563bcf072ebcdd73614920ce..f81686b70f641aae155d15097e47331f548e7a7d 100644 (file)
--- a/tig.c
+++ b/tig.c
}
if (!strcmp(argv[0], "commit-encoding")) {
- char *arg = argv[2];
- int delimiter = *arg;
- int i;
+ const char *arg = argv[2];
+ int arglen = strlen(arg);
- switch (delimiter) {
+ switch (arg[0]) {
case '"':
case '\'':
- for (arg++, i = 0; arg[i]; i++)
- if (arg[i] == delimiter) {
- arg[i] = 0;
- break;
- }
+ if (arglen == 1 || arg[arglen - 1] != arg[0]) {
+ config_msg = "Unmatched quotation";
+ return ERR;
+ }
+ arg += 1; arglen -= 2;
default:
string_ncopy(opt_encoding, arg, strlen(arg));
return OK;