summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2009-10-24 09:08:26 +0000
committerSimon Tatham <anakin@pobox.com>2009-10-24 09:08:26 +0000
commitccb035ab284dcce968d948a5f04eef96c9cc541d (patch)
treeda95a7e83c75ea5f9e28d5c2e66532ef9b4390f3 /main.c
parent0a4281ca5b029a961fbef0856e27dee2a23c8cdb (diff)
downloadhalibut-ccb035ab284dcce968d948a5f04eef96c9cc541d.zip
halibut-ccb035ab284dcce968d948a5f04eef96c9cc541d.tar.gz
halibut-ccb035ab284dcce968d948a5f04eef96c9cc541d.tar.bz2
halibut-ccb035ab284dcce968d948a5f04eef96c9cc541d.tar.xz
Enable Halibut to read a .but file from standard input, by supplying
the special filename '-'. [originally from svn r8728]
Diffstat (limited to 'main.c')
-rw-r--r--main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.c b/main.c
index 60ad74f..dae6581 100644
--- a/main.c
+++ b/main.c
@@ -85,7 +85,7 @@ int main(int argc, char **argv) {
*/
while (--argc) {
char *p = *++argv;
- if (*p == '-') {
+ if (*p == '-' && p[1]) {
/*
* An option.
*/
@@ -264,7 +264,10 @@ int main(int argc, char **argv) {
/*
* A non-option argument.
*/
- infiles[nfiles++] = p;
+ if (!strcmp(p, "-"))
+ infiles[nfiles++] = NULL; /* special case: read stdin */
+ else
+ infiles[nfiles++] = p;
}
}