From f8831a023d91556eb105edc27e7cbb61bde573ca Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 11 Oct 2017 01:38:47 -0700 Subject: 4014 - core skeleton for x86 interpreter --- subx/001help.cc | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'subx/001help.cc') diff --git a/subx/001help.cc b/subx/001help.cc index ca1cb106..d4c3334f 100644 --- a/subx/001help.cc +++ b/subx/001help.cc @@ -2,24 +2,12 @@ //: This should give you a sense for what to look forward to in later layers. :(before "End Commandline Parsing") -if (argc != 1) { +if (argc <= 1 || is_equal(argv[1], "--help")) { //: this is the functionality later layers will provide // currently no automated tests for commandline arg parsing - return 1; -} - -//: Support for option parsing. -//: Options always begin with '--' and are always the first arguments. An -//: option will never follow a non-option. -:(before "End Commandline Parsing") -char** arg = &argv[1]; -while (argc > 1 && starts_with(*arg, "--")) { - if (false) - ; // no-op branch just so any further additions can consistently always start with 'else' - // End Commandline Options(*arg) - else - cerr << "skipping unknown option " << *arg << '\n'; - --argc; ++argv; ++arg; + cerr << "Usage:\n" + << " subx test\n"; + return 0; } //:: Helper function used by the above fragment of code (and later layers too, -- cgit 1.4.1-2-gfad0