00001 /* $Header: /opt/proj/minix/cvsroot/src/commands/aal/wr_bytes.c,v 1.1.1.1 2005/04/21 14:53:58 beng Exp $ */ 00002 /* 00003 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. 00004 * See the copyright notice in the ACK home directory, in the file "Copyright". 00005 */ 00006 #define MININT (1 << (sizeof(int) * 8 - 1)) 00007 #define MAXCHUNK (~MININT) /* Highest count we write(2). */ 00008 /* Notice that MAXCHUNK itself might be too large with some compilers. 00009 You have to put it in an int! 00010 */ 00011 00012 static int maxchunk = MAXCHUNK; 00013 00014 /* 00015 * Just write "cnt" bytes to file-descriptor "fd". 00016 */ 00017 wr_bytes(fd, string, cnt) 00018 register char *string; 00019 register long cnt; 00020 { 00021 00022 while (cnt) { 00023 register int n = cnt >= maxchunk ? maxchunk : cnt; 00024 00025 if (write(fd, string, n) != n) 00026 wr_fatal(); 00027 string += n; 00028 cnt -= n; 00029 } 00030 }
1.4.6