From 5c0060b73a421a737c79cc9b680f4c7ba988a2ca Mon Sep 17 00:00:00 2001
From: Sven Willenbuecher <sven.willenbuecher@kuehne-nagel.com>
Date: Thu, 23 Dec 2021 15:24:36 +0100
Subject: [PATCH 4/4] implement a LINUX to AIX getopt converter function

---
 src/platform/aix.sh | 47 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)

diff --git a/src/platform/aix.sh b/src/platform/aix.sh
index 03a3958..93a120f 100644
--- a/src/platform/aix.sh
+++ b/src/platform/aix.sh
@@ -1 +1,46 @@
-MKDIR='mkdir -p'
+#!/usr/bin/sh
+
+quote() (
+  arg=$1
+
+  quoted_arg="'"
+  while true; do
+    case ${arg} in
+      *\'* ) quoted_arg=${quoted_arg}${arg%%\'*}"'\''"
+             arg=${arg#*\'};;
+         * ) break;;
+    esac
+  done
+  [ -z "${arg}" ] || quoted_arg=${quoted_arg}${arg}
+  quoted_arg=${quoted_arg}"'"
+
+  printf %s "${quoted_arg}"
+)
+
+quote_lazy() {
+  case $1 in
+    *[\ \']* ) quote "$1";;
+         *   ) printf %s "${1:-''}";;
+  esac
+}
+
+getopt() (
+  while getopts :ahl:n:o:qQs:uTV opt; do
+    case ${opt} in
+      o ) shortopts=$OPTARG;;
+      * ) true;;
+    esac
+  done
+  getopt_args=
+  shift $((OPTIND - 1))
+  for arg; do
+    quoted_arg=$(quote_lazy "${arg}")
+    quoted_arg=$(quote_lazy "${quoted_arg}")
+    getopt_args="${getopt_args} ${quoted_arg}"
+  done
+  eval command getopt "${shortopts}" "${getopt_args}"
+)
+
+GETOPT=getopt
+VERBOSE_MODE=
+GREP_COLOR_OPTION=
-- 
2.20.1

