source: trunk/minix/commands/aal/wr_bytes.c@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 787 bytes
Line 
1/* $Header: /cvsup/minix/src/commands/aal/wr_bytes.c,v 1.1.1.1 2005/04/21 14:53:58 beng Exp $ */
2/*
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 */
6#define MININT (1 << (sizeof(int) * 8 - 1))
7#define MAXCHUNK (~MININT) /* Highest count we write(2). */
8/* Notice that MAXCHUNK itself might be too large with some compilers.
9 You have to put it in an int!
10*/
11
12static int maxchunk = MAXCHUNK;
13
14/*
15 * Just write "cnt" bytes to file-descriptor "fd".
16 */
17wr_bytes(fd, string, cnt)
18 register char *string;
19 register long cnt;
20{
21
22 while (cnt) {
23 register int n = cnt >= maxchunk ? maxchunk : cnt;
24
25 if (write(fd, string, n) != n)
26 wr_fatal();
27 string += n;
28 cnt -= n;
29 }
30}
Note: See TracBrowser for help on using the repository browser.