Commit 1fc1addd authored by Alejandro Mery's avatar Alejandro Mery
Browse files

fexc: finish main()

parent 5ebef7dc
...@@ -23,6 +23,27 @@ ...@@ -23,6 +23,27 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
/*
*/
static struct script *script_new(void)
{
return NULL;
}
static void script_delete(struct script *UNUSED(script))
{
}
static int script_parse(int UNUSED(mode), const char *UNUSED(filename),
struct script *UNUSED(script))
{
return 0;
}
static int script_generate(int UNUSED(mode), const char *UNUSED(filename),
struct script *UNUSED(script))
{
return 0;
}
/* /*
*/ */
static inline void app_usage(const char *arg0, int mode) static inline void app_usage(const char *arg0, int mode)
...@@ -54,11 +75,12 @@ int main(int argc, char *argv[]) ...@@ -54,11 +75,12 @@ int main(int argc, char *argv[])
static const char *formats[] = { "fex", "bin", NULL }; static const char *formats[] = { "fex", "bin", NULL };
int infmt=0, outfmt=1; int infmt=0, outfmt=1;
const char *filename[] = { "stdin", "stdout" }; const char *filename[] = { "stdin", "stdout" };
struct script *script;
int app_mode = app_choose_mode(argv[0]); int app_mode = app_choose_mode(argv[0]);
const char *opt_string = "I:O:vq?"+ ((app_mode == 0)? 0: 4); const char *opt_string = "I:O:vq?"+ ((app_mode == 0)? 0: 4);
int opt; int opt, ret = 1;
int verbose = 0; int verbose = 0;
if (app_mode == 2) /* bin2fex */ if (app_mode == 2) /* bin2fex */
...@@ -99,7 +121,7 @@ int main(int argc, char *argv[]) ...@@ -99,7 +121,7 @@ int main(int argc, char *argv[])
default: default:
show_usage: show_usage:
app_usage(argv[0], app_mode); app_usage(argv[0], app_mode);
exit(1); goto done;
} }
} }
...@@ -120,5 +142,14 @@ show_usage: ...@@ -120,5 +142,14 @@ show_usage:
formats[infmt], filename[0], formats[infmt], filename[0],
formats[outfmt], filename[1]); formats[outfmt], filename[1]);
return 0; if ((script = script_new()) == NULL) {
perror("malloc");
goto done;
} else if (script_parse(infmt, filename[0], script) &&
script_generate(outfmt, filename[1], script)) {
ret = 0;
}
script_delete(script);
done:
return ret;
} }
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