summaryrefslogtreecommitdiff
path: root/test-line-buffer.c
diff options
context:
space:
mode:
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;
}