forget difference between big and small commands - obsolete with vm.
[minix.git] / commands / aal / rd_bytes.c
blob9964e0ac1f72ebb414d4581cc226fbafdca8134a
1 /* $Header$ */
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 read(2). */
8 /* Unfortunately, MAXCHUNK is too large with some compilers. Put it in
9 an int!
12 static int maxchunk = MAXCHUNK;
15 * We don't have to worry about byte order here.
16 * Just read "cnt" bytes from file-descriptor "fd".
18 int
19 rd_bytes(fd, string, cnt)
20 register char *string;
21 register long cnt;
24 while (cnt) {
25 register int n = cnt >= maxchunk ? maxchunk : cnt;
27 if (read(fd, string, n) != n)
28 rd_fatal();
29 string += n;
30 cnt -= n;