summaryrefslogtreecommitdiffabout
path: root/mh/tests/atlocal.in
blob: 6a7f4052851f03985d51f1c9d1bb898bd0992156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# @configure_input@                                     -*- shell-script -*-
# Configurable variable values for Mailutils test suite.
# Copyright (C) 2004, 2010-2012, 2014-2017 Free Software Foundation,
# Inc.

PATH=@abs_builddir@:@abs_top_builddir@/testsuite:@abs_top_builddir@/mh:$top_srcdir:$srcdir:$PATH

# mimeflt [FILE]
# Filter out all variable information from a MIME message in FILE.
# If FILE is not given, filter stdin.
# "Variable information" means part boundary and Content-ID header values.
# These elements are likely to change between invocations of mhn -build.
#
# Stderr is redirected to /dev/null because "one true awk" (used, in
# particular, on FreeBSD) complains when closing stdin fails, even if
# it did not use it at all (it fails because stdin is closed earlier by
# MH_SETUP).
mimeflt() {
awk '
/^Content-Type:/ {
  if (match($0, /boundary=".*"/)) {
    s=substr($0,RSTART+10,RLENGTH-11)
    boundary[++boundary_num] = s
    sub(/boundary=".*"/,"boundary=\"BOUNDARY-" boundary_num "\"")
  }
}
/^X-IMAPbase:/ { next }
/^Content-ID:/ {
	content_id[$2]++
	print "Content-ID:", ++content_id_num
	next
}
{  
  if ($0 == ("--" boundary[boundary_num])) {
    print "--BOUNDARY-" boundary_num
  } else if ($0 == ("--" boundary[boundary_num] "--")) {
    print "--BOUNDARY-" boundary_num "--"
    boundary_num--
  } else
    print
}
' $* 2>/dev/null
}

Return to:

Send suggestions and report system problems to the System administrator.