1987-03-09 15:15:03 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1987-01-05 17:31:38 +00:00
|
|
|
#define MININT (1 << (sizeof(int) * 8 - 1))
|
1987-02-13 09:40:08 +00:00
|
|
|
#define MAXCHUNK (~MININT) /* Highest count we write(2). */
|
|
|
|
/* Notice that MAXCHUNK itself might be too large with some compilers.
|
|
|
|
You have to put it in an int!
|
|
|
|
*/
|
|
|
|
|
1987-03-02 08:55:23 +00:00
|
|
|
static int maxchunk = MAXCHUNK;
|
1987-01-05 17:31:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Just write "cnt" bytes to file-descriptor "fd".
|
|
|
|
*/
|
|
|
|
wr_bytes(fd, string, cnt)
|
|
|
|
register char *string;
|
|
|
|
register long cnt;
|
|
|
|
{
|
|
|
|
|
|
|
|
while (cnt) {
|
1987-02-13 09:40:08 +00:00
|
|
|
register int n = cnt >= maxchunk ? maxchunk : cnt;
|
1987-01-05 17:31:38 +00:00
|
|
|
|
|
|
|
if (write(fd, string, n) != n)
|
|
|
|
wr_fatal();
|
|
|
|
string += n;
|
|
|
|
cnt -= n;
|
|
|
|
}
|
|
|
|
}
|