jimbraun / XCDF

XCDF: eXplicitly Compacted Data Format. See documentation at Read the Docs:
https://xcdf.readthedocs.io/en/latest/
Other
14 stars 8 forks source link

Fixing the remove-comments command so it correctly parses the output option. #61

Closed Lilcupcake closed 8 years ago

Lilcupcake commented 8 years ago

There is a small problem with xcdf-utility I added the option so delete-comments now accepts the -o option.

jimbraun commented 8 years ago

OK, nice catch. Can I suggest the following to shorten the code (line 939)? The options (just an output file) are the same as recover:

if (!verb.compare("recover") || !verb.compare("remove-comments")) {

if (currentArg < argc) {

  std::string out(argv[currentArg]);
  if (!out.compare("-o")) {

    if (++currentArg == argc) {
      PrintUsage();
      exit(1);
    }

    fout.open(argv[currentArg++]);
    outstream = &fout;
  }
}

}

Lilcupcake commented 8 years ago

Oops sorry I didn't catch that. Combining it with recover is a good option.