Unified · Split
| @@ -20,5 +20,4 @@ Plan 9: `cd /tmp && hget https://github.com/ftrvxmtrx/hx/archive/master.tar.gz | · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | # Notes |
| 22 | 22 | |
| 23 | − * `echo blah | hx` won't print anything, use `echo blah | hx /dev/stdin` instead. | |
| 24 | 23 | * hx will print data as soon as it is available (if used on pipes), without buffering. |
| @@ -165,6 +165,11 @@ main(int argc, char **argv) · 164 unmodified lines | ||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | res = 0; |
| 168 | + if (argc == 1) { | |
| 169 | + i = 1; | |
| 170 | + fd = 0; | |
| 171 | + goto dump; | |
| 172 | + } | |
| 168 | 173 | for (i = 1; i < argc && res == 0; i++) { |
| 169 | 174 | if ((fd = open(argv[i], OREAD)) < 0) { |
| 170 | 175 | perror(argv[i]); |
| @@ -175,6 +180,7 @@ main(int argc, char **argv) · 4 unmodified lines | ||
| 175 | 180 | write(1, argv[i], strlen(argv[i])); |
| 176 | 181 | write(1, "\n", 1); |
| 177 | 182 | } |
| 183 | +dump: | |
| 178 | 184 | if ((res = hx(fd)) != 0) |
| 179 | 185 | perror(argv[1]); |
| 180 | 186 | close(fd); |