]> git.cworth.org Git - ttt/blobdiff - src/x.c
2005-11-14 Carl Worth <cworth@cworth.org>
[ttt] / src / x.c
diff --git a/src/x.c b/src/x.c
index 54566423e03f29c45c0d65f190e448a2ae18c79b..8da355e3e015b0c390cb0869e53a96d1e2bb01e1 100644 (file)
--- a/src/x.c
+++ b/src/x.c
@@ -133,7 +133,7 @@ xfdopen (int filedes, const char *mode)
     return ret;
 }
 
     return ret;
 }
 
-FILE *
+void
 xfreopen (const char *path, const char *mode, FILE *stream)
 {
     FILE *ret;
 xfreopen (const char *path, const char *mode, FILE *stream)
 {
     FILE *ret;
@@ -144,8 +144,6 @@ xfreopen (const char *path, const char *mode, FILE *stream)
                 path, strerror (errno));
        exit (1);
     }
                 path, strerror (errno));
        exit (1);
     }
-
-    return ret;
 }
 
 char *
 }
 
 char *
@@ -250,3 +248,33 @@ xselect (int                n,
 
     return ret;
 }
 
     return ret;
 }
+
+ssize_t
+xread (int fd, void *buf, size_t count)
+{
+    int ret;
+
+    ret = read (fd, buf, count);
+    if (ret == -1) {
+       fprintf (stderr, "Error: read failed: %s. Aborting.\n",
+                strerror (errno));
+       exit (1);
+    }
+
+    return ret;
+}
+
+ssize_t
+xwrite (int fd, const void *buf, size_t count)
+{
+    int ret;
+
+    ret = write (fd, buf, count);
+    if (ret == -1) {
+       fprintf (stderr, "Error: write failed: %s. Aborting.\n",
+                strerror (errno));
+       exit (1);
+    }
+
+    return ret;
+}