2 * This file has been modified for the cdrkit suite.
4 * The behaviour and appearence of the program code below can differ to a major
5 * extent from the version distributed by the original author(s).
7 * For details, see Changelog file distributed with the cdrkit package. If you
8 * received this file from another source then ask the distributing person for
9 * a log of modifications.
13 /* @(#)schily.h 1.54 06/01/12 Copyright 1985-2006 J. Schilling */
15 * Definitions for libschily
17 * This file should be included past:
19 * mconfig.h / config.h
22 * stdlib.h (better use stdxlib.h)
23 * unistd.h (better use unixstd.h) needed LARGEFILE support
27 * If you need stdio.h, you must include it before schily.h
29 * NOTE: If you need ctype.h and did not include stdio.h you need to
30 * include ctype.h past schily.h as OpenBSD does not follow POSIX and
31 * defines EOF in ctype.h
33 * Copyright (c) 1985-2006 J. Schilling
36 * This program is free software; you can redistribute it and/or modify
37 * it under the terms of the GNU General Public License version 2
38 * as published by the Free Software Foundation.
40 * This program is distributed in the hope that it will be useful,
41 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 * GNU General Public License for more details.
45 * You should have received a copy of the GNU General Public License along with
46 * this program; see the file COPYING. If not, write to the Free Software
47 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
64 #if defined(_INCL_SYS_TYPES_H) || defined(off_t)
69 #if defined(_INCL_SYS_TYPES_H) || defined(size_t)
77 * It turns out that we cannot use the folloginw definition because there are
78 * some platforms that do not behave application friendly. These are mainly
79 * BSD-4.4 based systems (which #undef a definition when size_t is available.
80 * We actually removed this code because of a problem with QNX Neutrino.
81 * For this reason, it is important not to include <sys/types.h> directly but
82 * via the Schily SING include files so we know whether it has been included
83 * before we come here.
85 #if defined(_SIZE_T) || defined(_T_SIZE_) || defined(_T_SIZE) || \
86 defined(__SIZE_T) || defined(_SIZE_T_) || \
87 defined(_GCC_SIZE_T) || defined(_SIZET_) || \
88 defined(__sys_stdtypes_h) || defined(___int_size_t_h) || defined(size_t)
91 # define FOUND_SIZE_T /* We already included a size_t definition */
94 #endif /* __never_def__ */
96 #if defined(HAVE_LARGEFILES)
97 # define _fcons _fcons64
99 # define fileluopen fileluopen64
100 # define fileopen fileopen64
101 # define filemopen filemopen64
102 # define filepos filepos64
103 # define filereopen filereopen64
104 # define fileseek fileseek64
105 # define filesize filesize64
106 # define filestat filestat64
107 # define _openfd _openfd64
110 #ifdef EOF /* stdio.h has been included */
111 extern int _cvmod(const char *, int *, int *);
112 extern FILE *_fcons(FILE *, int, int);
113 extern FILE *fdup(FILE *);
114 extern int fdown(FILE *);
115 extern int rols_fexecl(const char *, FILE *, FILE *, FILE *, const char *, ...);
116 extern int rols_fexecle(const char *, FILE *, FILE *, FILE *, const char *, ...);
117 /* 6th arg not const, fexecv forces av[ac] = NULL */
118 extern int rols_fexecv(const char *, FILE *, FILE *, FILE *, int, char **);
119 extern int rols_fexecve(const char *, FILE *, FILE *, FILE *, char * const *,
121 extern int fspawnv(FILE *, FILE *, FILE *, int, char * const *);
122 extern int fspawnl(FILE *, FILE *, FILE *, const char *, const char *, ...);
123 extern int fspawnv_nowait(FILE *, FILE *, FILE *, const char *, int,
125 extern int rols_fgetline(FILE *, char *, int);
126 extern int fgetstr(FILE *, char *, int);
127 extern void file_raise(FILE *, int);
128 extern int fileclose(FILE *);
129 extern FILE *fileluopen(int, const char *);
130 extern FILE *fileopen(const char *, const char *);
131 #ifdef _INCL_SYS_TYPES_H
132 extern FILE *filemopen(const char *, const char *, mode_t);
135 extern off_t filepos(FILE *);
137 extern int fileread(FILE *, void *, int);
138 extern int ffileread(FILE *, void *, int);
139 extern FILE *filereopen(const char *, const char *, FILE *);
141 extern int fileseek(FILE *, off_t);
142 extern off_t filesize(FILE *);
145 extern int filestat(FILE *, struct stat *);
147 extern int filewrite(FILE *, void *, int);
148 extern int ffilewrite(FILE *, void *, int);
149 extern int flush(void);
150 extern int fpipe(FILE **);
151 extern int getbroken(FILE *, char *, char, char **, int);
152 extern int ofindline(FILE *, char, const char *, int, char **, int);
153 extern int peekc(FILE *);
157 * We cannot define this or we may get into problems with DOS based systems.
159 extern int spawnv(FILE *, FILE *, FILE *, int, char * const *);
160 extern int spawnl(FILE *, FILE *, FILE *, const char *, const char *, ...);
161 extern int spawnv_nowait(FILE *, FILE *, FILE *, const char *, int,
163 #endif /* __never_def__m */
166 extern int _niread(int, void *, int);
167 extern int _niwrite(int, void *, int);
168 extern int _nixread(int, void *, int);
169 extern int _nixwrite(int, void *, int);
170 extern int _openfd(const char *, int);
171 extern int on_comerr(void (*fun)(int, void *), void *arg);
173 extern void comerr(const char *, ...) __printflike__(1, 2);
175 extern void comerrno(int, const char *, ...) __printflike__(2, 3);
177 extern int errmsg(const char *, ...) __printflike__(1, 2);
179 extern int errmsgno(int, const char *, ...) __printflike__(2, 3);
182 extern int serrmsg(char *, size_t, const char *, ...) __printflike__(3, 4);
184 extern int serrmsgno(int, char *, size_t, const char *, ...) __printflike__(4, 5);
186 extern void comexit(int);
187 extern char *errmsgstr(int);
189 extern int schily_error(const char *, ...) __printflike__(1, 2);
190 extern char *fillbytes(void *, int, char);
191 extern char *findbytes(const void *, int, char);
192 extern int findline(const char *, char, const char *, int, char **, int);
193 extern int rols_getline(char *, int);
194 extern int getstr(char *, int);
195 extern int breakline(char *, char, char **, int);
196 extern int getallargs(int *, char * const**, const char *, ...);
197 extern int getargs(int *, char * const**, const char *, ...);
198 extern int getfiles(int *, char * const**, const char *);
199 extern char *astoi(const char *, int *);
200 extern char *astol(const char *, long *);
201 extern char *astolb(const char *, long *, int base);
203 extern char *astoll(const char *, Llong *);
204 extern char *astollb(const char *, Llong *, int);
205 extern char *astoull(const char *, Ullong *);
206 extern char *astoullb(const char *, Ullong *, int);
209 /*extern void handlecond __PR((const char *, SIGBLK *, int(*)(const char *, long, long), long));*/
210 /*extern void unhandlecond __PR((SIGBLK *));*/
212 extern int patcompile(const unsigned char *, int, int *);
213 extern unsigned char *patmatch(const unsigned char *, const int *,
214 const unsigned char *, int, int, int, int[]);
215 extern unsigned char *patlmatch(const unsigned char *, const int *,
216 const unsigned char *, int, int, int, int[]);
218 extern char *movebytes(const void *, void *, int);
220 extern void save_args(int, char **);
221 extern int saved_ac(void);
222 extern char **saved_av(void);
223 extern char *saved_av0(void);
225 extern int seterrno(int);
227 extern void set_progname(const char *);
228 extern char *get_progname(void);
230 extern void setfp(void * const *);
231 extern int wait_chld(int); /* for fspawnv_nowait() */
232 extern int geterrno(void);
233 extern void raisecond(const char *, long);
234 extern char *strcatl(char *, ...);
235 extern int streql(const char *, const char *);
237 extern int format(void (*)(char, long), long, const char *, va_list);
239 extern int format(void (*)(char, long), long, const char *, void *);
242 extern int ftoes(char *, double, int, int);
243 extern int ftofs(char *, double, int, int);
245 extern void swabbytes(void *, int);
246 extern char **getmainfp(void);
247 extern char **getavp(void);
248 extern char *getav0(void);
249 extern void **getfp(void);
250 extern int flush_reg_windows(int);
251 extern int cmpbytes(const void *, const void *, int);
252 extern int cmpnullbytes(const void *, int);
255 #if defined(HAVE_LARGEFILES)
257 * To allow this, we need to figure out how to do autoconfiguration for off64_t
259 extern FILE *_fcons64(FILE *, int, int);
260 extern FILE *fdup64(FILE *);
261 extern FILE *fileluopen64(int, const char *);
262 extern FILE *fileopen64(const char *, const char *);
264 extern off64_t filepos64(FILE *);
266 extern FILE *filereopen64(const char *, const char *, FILE *);
268 extern int fileseek64(FILE *, off64_t);
269 extern off64_t filesize64(FILE *);
272 extern int filestat64(FILE *, struct stat *);
274 extern int _openfd64(const char *, int);
282 #if defined(_JOS) || defined(JOS)
288 #endif /* _SCHILY_H */