source: trunk/third/sendmail/libsm/put.c @ 19204

Revision 19204, 1.6 KB checked in by zacheiss, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r19203, which included commits to RCS files with non-trunk default branches.
Line 
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.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Chris Torek.
9 *
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.
13 */
14
15#include <sm/gen.h>
16SM_RCSID("@(#)$Id: put.c,v 1.1.1.1 2003-04-08 15:06:39 zacheiss Exp $")
17#include <string.h>
18#include <errno.h>
19#include <sm/io.h>
20#include <sm/assert.h>
21#include <sm/errstring.h>
22#include <sm/string.h>
23#include "local.h"
24#include "fvwrite.h"
25
26/*
27**  SM_IO_PUTC -- output a character to the file
28**
29**  Function version of the macro sm_io_putc (in <sm/io.h>).
30**
31**      Parameters:
32**              fp -- file to output to
33**              timeout -- time to complete putc
34**              c -- int value of character to output
35**
36**      Returns:
37**              Failure: returns SM_IO_EOF _and_ sets errno
38**              Success: returns sm_putc() value.
39**
40*/
41
42#undef sm_io_putc
43
44int
45sm_io_putc(fp, timeout, c)
46        SM_FILE_T *fp;
47        int timeout;
48        int c;
49{
50        SM_REQUIRE_ISA(fp, SmFileMagic);
51        if (cantwrite(fp))
52        {
53                errno = EBADF;
54                return SM_IO_EOF;
55        }
56        return sm_putc(fp, timeout, c);
57}
58
59
60/*
61**  SM_PERROR -- print system error messages to smioerr
62**
63**      Parameters:
64**              s -- message to print
65**
66**      Returns:
67**              none
68*/
69
70void
71sm_perror(s)
72        const char *s;
73{
74        int save_errno = errno;
75
76        if (s != NULL && *s != '\0')
77                (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s: ", s);
78        (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s\n",
79                             sm_errstring(save_errno));
80}
Note: See TracBrowser for help on using the repository browser.