]> www.infradead.org Git - users/dedekind/aiaiai.git/commitdiff
email-test-patchset: minor re-structuring
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Wed, 5 Feb 2014 12:45:46 +0000 (14:45 +0200)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Wed, 5 Feb 2014 15:12:12 +0000 (17:12 +0200)
This is another minor clean-up. Let's fetch all the headers we need in one
place. Just for better readability.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
email/aiaiai-email-test-patchset

index 040e5d7e0129e66d65ef1405a254f516bcf1b44f..dc93150e2dcb648f3cd3c27bd128292ed6dac26c 100755 (executable)
@@ -278,6 +278,13 @@ fi
 fetch_header_or_die subj "Subject" < "$mbox"
 fetch_header_or_die from "From" < "$mbox"
 fetch_header_or_die id "Message-Id" < "$mbox"
+to="$(fetch_header "To" < "$mbox")"
+cc="$(fetch_header "Cc" < "$mbox")"
+
+# Either "To:" or "Cc:" must exist
+if [ -z "$to" ] && [ -z "$cc" ]; then
+       die "Neither \"To:\" nor \"Cc:\" header found"
+fi
 
 printf "\n"
 verbose "Testing mbox: \"$from: $subj (Message-Id: $id)\""
@@ -291,14 +298,6 @@ tmpdir="$(mktemp --tmpdir="$cfg_workdir" -dt "$PROG.XXXX")"
 mv $verbose -- "$mbox" "$tmpdir/mbox" >&2
 mbox="$tmpdir/mbox"
 
-to="$(fetch_header "To" < "$mbox")"
-cc="$(fetch_header "Cc" < "$mbox")"
-
-# Either "To:" or "Cc:" must exist
-if [ -z "$to" ] && [ -z "$cc" ]; then
-       die "Neither \"To:\" nor \"Cc:\" header found"
-fi
-
 # Find out the project name
 prj="$(fetch_project_name "$to" "$cfg_ownmail")"