Debian Codegraph @

test/xml-curve.c

raw symbols SCIP
1 /*
2 *
3 * Copyright 2002 Robert Krawitz ([email protected])
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19 #ifdef HAVE_CONFIG_H
20 #include <config.h>
21 #endif
22 #include <stdlib.h>
23 #include <stdio.h>
24 #include <unistd.h>
25 #include <string.h>
26 #include <gutenprint/gutenprint.h>
27
28 int main(int argc, char *argv[])
29 {
30 stp_curve_t *curve;
31
32 if (argc != 2)
33 {
34 fprintf(stderr, "Usage: %s filename.xml\n", argv[0]);
35 return 1;
36 }
37
38 stp_init();
39
40 #ifdef DEBUG
41 fprintf(stderr, "stp-xml-parse: reading `%s'...\n", argv[1]);
42 #endif
43
44 fprintf(stderr, "Using file: %s\n", argv[1]);
45 curve = stp_curve_create_from_file(argv[1]);
46
47 if (curve)
48 {
49 char *output;
50 if ((stp_curve_write(stdout, curve)) == 0)
51 fprintf(stderr, "curve successfully created\n");
52 else
53 fprintf(stderr, "error creating curve\n");
54 output = stp_curve_write_string(curve);
55 if (output)
56 {
57 fprintf(stderr, "%s", output);
58 fprintf(stderr, "curve string successfully created\n");
59 free(output);
60 }
61 else
62 fprintf(stderr, "error creating curve string\n");
63 stp_curve_destroy(curve);
64 }
65 else
66 printf("curve is NULL!\n");
67
68 return 0;
69 }