about summary refs log tree commit diff homepage
path: root/meta.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-03-05 12:55:46 -0500
committerJune McEnroe <june@causal.agency>2018-03-05 12:55:46 -0500
commit3e7377a479f49d2a8f2b0b893b6f8ea946b56fc9 (patch)
treed68aa786c7bd98dd44fa6b691a16bd6005fc1b18 /meta.c
parentClean up spawn constants (diff)
downloadtorus-3e7377a479f49d2a8f2b0b893b6f8ea946b56fc9.tar.gz
torus-3e7377a479f49d2a8f2b0b893b6f8ea946b56fc9.zip
Use stdio in merge and meta
Diffstat (limited to '')
-rw-r--r--meta.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/meta.c b/meta.c
index 8e3b6a3..ede1041 100644
--- a/meta.c
+++ b/meta.c
@@ -17,7 +17,6 @@
 #include <err.h>
 #include <stdio.h>
 #include <sysexits.h>
-#include <unistd.h>
 
 #include "torus.h"
 
@@ -25,9 +24,9 @@ int main() {
     printf("tileX,tileY,createTime,modifyCount,modifyTime,accessCount,accessTime\n");
     for (int i = 0;; ++i) {
         struct Tile tile;
-        ssize_t len = read(STDIN_FILENO, &tile, sizeof(tile));
-        if (len < 0) err(EX_IOERR, "read");
-        if (!len) return EX_OK;
+        size_t count = fread(&tile, sizeof(tile), 1, stdin);
+        if (ferror(stdin)) err(EX_IOERR, "(stdin)");
+        if (!count) return EX_OK;
 
         printf(
             "%d,%d,%ld,%u,%ld,%u,%ld\n",