changeset 128:0a90a5fbc1bf

Add xputs() to detect EOF on writes.
author Rob Landley <rob@landley.net>
date Mon, 18 Jun 2007 00:14:03 -0400
parents 343117774a9f
children 0dfead29c893
files lib/lib.c lib/lib.h
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/lib.c	Mon Jun 18 00:12:43 2007 -0400
+++ b/lib/lib.c	Mon Jun 18 00:14:03 2007 -0400
@@ -155,6 +155,11 @@
 	if (ferror(stdout)) perror_exit("write");
 }
 
+void xputs(char *s)
+{
+	if (EOF == puts(s)) perror_exit("write");
+}
+
 void xputc(char c)
 {
 	if (EOF == fputc(c, stdout)) perror_exit("write");
--- a/lib/lib.h	Mon Jun 18 00:12:43 2007 -0400
+++ b/lib/lib.h	Mon Jun 18 00:14:03 2007 -0400
@@ -48,6 +48,7 @@
 void *xstrdup(char *s);
 char *xmsprintf(char *format, ...);
 void xprintf(char *format, ...);
+void xputs(char *s);
 void xputc(char c);
 void xflush(void);
 void xexec(char **argv);