summaryrefslogtreecommitdiff
path: root/mh/tests/atlocal.in
blob: a0416ee13dfd06842aa66da8092969938d41150d (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
44
# @configure_input@                                     -*- shell-script -*-
# Configurable variable values for Mailutils test suite.
# Copyright (C) 2004-2024 Free Software Foundation, Inc.

PATH=@abs_builddir@:@abs_top_builddir@/testsuite:@abs_top_builddir@/mh:$top_srcdir:$srcdir:$PATH
spooldir=$abs_top_srcdir/testsuite/spool/
MHETCDIR=@abs_top_srcdir@/mh/etc

# 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.