2 Scans a swf file for strings
4 Part of the swftools package.
6 Copyright (c) 2000,2001 Rainer Böhme <rfxswf@reflex-studio.de>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
24 #include "../lib/rfxswf.h"
25 #include "../lib/args.h"
29 struct options_t options[] =
36 int args_callback_option(char*name,char*val)
38 if(!strcmp(name, "V")) {
39 printf("swfstrings - part of %s %s\n", PACKAGE, VERSION);
44 int args_callback_longoption(char*name,char*val)
46 return args_long2shortoption(options, name, val);
48 void args_callback_usage(char*name)
50 printf("\nreflex SWF Text Scan Utility\n(w) 2000 by Rainer Boehme <rb@reflex-studio.de>\n\nUsage: %s filename.swf\n", name);
53 int args_callback_command(char*name,char*val)
56 fprintf(stderr, "Only one file allowed. You supplied at least two. (%s and %s)\n",
65 void fontcallback(void*self,U16 id,U8 * name)
69 swf_FontExtract(&swf,id,&font);
70 printf("#<font %d \"%s\"%s%s>\n",id, name,swf_FontIsBold(font)?" bold":"",swf_FontIsItalic(font)?" italic":"");
77 swf_TextPrintDefineText(t,font);
84 int main (int argc,char ** argv)
87 processargs(argc, argv);
91 f = open(filename,O_RDONLY|O_BINARY);
93 { if FAILED(swf_ReadSWF(f,&swf))
94 { fprintf(stderr,"%s is not a valid SWF file or contains errors.\n",filename);
99 swf_FontEnumerate(&swf,&fontcallback,0);
103 fprintf(stderr,"File not found: %s\n",argv[1]);