summaryrefslogtreecommitdiff
path: root/demo.c
diff options
context:
space:
mode:
Diffstat (limited to 'demo.c')
-rw-r--r--demo.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/demo.c b/demo.c
index 1d3294493..4a76436c2 100644
--- a/demo.c
+++ b/demo.c
@@ -57,10 +57,14 @@ int main(int argc, char *argv[]) {
exit(EXIT_SUCCESS);
}
- f = fopen(argv[1], "r");
- if (f == NULL) {
- fprintf(stderr, "Failed to open file `%s`\n", argv[1]);
- exit(EXIT_FAILURE);
+ if (strcmp(argv[1], "-") == 0) {
+ f = stdin;
+ } else {
+ f = fopen(argv[1], "r");
+ if (f == NULL) {
+ fprintf(stderr, "Failed to open file `%s`\n", argv[1]);
+ exit(EXIT_FAILURE);
+ }
}
while (1) {