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