summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 61a871f)
raw | patch | inline | side by side (parent: 61a871f)
author | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 22 Mar 2010 01:33:16 +0000 (21:33 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 30 Mar 2010 11:05:45 +0000 (07:05 -0400) |
tig.c | patch | blob | history |
index 75f7944bb06b6f42b534356f1397dc9e16fe2c84..2c353d51ff075ef9e2d72519273243fc7aa2beae 100644 (file)
--- a/tig.c
+++ b/tig.c
return *argc < SIZEOF_ARG;
}
-static void
+static bool
argv_from_env(const char **argv, const char *name)
{
char *env = argv ? getenv(name) : NULL;
if (env && *env)
env = strdup(env);
- if (env && !argv_from_string(argv, &argc, env))
- die("Too many arguments in the `%s` environment variable", name);
+ return !env || argv_from_string(argv, &argc, env);
}
size_t i;
if (!init) {
- argv_from_env(ls_remote_argv, "TIG_LS_REMOTE");
+ if (!argv_from_env(ls_remote_argv, "TIG_LS_REMOTE"))
+ die("TIG_LS_REMOTE contains too many arguments");
init = TRUE;
}
die("Failed to load refs.");
foreach_view (view, i)
- argv_from_env(view->ops->argv, view->cmd_env);
+ if (!argv_from_env(view->ops->argv, view->cmd_env))
+ die("Too many arguments in the `%s` environment variable",
+ view->cmd_env);
init_display();