diff --git a/Makefile b/Makefile index 8a7d789..6e78452 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ LDFLAGS = -lpthread # compiler CC=g++ # compiler flags -CXXFLAGS= -I$(IDIR) -Wall -pedantic -std=c++17 +CXXFLAGS= -I$(IDIR) -Wall -pedantic -std=c++20 ifeq ($(DEBUG),true) # debugging flags CC=clang++ diff --git a/src/exec.cpp b/src/exec.cpp index 88048b4..83b31f0 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -188,7 +188,7 @@ void parse_exec(FILE* fd, const char* in, uint32_t size, std::string const& file } catch(ztd::format_error& e) { - throw ztd::format_error(e.what(), e.where(), in, filename); + throw ztd::format_error(e.what(), filename, in, e.where()); } #endif } @@ -255,7 +255,7 @@ int exec_process(std::string const& runtime, std::vector const& arg pid_t pid=0; // std::string test="echo Hello world\nexit 10\n"; // fprintf(ffd, "%s\n",, test.c_str(), test.size()); - FILE* ffd; + FILE* ffd=0; try { pid = forkexec(runargs[0], runargs.data()); diff --git a/src/main.cpp b/src/main.cpp index edcf267..e78411f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,9 +54,16 @@ int main(int argc, char* argv[]) int ret=0; + bool optstop=false; + try { - args=options.process(argc, argv, false, true); + args=options.process(argc, argv, {.stop_on_argument=true, .output_doubledash=true} ); + if( args[0] == "--" ) + { + optstop=true; + args.erase(args.begin()); + } } catch(std::exception& e) { @@ -126,7 +133,7 @@ int main(int argc, char* argv[]) else is_exec = shebang_is_bin; - if(!is_exec && args.size() > 1) // not exec: parse options on args + if(!is_exec && args.size() > 1 && !optstop) // not exec: parse options on args args=options.process(args); if(!is_exec && options['e'])