From 722e2f095762abfe2c6b0c6fdaeab64e0f5e0b4b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 31 Aug 2001 07:45:12 +0000 Subject: Include full-write.h. (full_write): Remove decl; not needed. (simple_cat, cat): Don't assume read and write size fits in int. --- src/cat.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/cat.c') diff --git a/src/cat.c b/src/cat.c index 11c600820..c4fa65db6 100644 --- a/src/cat.c +++ b/src/cat.c @@ -33,6 +33,7 @@ #include "system.h" #include "closeout.h" #include "error.h" +#include "full-write.h" #include "safe-read.h" /* The official name of this program (e.g., no `g' prefix). */ @@ -44,8 +45,6 @@ #undef max #define max(h,i) ((h) > (i) ? (h) : (i)) -int full_write (); - /* Name under which this program was invoked. */ char *program_name; @@ -156,7 +155,7 @@ simple_cat ( int bufsize) { /* Actual number of characters read, and therefore written. */ - int n_read; + ssize_t n_read; /* Loop until the end of the file. */ @@ -179,7 +178,7 @@ simple_cat ( /* Write this block out. */ - if (full_write (STDOUT_FILENO, buf, n_read) < 0) + if (full_write (STDOUT_FILENO, buf, n_read) != n_read) error (EXIT_FAILURE, errno, _("write error")); } } @@ -226,7 +225,7 @@ cat ( unsigned char *bpout; /* Number of characters read by the last read call. */ - int n_read; + ssize_t n_read; /* Determines how many consecutive newlines there have been in the input. 0 newlines makes NEWLINES -1, 1 newline makes NEWLINES 1, -- cgit v1.2.3-54-g00ecf