summaryrefslogtreecommitdiffstats
path: root/bin/gen-DSA
diff options
context:
space:
mode:
authorRaphael Geissert <geissert@debian.org>2012-02-18 19:41:07 +0000
committerRaphael Geissert <geissert@debian.org>2012-02-18 19:41:07 +0000
commit542719337ccd9f6115afcdda730572311375f87d (patch)
tree09b28befd18dfe6ed6baa98586feec521b649716 /bin/gen-DSA
parentbecc2de4b0e9bfa4d63d90e73dc8fafb4ad34aea (diff)
Split some code into functions for easier reading
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@18473 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/gen-DSA')
-rwxr-xr-xbin/gen-DSA20
1 files changed, 16 insertions, 4 deletions
diff --git a/bin/gen-DSA b/bin/gen-DSA
index e0d2d48022..969be0b0bf 100755
--- a/bin/gen-DSA
+++ b/bin/gen-DSA
@@ -50,13 +50,25 @@ if printf '%s' "$1" | grep -Eq '^(DSA-|)[0-9]+(-[0-9]+|)$'; then
shift
fi
-PACKAGE="$(printf '%s' "$1" | tr "[:upper:]" "[:lower:]")"
+toupper() {
+ printf '%s' "$1" | tr '[:lower:]' '[:upper:]'
+}
+
+tolower() {
+ printf '%s' "$1" | tr '[:upper:]' '[:lower:]'
+}
+
+split_n_sort() {
+ printf '%s' "$1" | sed 's/[ ,;]+/ /g' | tr ' ' "\n" | sort -n |
+ tr "\n" ' ' | sed -r 's/\s+/ /g;s/\s$//'
+}
+
+PACKAGE="$(tolower "$1")"
VULNERABILITY="$2"
-CVE="$(printf '%s' "$3" | tr "[:lower:]" "[:upper:]")"
+CVE="$(toupper "$3")"
BUGNUM="$4"
-CVE="$(printf '%s' "$CVE" | sed 's/[ ,;]+/ /g' | tr ' ' "\n" | sort -n | tr "\n" ' ')"
-CVE="${CVE% }"
+CVE="$(split_n_sort "$CVE")"
cve_spacing=
for i in $(seq 0 16); do

© 2014-2024 Faster IT GmbH | imprint | privacy policy