summaryrefslogtreecommitdiff
path: root/test-line-buffer.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-01-02 21:09:38 -0600
committerJonathan Nieder <jrnieder@gmail.com>2011-02-26 04:59:37 -0600
commitcb3f87cf1ba90373fdc240d65a4d65434099d9a3 (patch)
treeea9094dc1cf3c5f96df6d6fe56dee306aaddac5f /test-line-buffer.c
parentcc193f1f0b45e4e65f246f1d5e6e8134844aa35b (diff)
downloadgit-cb3f87cf1ba90373fdc240d65a4d65434099d9a3.tar.gz
vcs-svn: allow input from file descriptor
Based-on-patch-by: David Barr <david.barr@cordelta.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 'test-line-buffer.c')
-rw-r--r--test-line-buffer.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/test-line-buffer.c b/test-line-buffer.c
index 19bf2d4403..25b20b93fd 100644
--- a/test-line-buffer.c
+++ b/test-line-buffer.c
@@ -69,13 +69,18 @@ int main(int argc, char *argv[])
else if (argc == 2)
filename = argv[1];
else
- usage("test-line-buffer [file] < script");
+ usage("test-line-buffer [file | &fd] < script");
if (buffer_init(&stdin_buf, NULL))
die_errno("open error");
if (filename) {
- if (buffer_init(&file_buf, filename))
- die_errno("error opening %s", filename);
+ if (*filename == '&') {
+ if (buffer_fdinit(&file_buf, strtouint32(filename + 1)))
+ die_errno("error opening fd %s", filename + 1);
+ } else {
+ if (buffer_init(&file_buf, filename))
+ die_errno("error opening %s", filename);
+ }
input = &file_buf;
}