[X2Go-Commits] [buildscripts] 01/03: bin/build-rpm-package: add repeat_str() function to... repeat a string.

git-admin at x2go.org git-admin at x2go.org
Wed Apr 1 05:01:21 CEST 2015


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

x2go pushed a commit to branch master
in repository buildscripts.

commit 893c96a40430d0eb7868019a4d55110f8bd5b1e1
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Apr 1 04:33:52 2015 +0200

    bin/build-rpm-package: add repeat_str() function to... repeat a string.
---
 bin/build-rpm-package |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index a598fc4..ca88489 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -168,6 +168,20 @@ check_mock_version_atleast () {
 	fi
 }
 
+# Repeats an input string.
+# Returns the repeated input string.
+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}")"
+	done
+	printf "${ret}"
+}
+
 get_extra_repository () {
 	typeset TYPE="${1:?"Error: no type passed to ${FUNCNAME}()."}"
 	typeset DIST="${2:?"Error: no distribution passed to ${FUNCNAME}()."}"

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


More information about the x2go-commits mailing list