summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0122308)
raw | patch | inline | side by side (parent: 0122308)
author | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 3 Jun 2010 01:11:31 +0000 (21:11 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 3 Jun 2010 01:15:51 +0000 (21:15 -0400) |
tig.c | patch | blob | history |
index 86be4a2973615219fb321863eaa648e73210a8b6..160f04dd0b510aeb7333eee5a5656bb8eba8e297 100644 (file)
--- a/tig.c
+++ b/tig.c
static void foreach_ref(bool (*visitor)(void *data, const struct ref *ref), void *data);
static int load_refs(void);
-enum format_flags {
- FORMAT_ALL, /* Perform replacement in all arguments. */
- FORMAT_NONE /* No replacement should be performed. */
-};
-
-static bool format_argv(const char *dst[], const char *src[], enum format_flags flags);
-
enum input_status {
INPUT_OK,
INPUT_SKIP,
}
static bool
-format_argv(const char *dst_argv[], const char *src_argv[], enum format_flags flags)
+format_argv(const char *dst_argv[], const char *src_argv[], bool replace)
{
char buf[SIZEOF_STR];
int argc;
- bool noreplace = flags == FORMAT_NONE;
argv_free(dst_argv);
@@ -3196,7 +3188,7 @@ format_argv(const char *dst_argv[], const char *src_argv[], enum format_flags fl
int len = next - arg;
const char *value;
- if (!next || noreplace) {
+ if (!next || !replace) {
len = strlen(arg);
value = "";
@@ -3211,7 +3203,7 @@ format_argv(const char *dst_argv[], const char *src_argv[], enum format_flags fl
if (!string_format_from(buf, &bufpos, "%.*s%s", len, arg, value))
return FALSE;
- arg = next && !noreplace ? strchr(next, ')') + 1 : NULL;
+ arg = next && replace ? strchr(next, ')') + 1 : NULL;
}
dst_argv[argc] = strdup(buf);
prepare_io(struct view *view, const char *dir, const char *argv[], bool replace)
{
io_init(&view->io, dir, IO_RD);
- return format_argv(view->io.argv, argv, replace ? FORMAT_ALL : FORMAT_NONE);
+ return format_argv(view->io.argv, argv, replace);
}
static bool
return;
}
- if (format_argv(argv, req->argv, FORMAT_ALL))
+ if (format_argv(argv, req->argv, TRUE))
open_external_viewer(argv, NULL);
argv_free(argv);
}