[Secure-testing-commits] r18473 - bin
Raphael Geissert
geissert at alioth.debian.org
Sat Feb 18 19:41:07 UTC 2012
Author: geissert
Date: 2012-02-18 19:41:07 +0000 (Sat, 18 Feb 2012)
New Revision: 18473
Modified:
bin/gen-DSA
Log:
Split some code into functions for easier reading
Modified: bin/gen-DSA
===================================================================
--- bin/gen-DSA 2012-02-18 19:32:56 UTC (rev 18472)
+++ bin/gen-DSA 2012-02-18 19:41:07 UTC (rev 18473)
@@ -50,13 +50,25 @@
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
More information about the Secure-testing-commits
mailing list