00001 /* 00002 Copyright (C) 2006. QLogic Corporation. All Rights Reserved. 00003 00004 This program is free software; you can redistribute it and/or modify it 00005 under the terms of version 2 of the GNU General Public License as 00006 published by the Free Software Foundation. 00007 00008 This program is distributed in the hope that it would be useful, but 00009 WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00011 00012 Further, this software is distributed without any warranty that it is 00013 free of the rightful claim of any third person regarding infringement 00014 or the like. Any license provided herein, whether implied or 00015 otherwise, applies only to this software file. Patent licenses, if 00016 any, provided herein do not apply to combinations of this program with 00017 other software, or any other product whatsoever. 00018 00019 You should have received a copy of the GNU General Public License along 00020 with this program; if not, write the Free Software Foundation, Inc., 59 00021 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00022 */ 00023 00024 #include <stdio.h> 00025 #include <stdlib.h> 00026 00027 #include "gspin-tree.h" 00028 #include "gspin-io.h" 00029 00030 extern gs_void_t gs_dump_file (gs_t t, FILE *f) ; 00031 00032 int 00033 main (int argc, char *argv[]) 00034 { 00035 gs_t p; 00036 char *file_name, *outfile_name; 00037 FILE *f; 00038 00039 if (argc != 2) { 00040 printf("usage: gspin <spin_file>\n"); 00041 printf(" \"gspin foo.spin\" will dump to \"foo.spin.txt\".\n"); 00042 exit(1); 00043 } 00044 00045 file_name = argv[1]; 00046 outfile_name = (char *) malloc(strlen(file_name) + 10); 00047 sprintf(outfile_name, "%s.txt", file_name); 00048 00049 f = fopen(outfile_name, "w"); 00050 if (f == NULL) { 00051 printf("gspin: cannot write to %s\n", outfile_name); 00052 } 00053 00054 p = gs_read_file (argv[1]); 00055 gs_dump_file (p, f); 00056 // printf ("struct gspin size: %d (bytes)\n", sizeof (struct gspin)); 00057 00058 fclose(f); 00059 00060 return 0; 00061 }
1.5.6