/* This file is part of icobundle Copyright (C) 2003-7 Toby Thain, toby@telegraphics.com.au This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "file_io.h" #include "ico.h" #include "ico_io.h" #include "bundle.h" void bad(char *s){ fprintf(stderr,"## ERROR: %s\n",s); } void note(char *s){ puts(s); } void usage(char *cmd,char *s){ fprintf(stderr,"## %s\n## usage: %s -o outputfile inputfile(s)\n",s,cmd); } char **gargv; FILEREF opennth(int a){ FILE *f = fopen(gargv[a],"rb"); puts(gargv[a]); if(!f) perror("open failed"); return f; } int main(int argc,char *argv[]){ FILE *outfile; int a,optarg,retcode = EXIT_FAILURE; gargv = argv; if(argc > 3){ for(a = argc-1; --a;){ if(!strcmp("-o",argv[a])){ optarg = a; break; } } if(a){ outfile = fopen(argv[optarg+1],"wb"); /* delete -o, and output file name, from arguments */ argc -= 2; for(a = optarg; a < argc; ++a) argv[a] = argv[a+2]; if(bundle(argc-1,outfile)) retcode = EXIT_SUCCESS; fclose(outfile); }else usage(argv[0],"no output file specified"); }else usage(argv[0],"too few parameters"); return retcode; }