Debian Codegraph @

import/pysam.c

raw symbols SCIP
1 #include <getopt.h>
2 #include <unistd.h>
3 #include <setjmp.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7
8 #include "@[email protected]"
9
10 FILE * @pysam@_stderr = NULL;
11 FILE * @pysam@_stdout = NULL;
12 const char * @pysam@_stdout_fn = NULL;
13
14
15 FILE * @pysam@_set_stderr(int fd)
16 {
17 if (@pysam@_stderr != NULL)
18 fclose(@pysam@_stderr);
19 @pysam@_stderr = fdopen(fd, "w");
20 return @pysam@_stderr;
21 }
22
23 void @pysam@_close_stderr(void)
24 {
25 fclose(@pysam@_stderr);
26 @pysam@_stderr = NULL;
27 }
28
29 FILE * @pysam@_set_stdout(int fd)
30 {
31 if (@pysam@_stdout != NULL)
32 fclose(@pysam@_stdout);
33 @pysam@_stdout = fdopen(fd, "w");
34 if (@pysam@_stdout == NULL)
35 {
36 fprintf(@pysam@_stderr, "could not set stdout to fd %i", fd);
37 }
38 return @pysam@_stdout;
39 }
40
41 void @pysam@_set_stdout_fn(const char *fn)
42 {
43 @pysam@_stdout_fn = fn;
44 }
45
46 void @pysam@_close_stdout(void)
47 {
48 fclose(@pysam@_stdout);
49 @pysam@_stdout = NULL;
50 }
51
52 int @pysam@_puts(const char *s)
53 {
54 if (fputs(s, @pysam@_stdout) == EOF) return EOF;
55 return putc('\n', @pysam@_stdout);
56 }
57
58
59 static jmp_buf @pysam@_jmpbuf;
60 static int @pysam@_status = 0;
61
62 int @pysam@_dispatch(int argc, char *argv[])
63 {
64 /* Reset getopt()/getopt_long() processing. */
65 #if defined __GLIBC__
66 optind = 0;
67 #elif defined _OPTRESET || defined _OPTRESET_DECLARED
68 optreset = optind = 1;
69 #else
70 optind = 1;
71 #endif
72
73 if (setjmp(@pysam@_jmpbuf) == 0)
74 return @pysam@_main(argc, argv);
75 else
76 return @pysam@_status;
77 }
78
79 void @pysam@_exit(int status)
80 {
81 @pysam@_status = status;
82 longjmp(@pysam@_jmpbuf, 1);
83 }