1 /* @(#)schily.h 1.52 04/03/05 Copyright 1985-2002 J. Schilling */ 2 /* 3 * Definitions for libschily 4 * 5 * This file should be included past: 6 * 7 * mconfig.h / config.h 8 * standard.h 9 * stdio.h 10 * stdlib.h (better use stdxlib.h) 11 * unistd.h (better use unixstd.h) needed LARGEFILE support 12 * string.h 13 * sys/types.h 14 * 15 * If you need stdio.h, you must include it before schily.h 16 * 17 * NOTE: If you need ctype.h and did not include stdio.h you need to 18 * include ctype.h past schily.h as OpenBSD does not follow POSIX and 19 * defines EOF in ctype.h 20 * 21 * Copyright (c) 1985-2002 J. Schilling 22 */ 23 /* 24 * This program is free software; you can redistribute it and/or modify 25 * it under the terms of the GNU General Public License as published by 26 * the Free Software Foundation; either version 2, or (at your option) 27 * any later version. 28 * 29 * This program is distributed in the hope that it will be useful, 30 * but WITHOUT ANY WARRANTY; without even the implied warranty of 31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32 * GNU General Public License for more details. 33 * 34 * You should have received a copy of the GNU General Public License along with 35 * this program; see the file COPYING. If not, write to the Free Software 36 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 37 */ 38 39 #ifndef _SCHILY_H 40 #define _SCHILY_H 41 42 #ifndef _STANDARD_H 43 #include <standard.h> 44 #endif 45 #ifndef _CCOMDEFS_H 46 #include <ccomdefs.h> 47 #endif 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 52 53 #if defined(_INCL_SYS_TYPES_H) || defined(off_t) 54 # ifndef FOUND_OFF_T 55 # define FOUND_OFF_T 56 # endif 57 #endif 58 #if defined(_INCL_SYS_TYPES_H) || defined(size_t) 59 # ifndef FOUND_SIZE_T 60 # define FOUND_SIZE_T 61 # endif 62 #endif 63 64 #ifdef __never_def__ 65 /* 66 * It turns out that we cannot use the folloginw definition because there are 67 * some platforms that do not behave application friendly. These are mainly 68 * BSD-4.4 based systems (which #undef a definition when size_t is available. 69 * We actually removed this code because of a problem with QNX Neutrino. 70 * For this reason, it is important not to include <sys/types.h> directly but 71 * via the Schily SING include files so we know whether it has been included 72 * before we come here. 73 */ 74 #if defined(_SIZE_T) || defined(_T_SIZE_) || defined(_T_SIZE) || \ 75 defined(__SIZE_T) || defined(_SIZE_T_) || \ 76 defined(_GCC_SIZE_T) || defined(_SIZET_) || \ 77 defined(__sys_stdtypes_h) || defined(___int_size_t_h) || defined(size_t) 78 79 #ifndef FOUND_SIZE_T 80 # define FOUND_SIZE_T /* We already included a size_t definition */ 81 #endif 82 #endif 83 #endif /* __never_def__ */ 84 85 #if defined(HAVE_LARGEFILES) 86 # define _fcons _fcons64 87 # define fdup fdup64 88 # define fileluopen fileluopen64 89 # define fileopen fileopen64 90 # define filemopen filemopen64 91 # define filepos filepos64 92 # define filereopen filereopen64 93 # define fileseek fileseek64 94 # define filesize filesize64 95 # define filestat filestat64 96 # define _openfd _openfd64 97 #endif 98 99 #ifdef EOF /* stdio.h has been included */ 100 extern int _cvmod __PR((const char *, int *, int *)); 101 extern FILE *_fcons __PR((FILE *, int, int)); 102 extern FILE *fdup __PR((FILE *)); 103 extern int fdown __PR((FILE *)); 104 extern int fexecl __PR((const char *, FILE *, FILE *, FILE *, 105 const char *, ...)); 106 extern int fexecle __PR((const char *, FILE *, FILE *, FILE *, 107 const char *, ...)); 108 /* 6th arg not const, fexecv forces av[ac] = NULL */ 109 extern int fexecv __PR((const char *, FILE *, FILE *, FILE *, int, 110 char **)); 111 extern int fexecve_schily __PR((const char *, FILE *, FILE *, FILE *, 112 char * const *, char * const *)); 113 extern int fspawnv __PR((FILE *, FILE *, FILE *, int, char * const *)); 114 extern int fspawnl __PR((FILE *, FILE *, FILE *, 115 const char *, const char *, ...)); 116 extern int fspawnv_nowait __PR((FILE *, FILE *, FILE *, 117 const char *, int, char *const*)); 118 extern int fgetline __PR((FILE *, char *, int)); 119 extern int fgetstr __PR((FILE *, char *, int)); 120 extern void file_raise __PR((FILE *, int)); 121 extern int fileclose __PR((FILE *)); 122 extern FILE *fileluopen __PR((int, const char *)); 123 extern FILE *fileopen __PR((const char *, const char *)); 124 #ifdef _INCL_SYS_TYPES_H 125 extern FILE *filemopen __PR((const char *, const char *, mode_t)); 126 #endif 127 #ifdef FOUND_OFF_T 128 extern off_t filepos __PR((FILE *)); 129 #endif 130 extern int fileread __PR((FILE *, void *, int)); 131 extern int ffileread __PR((FILE *, void *, int)); 132 extern FILE *filereopen __PR((const char *, const char *, FILE *)); 133 #ifdef FOUND_OFF_T 134 extern int fileseek __PR((FILE *, off_t)); 135 extern off_t filesize __PR((FILE *)); 136 #endif 137 #ifdef S_IFMT 138 extern int filestat __PR((FILE *, struct stat *)); 139 #endif 140 extern int filewrite __PR((FILE *, void *, int)); 141 extern int ffilewrite __PR((FILE *, void *, int)); 142 extern int flush __PR((void)); 143 extern int fpipe __PR((FILE **)); 144 /*extern int fprintf __PR((FILE *, const char *, ...)) __printflike__(2, 3);*/ 145 extern int getbroken __PR((FILE *, char *, char, char **, int)); 146 extern int ofindline __PR((FILE *, char, const char *, int, 147 char **, int)); 148 extern int peekc __PR((FILE *)); 149 150 #ifdef __never_def__ 151 /* 152 * We cannot define this or we may get into problems with DOS based systems. 153 */ 154 extern int spawnv __PR((FILE *, FILE *, FILE *, int, char * const *)); 155 extern int spawnl __PR((FILE *, FILE *, FILE *, 156 const char *, const char *, ...)); 157 extern int spawnv_nowait __PR((FILE *, FILE *, FILE *, 158 const char *, int, char *const*)); 159 #endif /* __never_def__m */ 160 #endif /* EOF */ 161 162 extern int _niread __PR((int, void *, int)); 163 extern int _niwrite __PR((int, void *, int)); 164 extern int _nixread __PR((int, void *, int)); 165 extern int _nixwrite __PR((int, void *, int)); 166 extern int _openfd __PR((const char *, int)); 167 extern int on_comerr __PR((void (*fun)(int, void *), void *arg)); 168 /*PRINTFLIKE1*/ 169 extern void comerr __PR((const char *, ...)) __printflike__(1, 2); 170 /*PRINTFLIKE2*/ 171 extern void comerrno __PR((int, const char *, ...)) __printflike__(2, 3); 172 /*PRINTFLIKE1*/ 173 extern int errmsg __PR((const char *, ...)) __printflike__(1, 2); 174 /*PRINTFLIKE2*/ 175 extern int errmsgno __PR((int, const char *, ...)) __printflike__(2, 3); 176 #ifdef FOUND_SIZE_T 177 /*PRINTFLIKE3*/ 178 extern int serrmsg __PR((char *, size_t, const char *, ...)) __printflike__(3, 4); 179 /*PRINTFLIKE4*/ 180 extern int serrmsgno __PR((int, char *, size_t, const char *, ...)) __printflike__(4, 5); 181 #endif 182 extern void comexit __PR((int)); 183 extern char *errmsgstr __PR((int)); 184 /*PRINTFLIKE1*/ 185 extern int error __PR((const char *, ...)) __printflike__(1, 2); 186 extern char *fillbytes __PR((void *, int, char)); 187 extern char *findbytes __PR((const void *, int, char)); 188 extern int findline __PR((const char *, char, const char *, 189 int, char **, int)); 190 extern int getline_schily __PR((char *, int)); 191 extern int getstr __PR((char *, int)); 192 extern int breakline __PR((char *, char, char **, int)); 193 extern int getallargs __PR((int *, char * const**, const char *, ...)); 194 extern int getargs __PR((int *, char * const**, const char *, ...)); 195 extern int getfiles __PR((int *, char * const**, const char *)); 196 extern char *astoi __PR((const char *, int *)); 197 extern char *astol __PR((const char *, long *)); 198 extern char *astolb __PR((const char *, long *, int base)); 199 #ifdef _UTYPES_H 200 extern char *astoll __PR((const char *, Llong *)); 201 extern char *astollb __PR((const char *, Llong *, int base)); 202 #endif 203 204 /*extern void handlecond __PR((const char *, SIGBLK *, int(*)(const char *, long, long), long));*/ 205 /*extern void unhandlecond __PR((SIGBLK *));*/ 206 207 extern int patcompile __PR((const unsigned char *, int, int *)); 208 extern unsigned char *patmatch __PR((const unsigned char *, const int *, 209 const unsigned char *, int, int, int, int[])); 210 extern unsigned char *patlmatch __PR((const unsigned char *, const int *, 211 const unsigned char *, int, int, int, int[])); 212 213 /*extern int printf __PR((const char *, ...)) __printflike__(1, 2);*/ 214 extern char *movebytes __PR((const void *, void *, int)); 215 216 extern void save_args __PR((int, char **)); 217 extern int saved_ac __PR((void)); 218 extern char **saved_av __PR((void)); 219 extern char *saved_av0 __PR((void)); 220 #ifndef seterrno 221 extern int seterrno __PR((int)); 222 #endif 223 extern void set_progname __PR((const char *)); 224 extern char *get_progname __PR((void)); 225 226 extern void setfp __PR((void * const *)); 227 extern int wait_chld __PR((int)); /* for fspawnv_nowait() */ 228 extern int geterrno __PR((void)); 229 extern void raisecond __PR((const char *, long)); 230 #ifdef FOUND_SIZE_T 231 /* 232 * We currently cannot define this here because there IXIX has a definition 233 * than violates the standard. 234 */ 235 #ifndef HAVE_SNPRINTF 236 /*PRINTFLIKE3*/ 237 extern int snprintf __PR((char *, size_t, const char *, ...)) __printflike__(3, 4); 238 #endif 239 #endif 240 /*extern int sprintf __PR((char *, const char *, ...)); ist woanders falsch deklariert !!!*/ 241 extern char *strcatl __PR((char *, ...)); 242 extern int streql __PR((const char *, const char *)); 243 #ifdef va_arg 244 extern int format __PR((void (*)(char, long), long, const char *, va_list)); 245 #else 246 extern int format __PR((void (*)(char, long), long, const char *, void *)); 247 #endif 248 249 extern int ftoes __PR((char *, double, int, int)); 250 extern int ftofs __PR((char *, double, int, int)); 251 252 #ifdef EOF /* stdio.h has been included */ 253 /*PRINTFLIKE2*/ 254 extern int js_fprintf __PR((FILE *, const char *, ...)) __printflike__(2, 3); 255 /*PRINTFLIKE1*/ 256 extern int js_printf __PR((const char *, ...)) __printflike__(1, 2); 257 #ifdef FOUND_SIZE_T 258 /*PRINTFLIKE3*/ 259 extern int js_snprintf __PR((char *, size_t, const char *, ...)) __printflike__(3, 4); 260 #endif 261 /*PRINTFLIKE2*/ 262 extern int js_sprintf __PR((char *, const char *, ...)) __printflike__(2, 3); 263 #endif /* EOF */ 264 265 extern void swabbytes __PR((void *, int)); 266 extern char **getmainfp __PR((void)); 267 extern char **getavp __PR((void)); 268 extern char *getav0 __PR((void)); 269 extern void **getfp __PR((void)); 270 extern int flush_reg_windows __PR((int)); 271 extern int cmpbytes __PR((const void *, const void *, int)); 272 extern int cmpnullbytes __PR((const void *, int)); 273 274 #ifdef nonono 275 #if defined(HAVE_LARGEFILES) 276 /* 277 * To allow this, we need to figure out how to do autoconfiguration for off64_t 278 */ 279 extern FILE *_fcons64 __PR((FILE *, int, int)); 280 extern FILE *fdup64 __PR((FILE *)); 281 extern FILE *fileluopen64 __PR((int, const char *)); 282 extern FILE *fileopen64 __PR((const char *, const char *)); 283 #ifdef FOUND_OFF_T 284 extern off64_t filepos64 __PR((FILE *)); 285 #endif 286 extern FILE *filereopen64 __PR((const char *, const char *, FILE *)); 287 #ifdef FOUND_OFF_T 288 extern int fileseek64 __PR((FILE *, off64_t)); 289 extern off64_t filesize64 __PR((FILE *)); 290 #endif 291 #ifdef S_IFMT 292 extern int filestat64 __PR((FILE *, struct stat *)); 293 #endif 294 extern int _openfd64 __PR((const char *, int)); 295 #endif 296 #endif 297 298 #ifdef __cplusplus 299 } 300 #endif 301 302 #if defined(_JOS) || defined(JOS) 303 # ifndef _JOS_IO_H 304 # include <jos_io.h> 305 # endif 306 #endif 307 308 #endif /* _SCHILY_H */ 309