fput.c revision 261363
1147997Srwatson/* 2147997Srwatson * Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers. 3147997Srwatson * All rights reserved. 4147997Srwatson * Copyright (c) 1990, 1993 5147997Srwatson * The Regents of the University of California. All rights reserved. 6147997Srwatson * 7147997Srwatson * This code is derived from software contributed to Berkeley by 8147997Srwatson * Chris Torek. 9147997Srwatson * 10147997Srwatson * By using this file, you agree to the terms and conditions set 11147997Srwatson * forth in the LICENSE file which can be found at the top level of 12147997Srwatson * the sendmail distribution. 13147997Srwatson */ 14147997Srwatson 15147997Srwatson#include <sm/gen.h> 16147997SrwatsonSM_RCSID("@(#)$Id: fput.c,v 1.21 2013/11/22 20:51:42 ca Exp $") 17147997Srwatson#include <string.h> 18147997Srwatson#include <errno.h> 19147997Srwatson#include <sm/io.h> 20147997Srwatson#include <sm/assert.h> 21147997Srwatson#include "local.h" 22147997Srwatson#include "fvwrite.h" 23147997Srwatson 24147997Srwatson/* 25147997Srwatson** SM_IO_FPUTS -- add a string to the buffer for the file pointer 26147997Srwatson** 27147997Srwatson** Parameters: 28147997Srwatson** fp -- the file pointer for the buffer to be written to 29147997Srwatson** timeout -- time to complete the put-string 30147997Srwatson** s -- string to be placed in the buffer 31147997Srwatson** 32147997Srwatson** Returns: 33147997Srwatson** Failure: returns SM_IO_EOF 34147997Srwatson** Success: returns 0 (zero) 35147997Srwatson*/ 36147997Srwatson 37147997Srwatsonint 38147997Srwatsonsm_io_fputs(fp, timeout, s) 39147997Srwatson SM_FILE_T *fp; 40147997Srwatson int timeout; 41148359Srwatson const char *s; 42148359Srwatson{ 43148359Srwatson struct sm_uio uio; 44148359Srwatson struct sm_iov iov; 45148359Srwatson 46148359Srwatson SM_REQUIRE_ISA(fp, SmFileMagic); 47148359Srwatson iov.iov_base = (void *) s; 48148359Srwatson iov.iov_len = uio.uio_resid = strlen(s); 49148359Srwatson uio.uio_iov = &iov; 50148359Srwatson uio.uio_iovcnt = 1; 51148359Srwatson return sm_fvwrite(fp, timeout, &uio); 52148359Srwatson} 53148359Srwatson