Mercurial > hg-old > index.cgi
changeset 19:925105ccf22f
small reworking of command arguments
author | lost |
---|---|
date | Fri, 02 Jan 2009 00:41:58 +0000 |
parents | 218aabbc3b1a |
children | 610710a7859f |
files | src/main.c |
diffstat | 1 files changed, 27 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main.c Thu Jan 01 23:55:18 2009 +0000 +++ b/src/main.c Fri Jan 02 00:41:58 2009 +0000 @@ -82,7 +82,22 @@ case 0x100: // proprietary object format as -> outformat = OUTPUT_OBJ; - + break; + + case 'f': + // output format + if (!strcasecmp(arg, "decb")) + as -> outformat = OUTPUT_DECB; + else if (!strcasecmp(arg, "raw")) + as -> outformat = OUTPUT_RAW; + else if (!strcasecmp(arg, "obj")) + as -> outformat = OUTPUT_OBJ; + else + { + fprintf(stderr, "Invalid output format: %s\n", arg); + exit(1); + } + break; case ARGP_KEY_END: // done; sanity check if (!as -> outfile) @@ -108,16 +123,16 @@ "Output to FILE"}, { "debug", 'd', 0, 0, "Set debug mode"}, + { "format", 'f', "TYPE", 0, + "Select output format: decb, raw, obj"}, { "list", 'l', "FILE", OPTION_ARG_OPTIONAL, "Generate list [to FILE]"}, { "decb", 'b', 0, 0, - "Generate DECB .bin format output"}, + "Generate DECB .bin format output, equivalent of --format=decb"}, { "raw", 'r', 0, 0, - "Generate raw binary format output"}, - { "rawrel", 0, 0, 0, - "Generate raw binary respecing ORG statements as offsets from the start of the file"}, + "Generate raw binary format output, equivalent of --format=raw"}, { "obj", 0, 0, 0, - "Generate proprietary object file format for later linking" }, + "Generate proprietary object file format for later linking, equivalent of --format=obj" }, { 0 } }; @@ -140,6 +155,12 @@ if (!asmstate.listfile) asmstate.listfile = "-"; + if (!asmstate.infile) + { + fprintf(stderr, "No input files specified.\n"); + exit(1); + } + /* pass 1 - collect the symbols and assign addresses where possible */ /* pass 1 also resolves included files, etc. */ /* that means files are read exactly once unless included multiple times */