Commit 38eadd51 authored by Alejandro Mery's avatar Alejandro Mery
Browse files

fex2bin: allocate and delete an script tree

parent 93dd0a48
...@@ -13,6 +13,8 @@ clean: ...@@ -13,6 +13,8 @@ clean:
$(TOOLS): Makefile sunxi-tools.h $(TOOLS): Makefile sunxi-tools.h
fex2bin: script.c script.h
%: %.c %.h %: %.c %.h
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
...@@ -20,4 +22,3 @@ $(TOOLS): Makefile sunxi-tools.h ...@@ -20,4 +22,3 @@ $(TOOLS): Makefile sunxi-tools.h
@for x in $(TOOLS) '*.o' '*.swp'; do \ @for x in $(TOOLS) '*.o' '*.swp'; do \
echo $$x; \ echo $$x; \
done > $@ done > $@
...@@ -27,6 +27,7 @@ int main(int argc, char *argv[]) ...@@ -27,6 +27,7 @@ int main(int argc, char *argv[])
int ret = -1; int ret = -1;
FILE *in = stdin, *out = stdout; FILE *in = stdin, *out = stdout;
const char *fn[] = {"stdin", "stdout"}; const char *fn[] = {"stdin", "stdout"};
struct script *script;
if (argc>1) { if (argc>1) {
if (strcmp(argv[1],"-") == 0) if (strcmp(argv[1],"-") == 0)
...@@ -46,6 +47,13 @@ int main(int argc, char *argv[]) ...@@ -46,6 +47,13 @@ int main(int argc, char *argv[])
} }
} }
} }
if ((script = script_new()) == NULL) {
errf("malloc: %s\n", strerror(errno));
goto done;
}
script_delete(script);
goto done; goto done;
usage: usage:
errf("Usage: %s [<script.fex> [<script.bin>]\n", argv[0]); errf("Usage: %s [<script.fex> [<script.bin>]\n", argv[0]);
......
...@@ -19,4 +19,6 @@ ...@@ -19,4 +19,6 @@
#include "sunxi-tools.h" #include "sunxi-tools.h"
#include "script.h"
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment