[X2Go-Commits] [x2goclient] 38/95: macbuild.sh: add new repeat_str() helper function.

git-admin at x2go.org git-admin at x2go.org
Thu Oct 29 03:33:45 CET 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 319e815b4563eddcdf62889f02fc2acb92d5fa00
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sun May 3 23:24:37 2015 +0200

    macbuild.sh: add new repeat_str() helper function.
---
 debian/changelog |    1 +
 macbuild.sh      |   16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 250b53f..30f50ce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -70,6 +70,7 @@ x2goclient (4.0.5.1-0x2go1) UNRELEASED; urgency=low
     - macbuild.sh: add new dependency_error() helper function.
     - macbuild.sh: add new lazy_canonical_path() helper function.
     - macbuild.sh: add new get_nesting_level() helper function.
+    - macbuild.sh: add new repeat_str() helper function.
 
   [ Oleksandr Shneyder ]
   * New upstream release (4.0.5.1):
diff --git a/macbuild.sh b/macbuild.sh
index 4d24e52..83e0228 100755
--- a/macbuild.sh
+++ b/macbuild.sh
@@ -79,6 +79,22 @@ set -x
 set +x
 }
 
+repeat_str() { # INPUT COUNT
+	typeset INPUT="${1:?"Error: no input string passed to ${FUNCNAME}()."}"
+	typeset COUNT="${2:?"Error: no count passed to ${FUNCNAME}()."}"
+
+	typeset ret=""
+	typeset -i i=0
+	while [ "${i}" -lt "${COUNT}" ]; do
+		ret="${ret}$(printf "${INPUT}")"
+		i=$((${i} + 1))
+	done
+
+	printf "${ret}"
+
+	return 0
+}
+
 MATCH_HELP='(^((-h)|(--help))([ 	]|$))|([ 	]+((-h)|(--help))([ 	]|$))'
 [ -n "${*}" ] && [[ "${*}" =~ ${MATCH_HELP} ]] && usage
 

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list