Commits

Anonymous committed d444caf

Demo: can now read from stdin

  • Participants
  • Parent commits 667de06

Comments (0)

Files changed (1)

 		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) {