1N/A * Copyright (c) 2000-2002, 2004, 2005 Sendmail, Inc. and its suppliers. 1N/A * All rights reserved. 1N/A * Copyright (c) 1990, 1993 1N/A * The Regents of the University of California. All rights reserved. 1N/A * This code is derived from software contributed to Berkeley by 1N/A * By using this file, you agree to the terms and conditions set 1N/A * forth in the LICENSE file which can be found at the top level of 1N/A * the sendmail distribution. 1N/A#
pragma ident "%Z%%M% %I% %E% SMI" 1N/A** Cookie structure for the "strio" file type 1N/A** SM_STRGROW -- increase storage space for string 1N/A** s -- current cookie 1N/A** size -- new storage size request 1N/A** true iff successful. 1N/A** SM_STRREAD -- read a portion of the string 1N/A** fp -- the file pointer 1N/A** buf -- location to place read data 1N/A** n -- number of bytes to read 1N/A** Failure: -1 and sets errno 1N/A** Success: >=0, number of bytes read 1N/A** SM_STRWRITE -- write a portion of the string 1N/A** fp -- the file pointer 1N/A** buf -- location of data for writing 1N/A** n -- number of bytes to write 1N/A** Failure: -1 and sets errno 1N/A** Success: >=0, number of bytes written 1N/A** SM_STRSEEK -- position the offset pointer for the string 1N/A** Only SM_IO_SEEK_SET, SM_IO_SEEK_CUR and SM_IO_SEEK_END are valid 1N/A** values for whence. 1N/A** fp -- the file pointer 1N/A** offset -- number of bytes offset from "base" 1N/A** whence -- determines "base" for 'offset' 1N/A** Failure: -1 and sets errno 1N/A** Success: >=0, number of bytes read 1N/A /* errno set by sm_strgrow */ 1N/A** SM_STROPEN -- open a string file type 1N/A** fp -- file pointer open to be associated with 1N/A** info -- initial contents (NULL for none) 1N/A** flags -- flags for methods of access (was mode) 1N/A** rpool -- resource pool to use memory from (if applicable) 1N/A** Failure: -1 and sets errno 1N/A#
endif /* SM_RPOOL */ 1N/A** SM_STRCLOSE -- close the string file type and free resources 1N/A** fp -- file pointer 1N/A#
endif /* !SM_RPOOL */ 1N/A** SM_STRSETMODE -- set mode info for the file 1N/A** Note: changing the mode can be a safe way to have the "parent" 1N/A** set up a string that the "child" is not to modify 1N/A** fp -- the file pointer 1N/A** mode -- location of new mode to set 1N/A** Failure: -1 and sets errno 1N/A** SM_STRGETMODE -- get mode info for the file 1N/A** fp -- the file pointer 1N/A** mode -- location to store current mode 1N/A** Failure: -1 and sets errno 1N/A** SM_STRSETINFO -- set info for the file 1N/A** Currently only SM_IO_WHAT_MODE is supported for 'what'. 1N/A** fp -- the file pointer 1N/A** what -- type of information to set 1N/A** valp -- location to data for doing set 1N/A** Failure: -1 and sets errno 1N/A** Success: sm_strsetmode() return [0 (zero)] 1N/A** SM_STRGETINFO -- get info for the file 1N/A** Currently only SM_IO_WHAT_MODE is supported for 'what'. 1N/A** fp -- the file pointer 1N/A** what -- type of information requested 1N/A** valp -- location to return information in 1N/A** Failure: -1 and sets errno 1N/A** Success: sm_strgetmode() return [0 (zero)] 1N/A** SM_STRIO_INIT -- initializes a write-only string type 1N/A** Original comments below. This function does not appear to be used anywhere. 1N/A** The same functionality can be done by changing the mode of the file. 1N/A** sm_strio_init initializes an SM_FILE_T structure as a write-only file 1N/A** that writes into the specified buffer: 1N/A** - Use sm_io_putc, sm_io_fprintf, etc, to write into the buffer. 1N/A** Attempts to write more than size-1 characters into the buffer will fail 1N/A** silently (no error is reported). 1N/A** - Use sm_io_fflush to nul terminate the string in the buffer 1N/A** (the write pointer is not advanced). 1N/A** No memory is allocated either by sm_strio_init or by sm_io_{putc,write} etc. 1N/A** fp -- file pointer 1N/A** buf -- memory location for stored data 1N/A** size -- size of 'buf'