mirror of https://github.com/leahneukirchen/mblaze
Compare commits
220 Commits
Author | SHA1 | Date |
---|---|---|
Silvan Jegen | d5e202b30f | 3 weeks ago |
Leah Neukirchen | a4502e83c4 | 1 month ago |
Leah Neukirchen | cf5493bb19 | 3 months ago |
Leah Neukirchen | 76f5656401 | 4 months ago |
Johannes Thyssen Tishman | 5310c4ea38 | 8 months ago |
Leah Neukirchen | 59ee2e0ab9 | 10 months ago |
Meudwy | 07d064fc11 | 11 months ago |
Meudwy | 75de7d47da | 11 months ago |
Leah Neukirchen | 43f2cb8b49 | 11 months ago |
Johannes Thyssen Tishman | 23a9e7022e | 12 months ago |
Johannes Thyssen Tishman | ce435c8f6f | 12 months ago |
Mark Hills | 786238551a | 1 year ago |
Leah Neukirchen | 1838158ef1 | 1 year ago |
Leah Neukirchen | cccf01cb9a | 1 year ago |
Leah Neukirchen | 2365f48f06 | 2 years ago |
Michael Forney | 74e77845c3 | 2 years ago |
Michael Forney | 1babebc12c | 2 years ago |
codesoap | 8d543fdb21 | 2 years ago |
Omar Polo | 9d66764434 | 2 years ago |
gco | e6813fd07c | 2 years ago |
gco | 877569a6f3 | 2 years ago |
jgart | bbc754e2a1 | 2 years ago |
Alyssa Ross | bb3dacc604 | 2 years ago |
Julian Rother | 793e22ecb7 | 2 years ago |
Leah Neukirchen | 47c5707d50 | 2 years ago |
Leah Neukirchen | cd5bc471f3 | 2 years ago |
Lucas | e951b0ba27 | 2 years ago |
Leah Neukirchen | fa27d73ddd | 2 years ago |
Leah Neukirchen | 3496545358 | 2 years ago |
Leah Neukirchen | a60147f633 | 3 years ago |
Stacy Harper | e1e5bfe5ff | 3 years ago |
Leah Neukirchen | e44aaad66e | 3 years ago |
Leah Neukirchen | b962fb6be0 | 3 years ago |
Leah Neukirchen | 958e3e08bd | 3 years ago |
Leah Neukirchen | fcd8428b72 | 3 years ago |
Leah Neukirchen | 41bd429452 | 3 years ago |
Leah Neukirchen | 4be6e0ce91 | 3 years ago |
Leah Neukirchen | 4ccf2f08c1 | 3 years ago |
Léo Villeveygoux | 65d43e3cea | 3 years ago |
Leah Neukirchen | 386b65fcb4 | 3 years ago |
Leah Neukirchen | 014f82ef0c | 3 years ago |
Leah Neukirchen | d324b92dd4 | 3 years ago |
Leah Neukirchen | 0370916357 | 3 years ago |
Leah Neukirchen | 5c7432aa7b | 3 years ago |
Leah Neukirchen | 4f1f0ea2b3 | 3 years ago |
Leah Neukirchen | 0ed7f72d31 | 3 years ago |
Leah Neukirchen | 4e0de11300 | 3 years ago |
Leah Neukirchen | 9713264f70 | 3 years ago |
Leah Neukirchen | 23941c6c19 | 3 years ago |
Dominik Honnef | 6e8e4e01ed | 3 years ago |
Leah Neukirchen | 6684f74f07 | 3 years ago |
Leah Neukirchen | 605509cc06 | 3 years ago |
Leah Neukirchen | 2b517f97c0 | 3 years ago |
Leah Neukirchen | c4008e43d9 | 3 years ago |
Leah Neukirchen | ce900601cb | 3 years ago |
Leah Neukirchen | 41c681362d | 3 years ago |
Leah Neukirchen | 8ba44643e4 | 3 years ago |
Leah Neukirchen | 669af4ffca | 3 years ago |
Leah Neukirchen | 7d04932813 | 3 years ago |
Leah Neukirchen | 5b52110399 | 3 years ago |
Leah Neukirchen | 93e8a4a892 | 3 years ago |
Leah Neukirchen | e8981b723d | 3 years ago |
Leah Neukirchen | 709f8f1121 | 3 years ago |
Leah Neukirchen | 41cf6272a5 | 3 years ago |
Leah Neukirchen | ff7537f6a7 | 3 years ago |
Leah Neukirchen | 741972a416 | 3 years ago |
Leah Neukirchen | c2d497b139 | 3 years ago |
Leah Neukirchen | 2d6de31cd7 | 3 years ago |
Leah Neukirchen | e96f0707de | 3 years ago |
Leah Neukirchen | 318ac214f1 | 3 years ago |
nicoo | 8e0d57425f | 3 years ago |
Leah Neukirchen | 4fcb4ae0a4 | 3 years ago |
codesoap | 8ad63494bf | 3 years ago |
Leah Neukirchen | c525c0097e | 4 years ago |
Leah Neukirchen | f95439a988 | 4 years ago |
James Rowe | bc021c53b6 | 4 years ago |
Leah Neukirchen | 6a8543e321 | 4 years ago |
Leah Neukirchen | c43538fae9 | 4 years ago |
Leah Neukirchen | 5167bbfe39 | 4 years ago |
Leah Neukirchen | 5e6151e3bf | 4 years ago |
Leah Neukirchen | 48c20b7efa | 4 years ago |
nicoo | a825b4f8f4 | 4 years ago |
Leah Neukirchen | b076d09f3a | 4 years ago |
James Rowe | 5d8f070e26 | 4 years ago |
Leah Neukirchen | 4d566a6afe | 4 years ago |
James Rowe | 0180f649d2 | 4 years ago |
Michael Forney | 02e4cf4001 | 4 years ago |
Michael Forney | 50dfdf5605 | 4 years ago |
Leah Neukirchen | d2621a715b | 4 years ago |
Leah Neukirchen | 2c8acab338 | 4 years ago |
Leah Neukirchen | 07ee45cf31 | 4 years ago |
Leah Neukirchen | ccceb10908 | 4 years ago |
Tim Kuijsten | 4763032430 | 4 years ago |
Leah Neukirchen | 6bd687bfdc | 4 years ago |
Leah Neukirchen | 1e9f6cd06b | 4 years ago |
Leah Neukirchen | 6649576fda | 4 years ago |
Leah Neukirchen | 74857db199 | 4 years ago |
Leah Neukirchen | 32b5837bfd | 4 years ago |
Leah Neukirchen | b41d2efa40 | 4 years ago |
Leah Neukirchen | 92bb41fa73 | 4 years ago |
Leah Neukirchen | b2a6e3dcc0 | 4 years ago |
Jeremy Bobbin | 3f61249c05 | 4 years ago |
Leah Neukirchen | 04ed2d439a | 4 years ago |
Leah Neukirchen | a02c7e451b | 4 years ago |
Leah Neukirchen | bb8054c2ff | 4 years ago |
Leah Neukirchen | fec4e06671 | 4 years ago |
Leah Neukirchen | 7e9e75bd88 | 4 years ago |
Leah Neukirchen | 957c09909d | 4 years ago |
Duncan Overbruck | d9c3914924 | 4 years ago |
Leah Neukirchen | 96c506085f | 4 years ago |
Leah Neukirchen | 30f3054bac | 4 years ago |
Leah Neukirchen | b063294daf | 4 years ago |
Leah Neukirchen | e7442fcc72 | 4 years ago |
Leah Neukirchen | 54283ebeee | 4 years ago |
Julian Rother | db7b58f24a | 4 years ago |
Julian Rother | e5206792df | 4 years ago |
Leah Neukirchen | 282de65079 | 4 years ago |
Leah Neukirchen | 3ea0c9c355 | 4 years ago |
Leah Neukirchen | 17fe13a95f | 4 years ago |
Leah Neukirchen | 41a9a6b40d | 4 years ago |
Leah Neukirchen | d777d370dd | 4 years ago |
Leah Neukirchen | fb77179bbd | 4 years ago |
Leah Neukirchen | 7cd43f4203 | 4 years ago |
Duncan Overbruck | b79e38b686 | 4 years ago |
Duncan Overbruck | 0645634733 | 4 years ago |
Duncan Overbruck | 95a9c0837b | 4 years ago |
Duncaen | 331d0e4680 | 4 years ago |
Duncaen | d45d1c4ff5 | 4 years ago |
Duncaen | d93c1e2fe4 | 4 years ago |
Duncaen | aa2868822b | 4 years ago |
Duncaen | 8ae4801dd4 | 4 years ago |
Duncaen | 32f0fcbc0d | 4 years ago |
Duncaen | d5afda072b | 4 years ago |
Duncaen | 4baa330b63 | 4 years ago |
Duncaen | d235a3e64c | 4 years ago |
Duncaen | 482bbffd2c | 4 years ago |
Duncaen | 1010ae06bf | 4 years ago |
Duncaen | b8cf02825a | 4 years ago |
Duncaen | 28d0d51e34 | 4 years ago |
Duncaen | 8f0b6e2117 | 4 years ago |
Duncaen | 3968f2ef03 | 4 years ago |
Duncaen | 401aa88752 | 4 years ago |
Duncaen | eec6a4ebfd | 4 years ago |
Leah Neukirchen | 41c8fefb73 | 4 years ago |
Leah Neukirchen | 61caf5a6a3 | 4 years ago |
Leah Neukirchen | 4927d44d55 | 4 years ago |
Leah Neukirchen | 62da7c59ea | 4 years ago |
Leah Neukirchen | a5c77c71bc | 4 years ago |
Leah Neukirchen | e4e15bb4f0 | 4 years ago |
Leah Neukirchen | d83860c34e | 4 years ago |
Alyssa Ross | 3663d7365b | 4 years ago |
Alyssa Ross | 99b7d47a10 | 4 years ago |
Leah Neukirchen | e56f8ad294 | 4 years ago |
Leah Neukirchen | 3370fd5f70 | 4 years ago |
Leah Neukirchen | 8c8a4bd422 | 4 years ago |
Leah Neukirchen | d50bb5772a | 4 years ago |
Leah Neukirchen | eabdda4405 | 4 years ago |
Leah Neukirchen | 604afb5011 | 4 years ago |
Leah Neukirchen | 7e6b1c97e6 | 4 years ago |
Leah Neukirchen | 5885bbe69f | 4 years ago |
Leah Neukirchen | 8c9e0aae05 | 4 years ago |
Leah Neukirchen | 079e423438 | 4 years ago |
Leah Neukirchen | 8d611a8a3d | 4 years ago |
Leah Neukirchen | dfc18e0040 | 4 years ago |
Leah Neukirchen | 48b490f379 | 4 years ago |
Leah Neukirchen | 6dd0799aab | 4 years ago |
Leah Neukirchen | 582256618a | 4 years ago |
Leah Neukirchen | 83f9794bb0 | 4 years ago |
Duncan Overbruck | dc15a75b63 | 4 years ago |
Leah Neukirchen | 2636f5127d | 4 years ago |
Leah Neukirchen | 92dd0f7be5 | 4 years ago |
Leah Neukirchen | 113ac5a24d | 4 years ago |
Leah Neukirchen | 1755fa6279 | 4 years ago |
Leah Neukirchen | da457c51ee | 4 years ago |
Leah Neukirchen | e0733f187b | 4 years ago |
Leah Neukirchen | 513ac7d002 | 4 years ago |
Sören Tempel | 55035ad8b2 | 4 years ago |
Leah Neukirchen | 6705b3ee29 | 4 years ago |
Leah Neukirchen | 3da5f0e391 | 4 years ago |
Leah Neukirchen | 9e91eb6e8b | 5 years ago |
Silvan Jegen | dbf118f6c9 | 5 years ago |
Leah Neukirchen | 1ed8a0ac76 | 5 years ago |
Leah Neukirchen | 48285fe722 | 5 years ago |
Sebastien Marie | a4b975e731 | 5 years ago |
Konst Mayer | 71e2318c81 | 5 years ago |
Leah Neukirchen | 5ee756f6a5 | 5 years ago |
Leah Neukirchen | 68272afcba | 5 years ago |
Leah Neukirchen | a60e705e51 | 5 years ago |
Leah Neukirchen | 5fa9a7a706 | 5 years ago |
Leah Neukirchen | 5b0755ca68 | 5 years ago |
Leah Neukirchen | fd675ef159 | 5 years ago |
Leah Neukirchen | 8a095775d0 | 5 years ago |
Leah Neukirchen | 53151f4f89 | 5 years ago |
Leah Neukirchen | 0d73424edf | 5 years ago |
Leah Neukirchen | b052723eac | 5 years ago |
Leah Neukirchen | 023c26f943 | 5 years ago |
Leah Neukirchen | 081a9404cd | 5 years ago |
Leah Neukirchen | bb80642b70 | 5 years ago |
Leah Neukirchen | 58365527e4 | 5 years ago |
Duncaen | c8ce6d220c | 5 years ago |
Duncaen | 74d8393fdf | 5 years ago |
Leah Neukirchen | 11ae5504fd | 5 years ago |
Leah Neukirchen | 9dfbf48be4 | 5 years ago |
Leah Neukirchen | 3a97df9990 | 5 years ago |
Leah Neukirchen | 01b2f1abc6 | 5 years ago |
Leah Neukirchen | 5a8bb16289 | 5 years ago |
Leah Neukirchen | 5fc3115c3f | 5 years ago |
Leah Neukirchen | 3d3fffd7e8 | 5 years ago |
Leah Neukirchen | 3f2c714b42 | 5 years ago |
Leah Neukirchen | f8fa6a1e0e | 5 years ago |
Leah Neukirchen | 085138d6a2 | 5 years ago |
Leah Neukirchen | cb0ffbf6ad | 5 years ago |
Leah Neukirchen | 6ea32480f1 | 5 years ago |
Leah Neukirchen | 4198cd42fa | 5 years ago |
Leah Neukirchen | 4e9237f921 | 5 years ago |
Leah Neukirchen | 65ddebc87c | 5 years ago |
Leah Neukirchen | bccacce816 | 5 years ago |
Leah Neukirchen | 8d09a5339e | 5 years ago |
Leah Neukirchen | b85c56f30c | 5 years ago |
Leah Neukirchen | 2c14e800cd | 5 years ago |
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# mcount - count mails from sequence on stdin
|
||||
|
||||
[ -t 1 ] && stdout=1
|
||||
|
||||
awk -v stdout=$stdout '
|
||||
!/^ *</ { n++ }
|
||||
!stdout { print }
|
||||
END { fflush(); print n " mails processed" > "/dev/stderr" }
|
||||
'
|
@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
# mmailto mailto:... - mailto: handler spawning mcom in a terminal emulator
|
||||
|
||||
tryterm() {
|
||||
if [ -z "$TERMINAL" ] && command -v "$1" >/dev/null; then
|
||||
TERMINAL="$*"
|
||||
fi
|
||||
}
|
||||
|
||||
tryterm x-terminal-emulator
|
||||
tryterm urxvt
|
||||
tryterm xterm
|
||||
|
||||
if [ -z "$TERMINAL" ]; then
|
||||
echo 'No terminal emulator found, set $TERMINAL.' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
exec $TERMINAL -e mcom $(
|
||||
awk -v url="$1" '
|
||||
|
||||
function decode(s) {
|
||||
hexdigits = "0123456789abcdef"
|
||||
for (i = 1; i < length(s); i++) {
|
||||
if (substr(s, i, 3) ~ /%[0-9a-fA-F][0-9a-fA-F]/) {
|
||||
c = sprintf("%c", (index(hexdigits, tolower(substr(s, i+1, 1)))-1) * 16 + \
|
||||
index(hexdigits, tolower(substr(s, i+2, 1)))-1)
|
||||
if (c == "\n") c = " "
|
||||
s = substr(s, 1, i-1) c substr(s, i+3)
|
||||
i += 2
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
url = decode(url)
|
||||
sub(/^mailto:/, "", url)
|
||||
split(url, parts, "?")
|
||||
to = parts[1]
|
||||
split(parts[2], fields, "&")
|
||||
args[1] = to
|
||||
for (i in fields) {
|
||||
split(fields[i], kv, "=")
|
||||
if (kv[1] != "r") {
|
||||
args[length(args)+1] = "-" kv[1]
|
||||
args[length(args)+1] = kv[2]
|
||||
}
|
||||
}
|
||||
for (i in args) {
|
||||
print decode(args[i])
|
||||
}
|
||||
}
|
||||
'
|
||||
)
|
@ -0,0 +1,18 @@
|
||||
#!/bin/sh -e
|
||||
# mopenall [MSG] - open every attachements in xdg-open
|
||||
|
||||
[ "$#" -eq 0 ] && set -- .
|
||||
|
||||
f="$(mseq "$1" | sed 1q)"
|
||||
[ -z "$f" ] && printf 'No message %s.\n' "$1" 1>&2 && exit 1
|
||||
|
||||
dir=$(mktemp -d -t menter.XXXXXX)
|
||||
cd "$dir"
|
||||
mshow -t "$1"
|
||||
mshow -B -x "$1" 2>/dev/null
|
||||
for f in * ; do
|
||||
xdg-open "$f" &
|
||||
done
|
||||
wait
|
||||
echo rm -r "$dir"
|
||||
rm -r "$dir"
|
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
# mrecode - recode stdin respecting PIPE_CHARSET into UTF-8
|
||||
|
||||
if [ -n "$PIPE_CHARSET" ]; then
|
||||
exec iconv -f "$PIPE_CHARSET" -t UTF-8
|
||||
else
|
||||
exec cat
|
||||
fi
|
||||
case "$PIPE_CHARSET" in
|
||||
''|*[Uu][Nn][Kk][Nn][Oo][Ww][Nn]*) exec cat;;
|
||||
*) exec iconv -f "$PIPE_CHARSET" -t UTF-8;;
|
||||
esac
|
||||
|
||||
|
@ -1,86 +1,28 @@
|
||||
#include <time.h>
|
||||
|
||||
// from musl@1cc81f5cb, slightly tweaked
|
||||
|
||||
static long long
|
||||
__year_to_secs(long long year, int *is_leap)
|
||||
time_t
|
||||
mytimegm(struct tm *tm)
|
||||
{
|
||||
if (year-2ULL <= 136) {
|
||||
int y = year;
|
||||
int leaps = (y-68)>>2;
|
||||
if (!((y-68)&3)) {
|
||||
leaps--;
|
||||
if (is_leap) *is_leap = 1;
|
||||
} else if (is_leap) *is_leap = 0;
|
||||
return 31536000*(y-70) + 86400*leaps;
|
||||
}
|
||||
|
||||
int cycles, centuries, leaps, rem;
|
||||
|
||||
cycles = (year-100) / 400;
|
||||
rem = (year-100) % 400;
|
||||
if (rem < 0) {
|
||||
cycles--;
|
||||
rem += 400;
|
||||
}
|
||||
if (!rem) {
|
||||
*is_leap = 1;
|
||||
centuries = 0;
|
||||
leaps = 0;
|
||||
} else {
|
||||
if (rem >= 200) {
|
||||
if (rem >= 300) centuries = 3, rem -= 300;
|
||||
else centuries = 2, rem -= 200;
|
||||
} else {
|
||||
if (rem >= 100) centuries = 1, rem -= 100;
|
||||
else centuries = 0;
|
||||
}
|
||||
if (!rem) {
|
||||
*is_leap = 0;
|
||||
leaps = 0;
|
||||
} else {
|
||||
leaps = rem / 4U;
|
||||
rem %= 4U;
|
||||
*is_leap = !rem;
|
||||
}
|
||||
}
|
||||
|
||||
leaps += 97*cycles + 24*centuries - *is_leap;
|
||||
int mon = tm->tm_mon + 1 - 2; /* put March first, Feb last */
|
||||
long long year = tm->tm_year + 1900;
|
||||
|
||||
return (year-100) * 31536000LL + leaps * 86400LL + 946684800 + 86400;
|
||||
}
|
||||
|
||||
static int
|
||||
__month_to_secs(int month, int is_leap)
|
||||
{
|
||||
static const int secs_through_month[] = {
|
||||
0, 31*86400, 59*86400, 90*86400,
|
||||
120*86400, 151*86400, 181*86400, 212*86400,
|
||||
243*86400, 273*86400, 304*86400, 334*86400 };
|
||||
int t = secs_through_month[month];
|
||||
if (is_leap && month >= 2) t+=86400;
|
||||
return t;
|
||||
}
|
||||
|
||||
time_t tm_to_secs(const struct tm *tm)
|
||||
{
|
||||
int is_leap;
|
||||
long long year = tm->tm_year;
|
||||
int month = tm->tm_mon;
|
||||
if (month >= 12 || month < 0) {
|
||||
int adj = month / 12;
|
||||
month %= 12;
|
||||
if (month < 0) {
|
||||
if (mon <= 0 || mon >= 12) {
|
||||
int adj = mon / 12;
|
||||
mon %= 12;
|
||||
if (mon <= 0) {
|
||||
adj--;
|
||||
month += 12;
|
||||
mon += 12;
|
||||
}
|
||||
year += adj;
|
||||
}
|
||||
long long t = __year_to_secs(year, &is_leap);
|
||||
t += __month_to_secs(month, is_leap);
|
||||
t += 86400LL * (tm->tm_mday-1);
|
||||
t += 3600LL * tm->tm_hour;
|
||||
t += 60LL * tm->tm_min;
|
||||
t += tm->tm_sec;
|
||||
|
||||
time_t t = 0;
|
||||
t += tm->tm_sec;
|
||||
t += 60 * tm->tm_min;
|
||||
t += 60*60 * tm->tm_hour;
|
||||
t += 24*60*60 * (tm->tm_mday - 1);
|
||||
t += 24*60*60 * (367*mon/12);
|
||||
t += 24*60*60 * (year/4 - year/100 + year/400);
|
||||
t += 24*60*60 * (365*year - 719498L);
|
||||
return t;
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
#!/bin/sh -e
|
||||
cd ${0%/*}
|
||||
. ./lib.sh
|
||||
|
||||
plan 9
|
||||
|
||||
cat <<EOF >tmp
|
||||
Header: foo
|
||||
Header2: bar
|
||||
Header-Three: quux
|
||||
Header_Four: ding
|
||||
|
||||
Body
|
||||
EOF
|
||||
|
||||
check_same 'Header' 'mhdr -h Header ./tmp' 'echo foo'
|
||||
check_same 'Header2' 'mhdr -h Header2 ./tmp' 'echo bar'
|
||||
check_same 'Header-Three' 'mhdr -h Header-Three ./tmp' 'echo quux'
|
||||
check_same 'Header_Four' 'mhdr -h Header_Four ./tmp' 'echo ding'
|
||||
|
||||
check_same 'header' 'mhdr -h header ./tmp' 'echo foo'
|
||||
check_same 'header2' 'mhdr -h header2 ./tmp' 'echo bar'
|
||||
check_same 'header-Three' 'mhdr -h header-Three ./tmp' 'echo quux'
|
||||
check_same 'header_Four' 'mhdr -h header_Four ./tmp' 'echo ding'
|
||||
|
||||
check 'issue 235' 'mhdr ./tmp |grep -i header_four'
|
@ -0,0 +1,41 @@
|
||||
#!/bin/sh -e
|
||||
cd ${0%/*}
|
||||
. ./lib.sh
|
||||
plan 2
|
||||
|
||||
# Nested MIME where the outer boundary is a prefix of the inner boundary
|
||||
cat <<EOF >tmp
|
||||
MIME-Version: 1.0
|
||||
Content-type: multipart/mixed; charset=iso-8859-1;
|
||||
boundary="_xec5AqfRYxfhARmklHx"
|
||||
|
||||
|
||||
--_xec5AqfRYxfhARmklHx
|
||||
Content-type: Multipart/alternative; charset=iso-8859-1;
|
||||
boundary="_xec5AqfRYxfhARmklHx8"
|
||||
|
||||
|
||||
--_xec5AqfRYxfhARmklHx8
|
||||
Content-type: text/plain; charset=iso-8859-1
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Content-Disposition: inline
|
||||
|
||||
foo
|
||||
--_xec5AqfRYxfhARmklHx8
|
||||
Content-type: text/html; charset=iso-8859-1
|
||||
Content-Transfer-Encoding: Quoted-printable
|
||||
Content-Disposition: inline
|
||||
|
||||
bar
|
||||
--_xec5AqfRYxfhARmklHx8--
|
||||
|
||||
--_xec5AqfRYxfhARmklHx
|
||||
Content-Type: application/zip
|
||||
Content-Transfer-Encoding: Base64
|
||||
|
||||
quux
|
||||
--_xec5AqfRYxfhARmklHx--
|
||||
EOF
|
||||
|
||||
check 'nested mail has 5 attachments' 'mshow -t ./tmp | wc -l | grep 6'
|
||||
check 'nested mail has text/html attachment' 'mshow -t ./tmp | grep text/html'
|
@ -0,0 +1,53 @@
|
||||
#!/bin/sh -e
|
||||
cd ${0%/*}
|
||||
. ./lib.sh
|
||||
plan 3
|
||||
|
||||
# Mail with \n\n and \r\n\r\n
|
||||
cr=$(printf '\r')
|
||||
cat <<EOF >tmp
|
||||
Content-Type: multipart/form-data; boundary=------------------------55a586f81559face$cr
|
||||
$cr
|
||||
--------------------------55a586f81559face$cr
|
||||
Content-Disposition: form-data; name="a"; filename="foo"$cr
|
||||
Content-Type: application/octet-stream$cr
|
||||
$cr
|
||||
foo$cr
|
||||
|
||||
previously there are two NL$cr
|
||||
$cr
|
||||
--------------------------55a586f81559face$cr
|
||||
Content-Disposition: form-data; name="a"; filename="bar"$cr
|
||||
Content-Type: application/octet-stream$cr
|
||||
$cr
|
||||
bar$cr
|
||||
$cr
|
||||
--------------------------55a586f81559face--$cr
|
||||
EOF
|
||||
|
||||
check 'mail has 3 attachments' 'mshow -t ./tmp | wc -l | grep 4'
|
||||
check 'mail attachment foo has size 35' 'mshow -t ./tmp | grep size=35.*name=\"foo\"'
|
||||
|
||||
# Mail with linebreaks in base64 quartets
|
||||
cat <<EOF >tmp
|
||||
Subject: base64
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed; boundary="----_=_2f8f1e2243b55f8618eaf0d9_=_"
|
||||
|
||||
This is a multipart message in MIME format.
|
||||
|
||||
------_=_2f8f1e2243b55f8618eaf0d9_=_
|
||||
Content-Disposition: attachment; filename=base64
|
||||
Content-Type: application/binary
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
dGhp
|
||||
cyBpc
|
||||
yBzb21
|
||||
lIGJhc2
|
||||
U2NAo=
|
||||
|
||||
------_=_2f8f1e2243b55f8618eaf0d9_=_--
|
||||
EOF
|
||||
|
||||
check 'mail decodes correctly' 'mshow -O ./tmp 2 | grep -q "this is some base64"'
|
@ -0,0 +1,26 @@
|
||||
#!/bin/sh -e
|
||||
cd ${0%/*}
|
||||
. ./lib.sh
|
||||
plan 2
|
||||
|
||||
cat <<EOF >tmp.1
|
||||
Subject: message 1
|
||||
|
||||
This is message 1.
|
||||
EOF
|
||||
|
||||
cat <<EOF >tmp.2
|
||||
Subject: message 2
|
||||
|
||||
This is message 2. It has a trailing empty line.
|
||||
|
||||
EOF
|
||||
|
||||
printf >tmp.3 'Subject: message 3
|
||||
|
||||
This is message 3. It has a no trailing newline, oops.'
|
||||
|
||||
mexport ./tmp.1 ./tmp.2 ./tmp.3 >./tmp.mbox
|
||||
|
||||
check 'generated mbox has 16 lines' 'cat ./tmp.mbox | wc -l | grep 16'
|
||||
check 'generated mbox has 7 empty lines' 'grep -c "^$" ./tmp.mbox | grep 7'
|
@ -0,0 +1,85 @@
|
||||
#!/bin/sh -e
|
||||
cd ${0%/*}
|
||||
. ./lib.sh
|
||||
plan 9
|
||||
|
||||
rm -rf test.dir
|
||||
mkdir test.dir
|
||||
cd test.dir
|
||||
|
||||
mmkdir inbox
|
||||
|
||||
cat <<EOF >tmp.1
|
||||
Subject: message 1
|
||||
|
||||
This is message 1.
|
||||
EOF
|
||||
|
||||
cat <<EOF >tmp.2
|
||||
Subject: message 2
|
||||
|
||||
This is message 2. It has a trailing empty line.
|
||||
|
||||
EOF
|
||||
|
||||
printf >tmp.3 'Subject: message 3
|
||||
|
||||
This is message 3. It has a no trailing newline, oops.'
|
||||
|
||||
cat <<EOF >tmp.4
|
||||
Subject: message 4
|
||||
|
||||
|
||||
|
||||
This is message 4. It has multiple trailing empty lines.
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
mexport ./tmp.1 | mdeliver -M inbox/
|
||||
check 'message 1 is delivered verbatim via mbox' 'cmp ./tmp.1 ./inbox/new/*:2,'
|
||||
rm -f ./inbox/new/*
|
||||
|
||||
mexport ./tmp.2 | mdeliver -M inbox/
|
||||
check 'message 2 is delivered verbatim via mbox' 'cmp ./tmp.2 ./inbox/new/*:2,'
|
||||
rm -f ./inbox/new/*
|
||||
|
||||
mexport ./tmp.3 | mdeliver -M inbox/
|
||||
check 'message 3 gets a newline via mbox' 'awk 1 ./tmp.3 | cmp - ./inbox/new/*:2,'
|
||||
rm -f ./inbox/new/*
|
||||
|
||||
mexport ./tmp.4 | mdeliver -M inbox/
|
||||
check 'message 4 gets delivered verbatim via mbox' 'cmp ./tmp.4 ./inbox/new/*:2,'
|
||||
rm -f ./inbox/new/*
|
||||
|
||||
mdeliver inbox/ <./tmp.1
|
||||
check 'message 1 is delivered verbatim via stdin' 'cmp ./tmp.1 ./inbox/new/*:2,'
|
||||
rm -f ./inbox/new/*
|
||||
|
||||
mdeliver inbox/ <./tmp.2
|
||||
check 'message 2 is delivered verbatim via stdin' 'cmp ./tmp.2 ./inbox/new/*:2,'
|
||||
rm -f ./inbox/new/*
|
||||
|
||||
mdeliver inbox/ <./tmp.3
|
||||
check 'message 3 gets a newline via stdin' 'cmp ./tmp.3 ./inbox/new/*:2,'
|
||||
rm -f ./inbox/new/*
|
||||
|
||||
mdeliver inbox/ <./tmp.4
|
||||
check 'message 4 is delivered verbatim via stdin' 'cmp ./tmp.4 ./inbox/new/*:2,'
|
||||
rm -f ./inbox/new/*
|
||||
|
||||
|
||||
cat <<EOF >tmp.mbox
|
||||
From nobody Thu Jan 1 00:59:59 1970
|
||||
Subject: message 1
|
||||
|
||||
This is message 1.
|
||||
From nobody Thu Jan 1 00:59:59 1970
|
||||
Subject: message 2
|
||||
|
||||
This is message 2.
|
||||
|
||||
EOF
|
||||
|
||||
mdeliver -M inbox/ <./tmp.mbox
|
||||
check 'mdeliver -M is tolerant with missing empty lines' 'ls inbox/new | wc -l | grep 2'
|
@ -0,0 +1,166 @@
|
||||
#!/bin/sh -e
|
||||
cd ${0%/*}
|
||||
. ./lib.sh
|
||||
plan 12
|
||||
|
||||
rm -rf test.dir
|
||||
mkdir test.dir
|
||||
(
|
||||
cd test.dir
|
||||
|
||||
export PIPE_CONTENTTYPE='text/plain; format=flowed'
|
||||
export COLUMNS=80
|
||||
|
||||
cat <<! >a
|
||||
this
|
||||
is
|
||||
flowed.
|
||||
!
|
||||
cat <<! >b
|
||||
this is flowed.
|
||||
!
|
||||
check 'simple reflow' 'mflow <a | cmp - b'
|
||||
|
||||
cat <<! >a
|
||||
this
|
||||
is
|
||||
two spaces.
|
||||
!
|
||||
cat <<! >b
|
||||
this is two spaces.
|
||||
!
|
||||
check 'simple space stuffing' 'mflow <a | cmp - b'
|
||||
|
||||
cat <<! >a
|
||||
this
|
||||
is
|
||||
flowed.
|
||||
this is fixed.
|
||||
!
|
||||
cat <<! >b
|
||||
this is flowed.
|
||||
this is fixed.
|
||||
!
|
||||
check 'simple fixed' 'mflow <a | cmp - b'
|
||||
|
||||
cat <<! >a
|
||||
> this
|
||||
> is
|
||||
> quoted.
|
||||
this
|
||||
is
|
||||
unquoted.
|
||||
!
|
||||
cat <<! >b
|
||||
> this is quoted.
|
||||
this is unquoted.
|
||||
!
|
||||
check 'simple quoted' 'mflow <a | cmp - b'
|
||||
|
||||
(
|
||||
export PIPE_CONTENTTYPE='text/plain; format=flowed; delsp=yes'
|
||||
|
||||
cat <<! >a
|
||||
> this
|
||||
> is
|
||||
> delsp.
|
||||
|
||||
> double
|
||||
> spaced
|
||||
!
|
||||
cat <<! >b
|
||||
> thisisdelsp.
|
||||
|
||||
> double spaced
|
||||
!
|
||||
check 'simple delsp' 'mflow <a | cmp - b'
|
||||
)
|
||||
|
||||
cat <<! >a
|
||||
this
|
||||
is
|
||||
way more than eighty chars which is the terminal width to flow.
|
||||
this
|
||||
is
|
||||
way more than eighty chars which is the terminal width to flow.
|
||||
!
|
||||
cat <<! >b
|
||||
this is way more than eighty chars which is the terminal width to flow. this is
|
||||
way more than eighty chars which is the terminal width to flow.
|
||||
!
|
||||
check 'simple wrap' 'mflow <a | cmp - b'
|
||||
|
||||
cat <<! >a
|
||||
this
|
||||
is
|
||||
way more than eighty chars which is the terminal width to flow.
|
||||
averylongwordcomeshere.
|
||||
this
|
||||
is
|
||||
way more than eighty chars which is the terminal width to flow.
|
||||
!
|
||||
cat <<! >b
|
||||
this is way more than eighty chars which is the terminal width to flow.
|
||||
averylongwordcomeshere. this is way more than eighty chars which is the
|
||||
terminal width to flow.
|
||||
!
|
||||
check 'more complex wrap' 'mflow <a | cmp - b'
|
||||
|
||||
cat <<! >a
|
||||
foo
|
||||
bar.
|
||||
|
||||
quux.
|
||||
!
|
||||
cat <<! >b
|
||||
foo bar.
|
||||
|
||||
quux.
|
||||
!
|
||||
check 'space before empty line' 'mflow <a | cmp - b'
|
||||
|
||||
cat <<! >a
|
||||
Aaaaa bbbbb ccccc ddddd eeeee aaaaa bbbbb ccccc ddddd eeeee
|
||||
aaaaa bbbbb ccccc ddddd eeeee aaaaa bbbbb ccccc ddddd eeeee
|
||||
aaaaa bbbbb ccccc
|
||||
ffffff gggggg hhhhhh iiiiii.
|
||||
!
|
||||
cat <<! >b
|
||||
Aaaaa bbbbb ccccc ddddd eeeee aaaaa bbbbb ccccc ddddd eeeee aaaaa bbbbb ccccc
|
||||
ddddd eeeee aaaaa bbbbb ccccc ddddd eeeee aaaaa bbbbb ccccc ffffff gggggg
|
||||
hhhhhh iiiiii.
|
||||
!
|
||||
check 'fixed lines are wrapped too' 'mflow <a | cmp - b'
|
||||
|
||||
cat <<! >a
|
||||
some
|
||||
wrapped.
|
||||
--
|
||||
signature
|
||||
!
|
||||
cat <<! >b
|
||||
some wrapped.
|
||||
--
|
||||
signature
|
||||
!
|
||||
check 'passes usenet signature marker as is' 'mflow <a | cmp - b'
|
||||
|
||||
cat <<! >a
|
||||
some regular text being force wrapped because the line is way too long oh no who writes so long lines.
|
||||
!
|
||||
cat <<! >b
|
||||
some regular text being force wrapped because the line is way too long oh no
|
||||
who writes so long lines.
|
||||
!
|
||||
check 'force wrapping' 'mflow -f <a | cmp - b'
|
||||
|
||||
cat <<! >a
|
||||
> some regular text being force wrapped because the line is way too long oh no who writes so long lines.
|
||||
!
|
||||
cat <<! >b
|
||||
> some regular text being force wrapped because the line is way too long oh no
|
||||
> who writes so long lines.
|
||||
!
|
||||
check 'force wrapping of quoted text' 'mflow -f <a | cmp - b'
|
||||
|
||||
)
|
@ -0,0 +1,26 @@
|
||||
#ifndef PLEDGE_H
|
||||
#define PLEDGE_H
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void
|
||||
xpledge(const char *promises, const char *execpromises)
|
||||
{
|
||||
if (pledge(promises, execpromises) == -1)
|
||||
err(1, "pledge");
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define xpledge(promises, execpromises) do { } while(0)
|
||||
|
||||
#endif /* __OpenBSD__ */
|
||||
|
||||
#endif /* PLEDGE_H */
|
Loading…
Reference in New Issue