/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Bell Laboratories
*
* copy from rfd to wfd (with conditional mmap hacks)
*/
#include <ast.h>
#include <ast_mmap.h>
#if _mmap_worthy > 1
#include <ls.h>
#endif
/*
* copy n bytes from rfd to wfd
* actual byte count returned
* if n<=0 then ``good'' size is used
*/
{
register off_t c;
#ifdef MAPSIZE
char* mapbuf;
#endif
static int bufsiz;
static char* buf;
if (n <= 0 || n >= BUFSIZ * 2)
{
#if MAPSIZE
{
if (mapsize >= BUFSIZ * 2 && (mapbuf = (char*)mmap(NiL, mapsize, PROT_READ, MAP_SHARED, rfd, pos)) != ((caddr_t)-1))
{
return(mapsize);
}
}
#endif
if (n <= 0) n = BUFSIZ;
}
if (n > bufsiz)
{
}
return(c);
}