summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6549814)
raw | patch | inline | side by side (parent: 6549814)
author | Jonas Fonseca <fonseca@diku.dk> | |
Fri, 9 Jan 2009 17:29:57 +0000 (12:29 -0500) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 13 Jan 2009 21:55:20 +0000 (22:55 +0100) |
tig.c | patch | blob | history |
index 7104a224f43c336121481f672283910a59ddd334..1fd4bc9c14afb1e073afea5f9b6534661adcae47 100644 (file)
--- a/tig.c
+++ b/tig.c
FILE *pid; /* Pipe for reading or writing. */
int pipe; /* Pipe end for reading or writing. */
int error; /* Error status. */
- char sh[SIZEOF_STR]; /* Shell command buffer. */
+ const char *argv[SIZEOF_ARG]; /* Shell command arguments. */
char *buf; /* Read buffer. */
size_t bufalloc; /* Allocated buffer size. */
size_t bufsize; /* Buffer content size. */
enum format_flags flags)
{
init_io(io, dir, IO_RD);
- return format_command(io->sh, argv, flags);
+ return format_argv(io->argv, argv, flags);
}
static bool
!string_format_from(buf, &bufpos, "cd %s;", io->dir))
return FALSE;
- if (!string_format_from(buf, &bufpos, "%s", io->sh))
+ if (!format_command(buf + bufpos, io->argv, FORMAT_NONE))
return FALSE;
if (io->type == IO_FG || io->type == IO_BG)
return system(buf) == 0;
- io->pid = popen(io->sh, io->type == IO_RD ? "r" : "w");
+ io->pid = popen(buf, io->type == IO_RD ? "r" : "w");
if (!io->pid)
return FALSE;
io->pipe = fileno(io->pid);
run_io(struct io *io, const char **argv, const char *dir, enum io_type type)
{
init_io(io, dir, type);
- if (!format_command(io->sh, argv, FORMAT_NONE))
+ if (!format_argv(io->argv, argv, FORMAT_NONE))
return FALSE;
return start_io(io);
}
struct io io = {};
init_io(&io, NULL, IO_BG);
- if (!format_command(io.sh, argv, FORMAT_NONE))
+ if (!format_argv(io.argv, argv, FORMAT_NONE))
return FALSE;
return run_io_do(&io);
}
struct io io = {};
init_io(&io, dir, IO_FG);
- if (!format_command(io.sh, argv, FORMAT_NONE))
+ if (!format_argv(io.argv, argv, FORMAT_NONE))
return FALSE;
return run_io_do(&io);
}