index f022f17a974b2424f32e6c729a191f6672ac2792..9745f2c3dca5ffe9a3a0af4193aba4cd86fd5c05 100644 (file)
--- a/tig.c
+++ b/tig.c
static enum option_code
parse_args(const char ***args, const char *argv[])
{
- if (!argv_copy(args, argv))
+ if (*args == NULL && !argv_copy(args, argv))
return OPT_ERR_OUT_OF_MEMORY;
return OPT_OK;
}
if (argc < 3)
return OPT_ERR_WRONG_NUMBER_OF_ARGUMENTS;
- if (!opt_blame_argv && !strcmp(argv[0], "blame-options"))
+ if (strcmp(argv[1], "="))
+ return OPT_ERR_NO_VALUE_ASSIGNED;
+
+ if (!strcmp(argv[0], "blame-options"))
return parse_args(&opt_blame_argv, argv + 2);
if (argc != 3)
return OPT_ERR_WRONG_NUMBER_OF_ARGUMENTS;
- if (strcmp(argv[1], "="))
- return OPT_ERR_NO_VALUE_ASSIGNED;
-
if (!strcmp(argv[0], "show-author"))
return parse_enum(&opt_author, argv[2], author_map);
struct view {
enum view_type type; /* View type */
const char *name; /* View name */
- const char *cmd_env; /* Command line set via environment */
const char *id; /* Points to either of ref_{head,commit,blob} */
struct view_ops *ops; /* View operations */
static struct view_ops tree_ops;
static struct view_ops branch_ops;
-#define VIEW_STR(type, name, env, ref, ops, map, git) \
- { type, name, #env, ref, ops, map, git }
+#define VIEW_STR(type, name, ref, ops, map, git) \
+ { type, name, ref, ops, map, git }
#define VIEW_(id, name, ops, git, ref) \
- VIEW_STR(VIEW_##id, name, TIG_##id##_CMD, ref, ops, KEYMAP_##id, git)
+ VIEW_STR(VIEW_##id, name, ref, ops, KEYMAP_##id, git)
static struct view views[] = {
VIEW_(MAIN, "main", &main_ops, TRUE, ref_head),
const char *codeset = "UTF-8";
enum request request = parse_options(argc, argv);
struct view *view;
- size_t i;
signal(SIGINT, quit);
signal(SIGPIPE, SIG_IGN);
if (load_refs() == ERR)
die("Failed to load refs.");
- foreach_view (view, i) {
- if (getenv(view->cmd_env))
- warn("Use of the %s environment variable is deprecated,"
- " use options or TIG_DIFF_ARGS instead",
- 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();
while (view_driver(display[current_view], request)) {