git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c4e5a29
)
added -C option
author
kramm
<kramm>
Mon, 5 Jun 2006 07:54:06 +0000
(07:54 +0000)
committer
kramm
<kramm>
Mon, 5 Jun 2006 07:54:06 +0000
(07:54 +0000)
src/swfc.c
patch
|
blob
|
history
src/swfc.doc
patch
|
blob
|
history
diff --git
a/src/swfc.c
b/src/swfc.c
index
db5ae8b
..
8e7977b
100644
(file)
--- a/
src/swfc.c
+++ b/
src/swfc.c
@@
-44,6
+44,7
@@
static char * outputname = "output.swf";
static int verbose = 2;
static int optimize = 0;
static int override_outputname = 0;
static int verbose = 2;
static int optimize = 0;
static int override_outputname = 0;
+static int do_cgi = 0;
static struct options_t options[] = {
{"h", "help"},
static struct options_t options[] = {
{"h", "help"},
@@
-68,6
+69,10
@@
int args_callback_option(char*name,char*val)
optimize = 1;
return 0;
}
optimize = 1;
return 0;
}
+ else if(!strcmp(name, "C")) {
+ do_cgi = 1;
+ return 0;
+ }
else if(!strcmp(name, "v")) {
verbose ++;
return 0;
else if(!strcmp(name, "v")) {
verbose ++;
return 0;
@@
-119,7
+124,7
@@
static void syntaxerror(char*format, ...)
va_start(arglist, format);
vsprintf(buf, format, arglist);
va_end(arglist);
va_start(arglist, format);
vsprintf(buf, format, arglist);
va_end(arglist);
- printf("\"%s\", line %d column %d: error- %s\n", filename, line, column, buf);
+ fprintf(stderr, "\"%s\", line %d column %d: error- %s\n", filename, line, column, buf);
exit(1);
}
exit(1);
}
@@
-130,7
+135,7
@@
static void warning(char*format, ...)
va_start(arglist, format);
vsprintf(buf, format, arglist);
va_end(arglist);
va_start(arglist, format);
vsprintf(buf, format, arglist);
va_end(arglist);
- printf("\"%s\", line %d column %d: warning- %s\n", filename, line, column, buf);
+ fprintf(stderr, "\"%s\", line %d column %d: warning- %s\n", filename, line, column, buf);
}
static void readToken()
}
static void readToken()
@@
-673,11
+678,16
@@
static void s_endSWF()
warning("Empty bounding box for movie");
}
warning("Empty bounding box for movie");
}
- fi = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644);
+ if(do_cgi)
+ fi = fileno(stdout);
+ else
+ fi = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644);
if(fi<0) {
syntaxerror("couldn't create output file %s", filename);
}
if(fi<0) {
syntaxerror("couldn't create output file %s", filename);
}
- if(swf->compressed)
+ if(do_cgi)
+ {if(swf_WriteCGI(swf)<0) syntaxerror("WriteCGI() failed.\n");}
+ else if(swf->compressed)
{if(swf_WriteSWC(fi, swf)<0) syntaxerror("WriteSWC() failed.\n");}
else
{if(swf_WriteSWF(fi, swf)<0) syntaxerror("WriteSWF() failed.\n");}
{if(swf_WriteSWC(fi, swf)<0) syntaxerror("WriteSWC() failed.\n");}
else
{if(swf_WriteSWF(fi, swf)<0) syntaxerror("WriteSWF() failed.\n");}
@@
-3192,7
+3202,7
@@
int main (int argc,char ** argv)
file = generateTokens(filename);
if(!file) {
file = generateTokens(filename);
if(!file) {
- printf("parser returned error.\n");
+ fprintf(stderr, "parser returned error.\n");
return 1;
}
pos=0;
return 1;
}
pos=0;
diff --git
a/src/swfc.doc
b/src/swfc.doc
index
829fbd7
..
763a6c5
100644
(file)
--- a/
src/swfc.doc
+++ b/
src/swfc.doc
@@
-8,6
+8,8
@@
Compiles a file written in sc (SWF Script) into a number of SWF files.
Print short help message and exit
-V, --version
Print version info and exit
Print short help message and exit
-V, --version
Print version info and exit
+-C, --cgi
+ Output to stdout (for use in CGI environments)
-v, --verbose
Increase verbosity.
Increase verbosity. Use more than one \fB-v\fR for greater effect.
-v, --verbose
Increase verbosity.
Increase verbosity. Use more than one \fB-v\fR for greater effect.