home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
DOOG
/
CBASE09.ZIP
/
BLKIO10.ZIP
/
BSETBUF.C
< prev
next >
Wrap
Text File
|
1989-08-30
|
2KB
|
61 lines
/* Copyright (c) 1989 Citadel */
/* All Rights Reserved */
/* #ident "bsetbuf.c 1.1 - 89/07/03" */
#include <errno.h>
#include "blkio_.h"
/*man---------------------------------------------------------------------------
NAME
bsetbuf - assign buffering to a block file
SYNOPSIS
#include <blkio.h>
int bsetbuf(bp, buf)
BLKFILE *bp;
void *buf;
DESCRIPTION
The bsetbuf function causes the storage area pointed to by buf to be
used by the block file associated with BLKFILE pointer bp instead of an
automatically allocated buffer area. If buf is the NULL pointer, bp
will be completely unbuffered. Otherwise, it must point to a storage
area of size (header size + buffer count * block size).
bsetbuf may be called at any time after opening the block file, before
and after it is read or written.
bsetbuf will fail if one or more of the following is true:
[EINVAL] bp is not a valid BLKFILE pointer.
[BENBUF] buf is not the NULL pointer and bp is not
buffered.
[BENOPEN] bp is not open.
SEE ALSO
bopen, bsetvbuf.
DIAGNOSTICS
Upon successful completion, a value of 0 is returned. Otherwise, a
non-zero value is returned, and errno set to indicate the error.
------------------------------------------------------------------------------*/
int bsetbuf(bp, buf)
BLKFILE * bp;
void * buf;
{
/* validate arguments */
if ((bp->bufcnt == 0) && (buf != NULL)) {
errno = BENBUF;
return -1;
}
if (buf == NULL) {
return bsetvbuf(bp, buf, bp->blksize, (size_t)0);
}
return bsetvbuf(bp, buf, bp->blksize, bp->bufcnt);
}