io.h revision 363466
190792Sgshapiro/* 2261194Sgshapiro * Copyright (c) 2000-2002, 2004, 2013 Proofpoint, Inc. and its suppliers. 390792Sgshapiro * All rights reserved. 490792Sgshapiro * Copyright (c) 1990 590792Sgshapiro * The Regents of the University of California. All rights reserved. 690792Sgshapiro * 790792Sgshapiro * This code is derived from software contributed to Berkeley by 890792Sgshapiro * Chris Torek. 990792Sgshapiro * 1090792Sgshapiro * By using this file, you agree to the terms and conditions set 1190792Sgshapiro * forth in the LICENSE file which can be found at the top level of 1290792Sgshapiro * the sendmail distribution. 1390792Sgshapiro * 14266527Sgshapiro * $Id: io.h,v 1.26 2013-11-22 20:51:31 ca Exp $ 1590792Sgshapiro */ 1690792Sgshapiro 1790792Sgshapiro/*- 1890792Sgshapiro * @(#)stdio.h 5.17 (Berkeley) 6/3/91 1990792Sgshapiro */ 2090792Sgshapiro 2190792Sgshapiro#ifndef SM_IO_H 2290792Sgshapiro#define SM_IO_H 2390792Sgshapiro 2490792Sgshapiro#include <stdio.h> 2590792Sgshapiro#include <sm/gen.h> 2690792Sgshapiro#include <sm/varargs.h> 2790792Sgshapiro 2890792Sgshapiro/* mode for sm io (exposed) */ 2990792Sgshapiro#define SM_IO_RDWR 1 /* read-write */ 3090792Sgshapiro#define SM_IO_RDONLY 2 /* read-only */ 3190792Sgshapiro#define SM_IO_WRONLY 3 /* write-only */ 3290792Sgshapiro#define SM_IO_APPEND 4 /* write-only from eof */ 3390792Sgshapiro#define SM_IO_APPENDRW 5 /* read-write from eof */ 3490792Sgshapiro#define SM_IO_RDWRTR 6 /* read-write with truncation indicated */ 3590792Sgshapiro 36120256Sgshapiro# define SM_IO_BINARY 0x0 /* binary mode: not used in Unix */ 37132943Sgshapiro#define SM_IS_BINARY(mode) (((mode) & SM_IO_BINARY) != 0) 38120256Sgshapiro#define SM_IO_MODE(mode) ((mode) & 0x0f) 39120256Sgshapiro 40132943Sgshapiro#define SM_IO_RDWR_B (SM_IO_RDWR|SM_IO_BINARY) 41132943Sgshapiro#define SM_IO_RDONLY_B (SM_IO_RDONLY|SM_IO_BINARY) 42132943Sgshapiro#define SM_IO_WRONLY_B (SM_IO_WRONLY|SM_IO_BINARY) 43132943Sgshapiro#define SM_IO_APPEND_B (SM_IO_APPEND|SM_IO_BINARY) 44120256Sgshapiro#define SM_IO_APPENDRW_B (SM_IO_APPENDRW|SM_IO_BINARY) 45132943Sgshapiro#define SM_IO_RDWRTR_B (SM_IO_RDWRTR|SM_IO_BINARY) 46120256Sgshapiro 4790792Sgshapiro/* for sm_io_fseek, et al api's (exposed) */ 4890792Sgshapiro#define SM_IO_SEEK_SET 0 4990792Sgshapiro#define SM_IO_SEEK_CUR 1 5090792Sgshapiro#define SM_IO_SEEK_END 2 5190792Sgshapiro 5290792Sgshapiro/* flags for info what's with different types (exposed) */ 5390792Sgshapiro#define SM_IO_WHAT_MODE 1 5490792Sgshapiro#define SM_IO_WHAT_VECTORS 2 5590792Sgshapiro#define SM_IO_WHAT_FD 3 56363466Sgshapiro/* was WHAT_TYPE 4 unused */ 5790792Sgshapiro#define SM_IO_WHAT_ISTYPE 5 5890792Sgshapiro#define SM_IO_IS_READABLE 6 5990792Sgshapiro#define SM_IO_WHAT_TIMEOUT 7 6094334Sgshapiro#define SM_IO_WHAT_SIZE 8 6190792Sgshapiro 6290792Sgshapiro/* info flags (exposed) */ 6390792Sgshapiro#define SM_IO_FTYPE_CREATE 1 6490792Sgshapiro#define SM_IO_FTYPE_MODIFY 2 6590792Sgshapiro#define SM_IO_FTYPE_DELETE 3 6690792Sgshapiro 6790792Sgshapiro#define SM_IO_SL_PRIO 1 6890792Sgshapiro 6990792Sgshapiro#define SM_IO_OPEN_MAX 20 7090792Sgshapiro 7190792Sgshapiro/* for internal buffers */ 7290792Sgshapirostruct smbuf 7390792Sgshapiro{ 7490792Sgshapiro unsigned char *smb_base; 7590792Sgshapiro int smb_size; 7690792Sgshapiro}; 7790792Sgshapiro 7890792Sgshapiro/* 7990792Sgshapiro** sm I/O state variables (internal only). 8090792Sgshapiro** 8190792Sgshapiro** The following always hold: 8290792Sgshapiro** 8390792Sgshapiro** if (flags&(SMLBF|SMWR)) == (SMLBF|SMWR), 8490792Sgshapiro** lbfsize is -bf.size, else lbfsize is 0 8590792Sgshapiro** if flags&SMRD, w is 0 8690792Sgshapiro** if flags&SMWR, r is 0 8790792Sgshapiro** 8890792Sgshapiro** This ensures that the getc and putc macros (or inline functions) never 8990792Sgshapiro** try to write or read from a file that is in `read' or `write' mode. 9090792Sgshapiro** (Moreover, they can, and do, automatically switch from read mode to 9190792Sgshapiro** write mode, and back, on "r+" and "w+" files.) 9290792Sgshapiro** 9390792Sgshapiro** lbfsize is used only to make the inline line-buffered output stream 9490792Sgshapiro** code as compact as possible. 9590792Sgshapiro** 9690792Sgshapiro** ub, up, and ur are used when ungetc() pushes back more characters 9790792Sgshapiro** than fit in the current bf, or when ungetc() pushes back a character 9890792Sgshapiro** that does not match the previous one in bf. When this happens, 9990792Sgshapiro** ub.base becomes non-nil (i.e., a stream has ungetc() data iff 10090792Sgshapiro** ub.base!=NULL) and up and ur save the current values of p and r. 10190792Sgshapiro*/ 10290792Sgshapiro 10390792Sgshapirotypedef struct sm_file SM_FILE_T; 10490792Sgshapiro 10590792Sgshapirostruct sm_file 10690792Sgshapiro{ 10790792Sgshapiro const char *sm_magic; /* This SM_FILE_T is free when NULL */ 10890792Sgshapiro unsigned char *f_p; /* current position in (some) buffer */ 10990792Sgshapiro int f_r; /* read space left for getc() */ 11090792Sgshapiro int f_w; /* write space left for putc() */ 11190792Sgshapiro long f_flags; /* flags, below */ 11290792Sgshapiro short f_file; /* fileno, if Unix fd, else -1 */ 11390792Sgshapiro struct smbuf f_bf; /* the buffer (>= 1 byte, if !NULL) */ 11490792Sgshapiro int f_lbfsize; /* 0 or -bf.size, for inline putc */ 11590792Sgshapiro 11690792Sgshapiro /* These can be used for any purpose by a file type implementation: */ 11790792Sgshapiro void *f_cookie; 11890792Sgshapiro int f_ival; 11990792Sgshapiro 12090792Sgshapiro /* operations */ 12190792Sgshapiro int (*f_close) __P((SM_FILE_T *)); 12290792Sgshapiro ssize_t (*f_read) __P((SM_FILE_T *, char *, size_t)); 12390792Sgshapiro off_t (*f_seek) __P((SM_FILE_T *, off_t, int)); 12490792Sgshapiro ssize_t (*f_write) __P((SM_FILE_T *, const char *, size_t)); 12590792Sgshapiro int (*f_open) __P((SM_FILE_T *, const void *, int, 12694334Sgshapiro const void *)); 12790792Sgshapiro int (*f_setinfo) __P((SM_FILE_T *, int , void *)); 12890792Sgshapiro int (*f_getinfo) __P((SM_FILE_T *, int , void *)); 12990792Sgshapiro int f_timeout; 13090792Sgshapiro int f_timeoutstate; /* either blocking or non-blocking */ 13190792Sgshapiro char *f_type; /* for by-type lookups */ 13290792Sgshapiro struct sm_file *f_flushfp; /* flush this before reading parent */ 13390792Sgshapiro struct sm_file *f_modefp; /* sync mode with this fp */ 13490792Sgshapiro 13590792Sgshapiro /* separate buffer for long sequences of ungetc() */ 13690792Sgshapiro struct smbuf f_ub; /* ungetc buffer */ 13790792Sgshapiro unsigned char *f_up; /* saved f_p when f_p is doing ungetc */ 13890792Sgshapiro int f_ur; /* saved f_r when f_r is counting ungetc */ 13990792Sgshapiro 14090792Sgshapiro /* tricks to meet minimum requirements even when malloc() fails */ 14190792Sgshapiro unsigned char f_ubuf[3]; /* guarantee an ungetc() buffer */ 14290792Sgshapiro unsigned char f_nbuf[1]; /* guarantee a getc() buffer */ 14390792Sgshapiro 14490792Sgshapiro /* Unix stdio files get aligned to block boundaries on fseek() */ 14590792Sgshapiro int f_blksize; /* stat.st_blksize (may be != bf.size) */ 14690792Sgshapiro off_t f_lseekoff; /* current lseek offset */ 14790792Sgshapiro int f_dup_cnt; /* count file dup'd */ 14890792Sgshapiro}; 14990792Sgshapiro 15090792Sgshapiro__BEGIN_DECLS 15190792Sgshapiroextern SM_FILE_T SmIoF[]; 15290792Sgshapiroextern const char SmFileMagic[]; 15390792Sgshapiroextern SM_FILE_T SmFtStdio_def; 15490792Sgshapiroextern SM_FILE_T SmFtStdiofd_def; 15590792Sgshapiroextern SM_FILE_T SmFtString_def; 15690792Sgshapiroextern SM_FILE_T SmFtSyslog_def; 15790792Sgshapiroextern SM_FILE_T SmFtRealStdio_def; 15890792Sgshapiro 15990792Sgshapiro#define SMIOIN_FILENO 0 16090792Sgshapiro#define SMIOOUT_FILENO 1 16190792Sgshapiro#define SMIOERR_FILENO 2 16290792Sgshapiro#define SMIOSTDIN_FILENO 3 16390792Sgshapiro#define SMIOSTDOUT_FILENO 4 16490792Sgshapiro#define SMIOSTDERR_FILENO 5 16590792Sgshapiro 16690792Sgshapiro/* Common predefined and already (usually) open files (exposed) */ 16790792Sgshapiro#define smioin (&SmIoF[SMIOIN_FILENO]) 16890792Sgshapiro#define smioout (&SmIoF[SMIOOUT_FILENO]) 16990792Sgshapiro#define smioerr (&SmIoF[SMIOERR_FILENO]) 17090792Sgshapiro#define smiostdin (&SmIoF[SMIOSTDIN_FILENO]) 17190792Sgshapiro#define smiostdout (&SmIoF[SMIOSTDOUT_FILENO]) 17290792Sgshapiro#define smiostderr (&SmIoF[SMIOSTDERR_FILENO]) 17390792Sgshapiro 17490792Sgshapiro#define SmFtStdio (&SmFtStdio_def) 17590792Sgshapiro#define SmFtStdiofd (&SmFtStdiofd_def) 17690792Sgshapiro#define SmFtString (&SmFtString_def) 17790792Sgshapiro#define SmFtSyslog (&SmFtSyslog_def) 17890792Sgshapiro#define SmFtRealStdio (&SmFtRealStdio_def) 17990792Sgshapiro 18090792Sgshapiro#ifdef __STDC__ 18190792Sgshapiro# define SM_IO_SET_TYPE(f, name, open, close, read, write, seek, get, set, timeout) \ 18290792Sgshapiro (f) = {SmFileMagic, (unsigned char *) 0, 0, 0, 0L, -1, {0}, 0, (void *) 0,\ 18390792Sgshapiro 0, (close), (read), (seek), (write), (open), (set), (get), (timeout),\ 18490792Sgshapiro 0, (name)} 18590792Sgshapiro# define SM_IO_INIT_TYPE(f, name, open, close, read, write, seek, get, set, timeout) 18690792Sgshapiro 18790792Sgshapiro#else /* __STDC__ */ 18890792Sgshapiro# define SM_IO_SET_TYPE(f, name, open, close, read, write, seek, get, set, timeout) (f) 18990792Sgshapiro# define SM_IO_INIT_TYPE(f, name, open, close, read, write, seek, get, set, timeout) \ 19090792Sgshapiro (f).sm_magic = SmFileMagic; \ 19190792Sgshapiro (f).f_p = (unsigned char *) 0; \ 19290792Sgshapiro (f).f_r = 0; \ 19390792Sgshapiro (f).f_w = 0; \ 19490792Sgshapiro (f).f_flags = 0L; \ 19590792Sgshapiro (f).f_file = 0; \ 19690792Sgshapiro (f).f_bf.smb_base = (unsigned char *) 0; \ 19790792Sgshapiro (f).f_bf.smb_size = 0; \ 19890792Sgshapiro (f).f_lbfsize = 0; \ 19990792Sgshapiro (f).f_cookie = (void *) 0; \ 20090792Sgshapiro (f).f_ival = 0; \ 20190792Sgshapiro (f).f_close = (close); \ 20290792Sgshapiro (f).f_read = (read); \ 20390792Sgshapiro (f).f_seek = (seek); \ 20490792Sgshapiro (f).f_write = (write); \ 20590792Sgshapiro (f).f_open = (open); \ 20690792Sgshapiro (f).f_setinfo = (set); \ 20790792Sgshapiro (f).f_getinfo = (get); \ 20890792Sgshapiro (f).f_timeout = (timeout); \ 20990792Sgshapiro (f).f_timeoutstate = 0; \ 21090792Sgshapiro (f).f_type = (name); 21190792Sgshapiro 21290792Sgshapiro#endif /* __STDC__ */ 21390792Sgshapiro 21490792Sgshapiro__END_DECLS 21590792Sgshapiro 21690792Sgshapiro/* Internal flags */ 21790792Sgshapiro#define SMFBF 0x000001 /* XXXX fully buffered */ 21890792Sgshapiro#define SMLBF 0x000002 /* line buffered */ 21990792Sgshapiro#define SMNBF 0x000004 /* unbuffered */ 22090792Sgshapiro#define SMNOW 0x000008 /* Flush each write; take read now */ 22190792Sgshapiro#define SMRD 0x000010 /* OK to read */ 22290792Sgshapiro#define SMWR 0x000020 /* OK to write */ 22390792Sgshapiro /* RD and WR are never simultaneously asserted */ 22490792Sgshapiro#define SMRW 0x000040 /* open for reading & writing */ 22590792Sgshapiro#define SMFEOF 0x000080 /* found EOF */ 22690792Sgshapiro#define SMERR 0x000100 /* found error */ 22790792Sgshapiro#define SMMBF 0x000200 /* buf is from malloc */ 22890792Sgshapiro#define SMAPP 0x000400 /* fdopen()ed in append mode */ 22990792Sgshapiro#define SMSTR 0x000800 /* this is an snprintf string */ 23090792Sgshapiro#define SMOPT 0x001000 /* do fseek() optimisation */ 23190792Sgshapiro#define SMNPT 0x002000 /* do not do fseek() optimisation */ 23290792Sgshapiro#define SMOFF 0x004000 /* set iff offset is in fact correct */ 23390792Sgshapiro#define SMALC 0x010000 /* allocate string space dynamically */ 23490792Sgshapiro 23594334Sgshapiro#define SMMODEMASK 0x0070 /* read/write mode */ 23690792Sgshapiro 23790792Sgshapiro/* defines for timeout constants */ 23890792Sgshapiro#define SM_TIME_IMMEDIATE (0) 23990792Sgshapiro#define SM_TIME_FOREVER (-1) 24090792Sgshapiro#define SM_TIME_DEFAULT (-2) 24190792Sgshapiro 24290792Sgshapiro/* timeout state for blocking */ 24390792Sgshapiro#define SM_TIME_BLOCK (0) /* XXX just bool? */ 24490792Sgshapiro#define SM_TIME_NONBLOCK (1) 24590792Sgshapiro 24690792Sgshapiro/* Exposed buffering type flags */ 24790792Sgshapiro#define SM_IO_FBF 0 /* setvbuf should set fully buffered */ 24890792Sgshapiro#define SM_IO_LBF 1 /* setvbuf should set line buffered */ 24990792Sgshapiro#define SM_IO_NBF 2 /* setvbuf should set unbuffered */ 25090792Sgshapiro 25190792Sgshapiro/* setvbuf buffered, but through at lower file type layers */ 25290792Sgshapiro#define SM_IO_NOW 3 25390792Sgshapiro 25490792Sgshapiro/* 25590792Sgshapiro** size of buffer used by setbuf. 25690792Sgshapiro** If underlying filesystem blocksize is discoverable that is used instead 25790792Sgshapiro*/ 25890792Sgshapiro 25990792Sgshapiro#define SM_IO_BUFSIZ 4096 26090792Sgshapiro 26190792Sgshapiro#define SM_IO_EOF (-1) 26290792Sgshapiro 26390792Sgshapiro/* Functions defined in ANSI C standard. */ 26490792Sgshapiro__BEGIN_DECLS 26590792SgshapiroSM_FILE_T *sm_io_autoflush __P((SM_FILE_T *, SM_FILE_T *)); 26690792Sgshapirovoid sm_io_automode __P((SM_FILE_T *, SM_FILE_T *)); 26790792Sgshapirovoid sm_io_clearerr __P((SM_FILE_T *)); 26890792Sgshapiroint sm_io_close __P((SM_FILE_T *, int SM_NONVOLATILE)); 26990792SgshapiroSM_FILE_T *sm_io_dup __P((SM_FILE_T *)); 27090792Sgshapiroint sm_io_eof __P((SM_FILE_T *)); 27190792Sgshapiroint sm_io_error __P((SM_FILE_T *)); 272249729Sgshapiroint sm_io_fgets __P((SM_FILE_T *, int, char *, int)); 27390792Sgshapiroint sm_io_flush __P((SM_FILE_T *, int SM_NONVOLATILE)); 27490792Sgshapiro 27590792Sgshapiroint PRINTFLIKE(3, 4) 27690792Sgshapirosm_io_fprintf __P((SM_FILE_T *, int, const char *, ...)); 27790792Sgshapiro 27890792Sgshapiroint sm_io_fputs __P((SM_FILE_T *, int, const char *)); 27990792Sgshapiro 28090792Sgshapiroint SCANFLIKE(3, 4) 28190792Sgshapirosm_io_fscanf __P((SM_FILE_T *, int, const char *, ...)); 28290792Sgshapiro 28390792Sgshapiroint sm_io_getc __P((SM_FILE_T *, int)); 28490792Sgshapiroint sm_io_getinfo __P((SM_FILE_T *, int, void *)); 28590792SgshapiroSM_FILE_T *sm_io_open __P((const SM_FILE_T *, int SM_NONVOLATILE, const void *, 28690792Sgshapiro int, const void *)); 28790792Sgshapiroint sm_io_purge __P((SM_FILE_T *)); 28890792Sgshapiroint sm_io_putc __P((SM_FILE_T *, int, int)); 28990792Sgshapirosize_t sm_io_read __P((SM_FILE_T *, int, void *, size_t)); 29090792SgshapiroSM_FILE_T *sm_io_reopen __P((const SM_FILE_T *, int SM_NONVOLATILE, 29190792Sgshapiro const void *, int, const void *, SM_FILE_T *)); 29290792Sgshapirovoid sm_io_rewind __P((SM_FILE_T *, int)); 29390792Sgshapiroint sm_io_seek __P((SM_FILE_T *, int SM_NONVOLATILE, long SM_NONVOLATILE, 29490792Sgshapiro int SM_NONVOLATILE)); 29590792Sgshapiroint sm_io_setinfo __P((SM_FILE_T *, int, void *)); 29690792Sgshapiroint sm_io_setvbuf __P((SM_FILE_T *, int, char *, int, size_t)); 29790792Sgshapiro 29890792Sgshapiroint SCANFLIKE(2, 3) 29990792Sgshapirosm_io_sscanf __P((const char *, char const *, ...)); 30090792Sgshapiro 30190792Sgshapirolong sm_io_tell __P((SM_FILE_T *, int SM_NONVOLATILE)); 30290792Sgshapiroint sm_io_ungetc __P((SM_FILE_T *, int, int)); 30390792Sgshapiroint sm_io_vfprintf __P((SM_FILE_T *, int, const char *, va_list)); 30490792Sgshapirosize_t sm_io_write __P((SM_FILE_T *, int, const void *, size_t)); 30590792Sgshapiro 30690792Sgshapirovoid sm_strio_init __P((SM_FILE_T *, char *, size_t)); 30790792Sgshapiro 30890792Sgshapiroextern SM_FILE_T * 30990792Sgshapirosm_io_fopen __P(( 31090792Sgshapiro char *_pathname, 31190792Sgshapiro int _flags, 31290792Sgshapiro ...)); 31390792Sgshapiro 31490792Sgshapiroextern SM_FILE_T * 31590792Sgshapirosm_io_stdioopen __P(( 31690792Sgshapiro FILE *_stream, 31790792Sgshapiro char *_mode)); 31890792Sgshapiro 31990792Sgshapiroextern int 32090792Sgshapirosm_vasprintf __P(( 32190792Sgshapiro char **_str, 32290792Sgshapiro const char *_fmt, 32390792Sgshapiro va_list _ap)); 32490792Sgshapiro 32590792Sgshapiroextern int 32690792Sgshapirosm_vsnprintf __P(( 32790792Sgshapiro char *, 32890792Sgshapiro size_t, 32990792Sgshapiro const char *, 33090792Sgshapiro va_list)); 33190792Sgshapiro 33290792Sgshapiroextern void 33390792Sgshapirosm_perror __P(( 33490792Sgshapiro const char *)); 33590792Sgshapiro 33690792Sgshapiro__END_DECLS 33790792Sgshapiro 33890792Sgshapiro/* 33990792Sgshapiro** Functions internal to the implementation. 34090792Sgshapiro*/ 34190792Sgshapiro 34290792Sgshapiro__BEGIN_DECLS 34390792Sgshapiroint sm_rget __P((SM_FILE_T *, int)); 34490792Sgshapiroint sm_vfscanf __P((SM_FILE_T *, int SM_NONVOLATILE, const char *, 345363466Sgshapiro va_list)); 34690792Sgshapiroint sm_wbuf __P((SM_FILE_T *, int, int)); 34790792Sgshapiro__END_DECLS 34890792Sgshapiro 34990792Sgshapiro/* 35090792Sgshapiro** The macros are here so that we can 35190792Sgshapiro** define function versions in the library. 35290792Sgshapiro*/ 35390792Sgshapiro 35490792Sgshapiro#define sm_getc(f, t) \ 35590792Sgshapiro (--(f)->f_r < 0 ? \ 35690792Sgshapiro sm_rget(f, t) : \ 35790792Sgshapiro (int)(*(f)->f_p++)) 35890792Sgshapiro 35990792Sgshapiro/* 36090792Sgshapiro** This has been tuned to generate reasonable code on the vax using pcc. 36190792Sgshapiro** (It also generates reasonable x86 code using gcc.) 36290792Sgshapiro*/ 36390792Sgshapiro 36490792Sgshapiro#define sm_putc(f, t, c) \ 36590792Sgshapiro (--(f)->f_w < 0 ? \ 36690792Sgshapiro (f)->f_w >= (f)->f_lbfsize ? \ 36790792Sgshapiro (*(f)->f_p = (c)), *(f)->f_p != '\n' ? \ 36890792Sgshapiro (int)*(f)->f_p++ : \ 36990792Sgshapiro sm_wbuf(f, t, '\n') : \ 37090792Sgshapiro sm_wbuf(f, t, (int)(c)) : \ 37190792Sgshapiro (*(f)->f_p = (c), (int)*(f)->f_p++)) 37290792Sgshapiro 37390792Sgshapiro#define sm_eof(p) (((p)->f_flags & SMFEOF) != 0) 37490792Sgshapiro#define sm_error(p) (((p)->f_flags & SMERR) != 0) 37590792Sgshapiro#define sm_clearerr(p) ((void)((p)->f_flags &= ~(SMERR|SMFEOF))) 37690792Sgshapiro 37790792Sgshapiro#define sm_io_eof(p) sm_eof(p) 37890792Sgshapiro#define sm_io_error(p) sm_error(p) 37990792Sgshapiro 38090792Sgshapiro#define sm_io_clearerr(p) sm_clearerr(p) 38190792Sgshapiro 38290792Sgshapiro#ifndef lint 38390792Sgshapiro# ifndef _POSIX_SOURCE 38490792Sgshapiro# define sm_io_getc(fp, t) sm_getc(fp, t) 38590792Sgshapiro# define sm_io_putc(fp, t, x) sm_putc(fp, t, x) 386363466Sgshapiro# endif 38790792Sgshapiro#endif /* lint */ 38890792Sgshapiro 38990792Sgshapiro#endif /* SM_IO_H */ 390