diff options
author | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
---|---|---|
committer | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
commit | 7c478bd95313f5f23a4c958a745db2134aa03244 (patch) | |
tree | c871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/cmd/sendmail/libsm/put.c | |
download | illumos-joyent-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz |
OpenSolaris Launch
Diffstat (limited to 'usr/src/cmd/sendmail/libsm/put.c')
-rw-r--r-- | usr/src/cmd/sendmail/libsm/put.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/usr/src/cmd/sendmail/libsm/put.c b/usr/src/cmd/sendmail/libsm/put.c new file mode 100644 index 0000000000..7940d102b3 --- /dev/null +++ b/usr/src/cmd/sendmail/libsm/put.c @@ -0,0 +1,82 @@ +/* + * 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 <sm/gen.h> +SM_RCSID("@(#)$Id: put.c,v 1.27 2001/12/19 05:19:35 ca 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; +{ + int save_errno = errno; + + 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(save_errno)); +} |