summaryrefslogtreecommitdiff
path: root/src/cat.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-08-31 07:45:12 +0000
committerJim Meyering <jim@meyering.net>2001-08-31 07:45:12 +0000
commit722e2f095762abfe2c6b0c6fdaeab64e0f5e0b4b (patch)
tree32567b5e7f8bf70eb59e139b19b6822b85575ae5 /src/cat.c
parent4f982cb6f513f3ffd57271b5dc5c002e2834dfb1 (diff)
downloadcoreutils-722e2f095762abfe2c6b0c6fdaeab64e0f5e0b4b.tar.xz
Include full-write.h.
(full_write): Remove decl; not needed. (simple_cat, cat): Don't assume read and write size fits in int.
Diffstat (limited to 'src/cat.c')
-rw-r--r--src/cat.c9
1 files changed, 4 insertions, 5 deletions
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,