/*
* Copyright (c) 2000-2002 Proofpoint, 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.
*/
#include <stdlib.h>
#include <errno.h>
#include "local.h"
/*
** SM_WSETUP -- check writing is safe
**
** Various output routines call wsetup to be sure it is safe to write,
** because either flags does not include SMMWR, or buf is NULL.
** Used in the macro "cantwrite" found in "local.h".
**
** Parameters:
** fp -- the file pointer
**
** Results:
** Failure: SM_IO_EOF and sets errno
** Success: 0 (zero)
*/
int
{
/* make sure stdio is set up */
if (!Sm_IO_DidInit)
sm_init();
/* If we are not writing, we had better be reading and writing. */
{
{
return SM_IO_EOF;
}
{
/* clobber any ungetc data */
/* discard read buffer */
}
}
/* Make a buffer if necessary, then set w. */
sm_makebuf(fp);
{
/*
** It is line buffered, so make lbfsize be -bufsize
** for the sm_putc() macro. We will change lbfsize back
** to 0 whenever we turn off SMWR.
*/
}
else
return 0;
}