1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
/*
* 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.
*/
#include <sm/gen.h>
SM_RCSID("@(#)$Sendmail: put.c,v 1.26 2001/09/11 04:04:49 gshapiro Exp $")
#include <string.h>
#include <errno.h>
#include <sm/io.h>
#include <sm/assert.h>
#include <sm/errstring.h>
#include <sm/string.h>
#include "local.h"
#include "fvwrite.h"
/*
** SM_IO_PUTC -- output a character to the file
**
** Function version of the macro sm_io_putc (in <sm/io.h>).
**
** Parameters:
** fp -- file to output to
** timeout -- time to complete putc
** c -- int value of character to output
**
** Returns:
** Failure: returns SM_IO_EOF _and_ sets errno
** Success: returns sm_putc() value.
**
*/
#undef sm_io_putc
int
sm_io_putc(fp, timeout, c)
SM_FILE_T *fp;
int timeout;
int c;
{
SM_REQUIRE_ISA(fp, SmFileMagic);
if (cantwrite(fp))
{
errno = EBADF;
return SM_IO_EOF;
}
return sm_putc(fp, timeout, c);
}
/*
** SM_PERROR -- print system error messages to smioerr
**
** Parameters:
** s -- message to print
**
** Returns:
** none
*/
void
sm_perror(s)
const char *s;
{
if (s != NULL && *s != '\0')
(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s: ", s);
(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s\n",
sm_errstring(errno));
}
|