8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sendmail / libsm / fpurge.c
blob4484a4d546046b1f976181c5d7232467f65eaa85
1 /*
2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * Chris Torek.
10 * By using this file, you agree to the terms and conditions set
11 * forth in the LICENSE file which can be found at the top level of
12 * the sendmail distribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 #include <sm/gen.h>
18 SM_RCSID("@(#)$Id: fpurge.c,v 1.18 2001/01/28 00:29:35 ca Exp $")
19 #include <stdlib.h>
20 #include <errno.h>
21 #include <sm/io.h>
22 #include <sm/assert.h>
23 #include "local.h"
26 ** SM_IO_PURGE -- purge/empty the buffer without committing buffer content
28 ** Parameters:
29 ** fp -- file pointer to purge
31 ** Returns:
32 ** Failure: returns SM_IO_EOF and sets errno
33 ** Success: returns 0 (zero)
36 int
37 sm_io_purge(fp)
38 register SM_FILE_T *fp;
40 SM_REQUIRE_ISA(fp, SmFileMagic);
41 if (!fp->f_flags)
43 errno = EBADF;
44 return SM_IO_EOF;
47 if (HASUB(fp))
48 FREEUB(fp);
49 fp->f_p = fp->f_bf.smb_base;
50 fp->f_r = 0;
52 /* implies SMFBF */
53 fp->f_w = fp->f_flags & (SMLBF|SMNBF) ? 0 : fp->f_bf.smb_size;
54 return 0;