diff options
| author | 2022-09-01 07:54:45 +0200 | |
|---|---|---|
| committer | 2022-09-01 07:54:45 +0200 | |
| commit | 3a2379fef0d5f13622708ab09862d6d48f46a1aa (patch) | |
| tree | 6a77d897f39321e38ca92697c01ae66625017602 | |
| parent | d3398afe7283f572203a5986f9db72aa795a2714 (diff) | |
tweak cli options
| -rw-r--r-- | src/main.cff | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main.cff b/src/main.cff index 32aedb2..8d96bbb 100644 --- a/src/main.cff +++ b/src/main.cff @@ -6,11 +6,11 @@ fn prihelp(f *FILE, progname *const u8) void { fprintf(f, "Compile cffc source code in FILE\n" "\n" "Options:\n" - " --help, -h:\t\tshow this help message\n" - " --target triple:\tset compilation target triple\n" - " -:\t\t\tread input from stdin\n" - " -o -:\t\tset output to stdout\n" - " -o path:\t\tset output file path\n"); + " --help, -h \t\tshow this help message\n" + " --target triple \tset compilation target triple\n" + " - \t\t\tread input from stdin\n" + " -p \t\t\toutput LLVM IR to stdout\n" + " -o path \t\toutput LLVM IR to file path\n"); } extern fn main(argc int, argv **u8) int { @@ -38,10 +38,13 @@ extern fn main(argc int, argv **u8) int { case streq(arg, "--target"); triple = nextarg(); - + + case streq(arg, "-p"); + outfile = stdout; + case streq(arg, "-o"); let outpath = nextarg(); - outfile = streq(outpath, "-") ? stdout : fopen(outpath, "wb"); + outfile = fopen(outpath, "wb"); if outfile == #null { fprintf(stderr, "%s: error: cannot open '%s': %s\n", argv[0], outpath, strerror(errno)); return 1; |