2
Copyright (c) 2005-2010 Gordon Gremme <gremme@zbh.uni-hamburg.de>
3
Copyright (c) 2005-2008 Center for Bioinformatics, University of Hamburg
5
Permission to use, copy, modify, and distribute this software for any
6
purpose with or without fee is hereby granted, provided that the above
7
copyright notice and this permission notice appear in all copies.
9
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26
/* This module contains wrappers for the functions from the standard library we
27
use. These functions always terminate the program if an error occurs.
28
That is, one can use this functions without the need to check for errors. */
30
/* Similar to <atexit(3)>, terminates on error. */
31
void gt_xatexit(void (*function)(void));
33
/* Similar to <fclose(3)>, terminates on error. */
34
void gt_xfclose(FILE*);
36
/* Similar to <fflush(3)>, terminates on error. */
37
void gt_xfflush(FILE*);
39
/* Similar to <fgetc(3)>, terminates on error. */
42
/* Similar to <fgets(3)>, terminates on error. */
43
char* gt_xfgets(char *s, int size, FILE *stream);
45
/* Similar to <fgetpos(3)>, terminates on error. */
46
void gt_xfgetpos(FILE*, fpos_t*);
48
/* Similar to <fopen(3)>, terminates on error. */
49
FILE* gt_xfopen(const char *path, const char *mode);
51
/* Similar to <fputc(3)>, terminates on error. */
52
void gt_xfputc(int, FILE*);
54
/* Similar to <fputs(3)>, terminates on error. */
55
void gt_xfputs(const char*, FILE*);
57
/* Similar to <fread(3)>, terminates on error. */
58
size_t gt_xfread(void *ptr, size_t size, size_t nmemb, FILE*);
60
/* Similar to <fseek(3)>, terminates on error. */
61
void gt_xfseek(FILE*, long offset, int whence);
63
/* Similar to <fsetpos(3)>, terminates on error. */
64
void gt_xfsetpos(FILE*, const fpos_t*);
66
/* Similar to <fwrite(3)>, terminates on error. */
67
void gt_xfwrite(const void *ptr, size_t size, size_t nmemb, FILE*);
69
/* Similar to <putchar(3)>, terminates on error. */
70
void gt_xputchar(int);
72
/* Similar to <puts(3)>, terminates on error. */
73
void gt_xputs(const char*);
75
/* Similar to <remove(3)>, terminates on error. */
76
void gt_xremove(const char*);
78
/* Similar to <ungetc(3)>, terminates on error. */
79
void gt_xungetc(int, FILE*);
81
/* Similar to <vfprintf(3)>, terminates on error. */
82
void gt_xvfprintf(FILE *stream, const char *format, va_list ap);
84
/* Similar to <vsnprintf(3)>, terminates on error. */
85
int gt_xvsnprintf(char *str, size_t size, const char *format, va_list ap);