MCPcopy Index your code
hub / github.com/NetHack/NetHack / copy_bytes

Function copy_bytes

src/hacklib.c:945–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

943#endif
944
945boolean
946copy_bytes(int ifd, int ofd)
947{
948 char buf[BUFSIZ];
949 RETTYPE nfrom, nto;
950
951 do {
952 nto = 0;
953 nfrom = read(ifd, buf, BUFSIZ);
954 /* read can return -1 */
955 if (nfrom >= 0 && nfrom <= BUFSIZ)
956 nto = write(ofd, buf, nfrom);
957 if (nto != nfrom || nfrom < 0)
958 return FALSE;
959 } while (nfrom == (RETTYPE) BUFSIZ);
960 return TRUE;
961}
962#undef RETTYPE
963
964#define MAX_D 5

Callers 2

recover_savefileFunction · 0.70
restore_savefileFunction · 0.50

Calls 2

readFunction · 0.85
writeFunction · 0.85

Tested by

no test coverage detected