aboutsummaryrefslogtreecommitdiff
path: root/f2toxex.c
diff options
context:
space:
mode:
Diffstat (limited to 'f2toxex.c')
-rw-r--r--f2toxex.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/f2toxex.c b/f2toxex.c
new file mode 100644
index 0000000..c2a4934
--- /dev/null
+++ b/f2toxex.c
@@ -0,0 +1,64 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "xex.h"
+
+#define SELF "f2toxex"
+
+void version() {
+ printf(SELF " " VERSION "\n");
+}
+
+void usage() {
+ version();
+ printf(" Usage: " SELF " [-h | -v] | infile [outfile]\n");
+}
+
+char *make_outfile(char *infile) {
+}
+
+int main(int argc, char **argv) {
+ int c;
+ char *infile, *outfile;
+
+ while( (c = getopt(argc, argv, "hv")) > 0) {
+ switch(c) {
+ case 'h':
+ usage();
+ exit(0);
+ break;
+ case 'v':
+ version();
+ exit(0);
+ break;
+ default:
+ fprintf(stderr, SELF ": unknown option '-%c'.\n", c);
+ usage();
+ exit(1);
+ break;
+ }
+ }
+
+ if(argc > optind) {
+ infile = argv[optind];
+ optind++;
+ }
+
+ if(argc > optind) {
+ strcpy(outfile, argv[optind]);
+ optind++;
+
+ if(argc > optind)
+ fprintf(stderr, SELF ": "
+ "ignoring extra junk on command line: '%s'.\n", argv[optind]);
+ } else if(strcmp(infile, "-") != 0) {
+ outfile = make_outfile(infile);
+ }
+
+
+ return 0;
+}