# @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 }