/*
* Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <unistd.h>
#include "local.h"
/*
** SM_MAKEBUF -- make a buffer for the file
**
** Parameters:
** fp -- the file to be buffered
**
** Returns:
** nothing
**
** Allocate a file buffer, or switch to unbuffered I/O.
** By default tty devices default to line buffered.
*/
void
{
register void *p;
register int flags;
int couldbetty;
{
return;
}
{
return;
}
if (!Sm_IO_DidInit)
sm_init();
}
/*
** SM_WHATBUF -- determine proper buffer for a file (internal)
**
** Plus it fills in 'bufsize' for recommended buffer size and
** fills in flag to indicate if 'fp' could be a tty (nothing
** to do with "betty" :-) ).
**
** Parameters:
** fp -- file pointer to be buffered
** bufsize -- new buffer size (a return)
** couldbetty -- could be a tty (returns)
**
** Returns:
** Success:
** on error:
** SMNPT -- not seek opimized
** SMOPT -- seek opimized
*/
int
int *couldbetty;
{
{
*couldbetty = 0;
*bufsize = SM_IO_BUFSIZ;
return SMNPT;
}
/* could be a tty iff it is a character device */
if (st.st_blksize == 0)
{
*bufsize = SM_IO_BUFSIZ;
return SMNPT;
}
#if SM_IO_MAX_BUF_FILE > 0
#endif /* SM_IO_MAX_BUF_FILE > 0 */
#if SM_IO_MAX_BUF > 0 || SM_IO_MIN_BUF > 0
{
# if SM_IO_MAX_BUF > 0
# if SM_IO_MIN_BUF > 0
else
# endif /* SM_IO_MIN_BUF > 0 */
# endif /* SM_IO_MAX_BUF > 0 */
# if SM_IO_MIN_BUF > 0
# endif /* SM_IO_MIN_BUF > 0 */
}
#endif /* SM_IO_MAX_BUF > 0 || SM_IO_MIN_BUF > 0 */
/*
** Optimise fseek() only if it is a regular file. (The test for
** sm_std_seek is mainly paranoia.) It is safe to set _blksize
** unconditionally; it will only be used if SMOPT is also set.
*/
{
}
else
*bufsize = SM_IO_BUFSIZ;
return SMOPT;
else
return SMNPT;
}