From 53d8ce01ce980b7422c2838c27405d516423767c Mon Sep 17 00:00:00 2001 From: zawz Date: Wed, 3 Feb 2021 15:01:47 +0100 Subject: [PATCH] implement missing operator replacements in debashify [[ --- src/debashify.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/debashify.cpp b/src/debashify.cpp index 24cb3ff..b6ad60a 100644 --- a/src/debashify.cpp +++ b/src/debashify.cpp @@ -20,10 +20,24 @@ block* gen_bashtest_cmd(std::vector args) { block* ret = nullptr; - if(args.size() == 3 && args[1]->string() == "==") + std::string arg1replace; + if(args.size() == 3) { - delete args[1]->sa[0]; - args[1]->sa[0] = new string_subarg("="); + if(args[1]->string() == "==") + arg1replace="="; + else if(args[1]->string() == "<") + arg1replace="-lt"; + else if(args[1]->string() == "<=") + arg1replace="-le"; + else if(args[1]->string() == ">") + arg1replace="-gt"; + else if(args[1]->string() == ">=") + arg1replace="-ge"; + } + if(arg1replace != "") + { + delete args[1]; + args[1] = new arg(arg1replace); } if(args.size() == 3 && args[1]->string() == "=" && arg_has_char('*', args[2]))