diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2011-01-03 06:09:38 +0300 |
---|---|---|
committer | Jonathan Nieder <jrnieder@gmail.com> | 2011-02-26 13:59:37 +0300 |
commit | cb3f87cf1ba90373fdc240d65a4d65434099d9a3 (patch) | |
tree | ea9094dc1cf3c5f96df6d6fe56dee306aaddac5f /test-line-buffer.c | |
parent | cc193f1f0b45e4e65f246f1d5e6e8134844aa35b (diff) |
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.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test-line-buffer.c b/test-line-buffer.c index 19bf2d4403d..25b20b93fd4 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; } |