mirror of
https://github.com/leahneukirchen/mblaze
synced 2024-11-07 15:20:37 +00:00
Merge branch 'master' of https://github.com/chneukirchen/mblaze
This commit is contained in:
commit
888ed08855
10
GNUmakefile
10
GNUmakefile
@ -1,11 +1,13 @@
|
|||||||
CFLAGS+=-g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2
|
CFLAGS=-g -O2
|
||||||
|
override CFLAGS:=-Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 $(CFLAGS)
|
||||||
LDLIBS=-lrt
|
LDLIBS=-lrt
|
||||||
|
|
||||||
OS := $(shell uname)
|
OS := $(shell uname)
|
||||||
|
|
||||||
ifeq ($(OS),OpenBSD)
|
ifeq ($(OS),OpenBSD)
|
||||||
CFLAGS+=-I/usr/local/include -pthread
|
LOCALBASE=/usr/local
|
||||||
LDLIBS=-L/usr/local/lib -liconv -pthread
|
CFLAGS+=-I$(LOCALBASE)/include -pthread
|
||||||
|
LDLIBS=-L$(LOCALBASE)/lib -liconv -pthread
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
@ -28,7 +30,7 @@ maddr magrep mdeliver mexport mflag mflow mgenmid mhdr mpick mscan msed mshow \
|
|||||||
maddr magrep mexport mflag mgenmid mhdr mlist mpick mscan msed mseq mshow msort \
|
maddr magrep mexport mflag mgenmid mhdr mlist mpick mscan msed mseq mshow msort \
|
||||||
mthread : seq.o slurp.o
|
mthread : seq.o slurp.o
|
||||||
maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o
|
maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o
|
||||||
magrep mflow mshow : rfc2045.o
|
magrep mflow mhdr mshow : rfc2045.o
|
||||||
mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o
|
mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o
|
||||||
mscan : pipeto.o
|
mscan : pipeto.o
|
||||||
msort : mystrverscmp.o
|
msort : mystrverscmp.o
|
||||||
|
@ -60,7 +60,7 @@ blaze822_date(char *s) {
|
|||||||
while (iswsp(*s))
|
while (iswsp(*s))
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
if (i3("jan")) tm.tm_mon = 0;
|
if (i3("jan")) tm.tm_mon = 0;
|
||||||
else if (i3("feb")) tm.tm_mon = 1;
|
else if (i3("feb")) tm.tm_mon = 1;
|
||||||
else if (i3("mar")) tm.tm_mon = 2;
|
else if (i3("mar")) tm.tm_mon = 2;
|
||||||
else if (i3("apr")) tm.tm_mon = 3;
|
else if (i3("apr")) tm.tm_mon = 3;
|
||||||
@ -151,7 +151,7 @@ blaze822_addr(char *s, char **dispo, char **addro)
|
|||||||
*addr = 0;
|
*addr = 0;
|
||||||
|
|
||||||
while (*s && c < e) {
|
while (*s && c < e) {
|
||||||
startover:
|
startover:
|
||||||
if (*s == '<') {
|
if (*s == '<') {
|
||||||
char *c = addr;
|
char *c = addr;
|
||||||
char *e = addr + sizeof addr;
|
char *e = addr + sizeof addr;
|
||||||
@ -188,7 +188,7 @@ blaze822_addr(char *s, char **dispo, char **addro)
|
|||||||
} else if (*s == '(') { // XXX recurse to conform?
|
} else if (*s == '(') { // XXX recurse to conform?
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
if (!*addr) { // assume: user@host (name)
|
if (!*addr) { // assume: user@host (name)
|
||||||
*c-- = 0;
|
*c-- = 0;
|
||||||
while (c > disp && iswsp(*c))
|
while (c > disp && iswsp(*c))
|
||||||
*c-- = 0;
|
*c-- = 0;
|
||||||
|
8
contrib/mrecode
Executable file
8
contrib/mrecode
Executable file
@ -0,0 +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
|
2
filter.c
2
filter.c
@ -1,7 +1,7 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
2
maddr.c
2
maddr.c
@ -65,7 +65,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "ah:")) != -1)
|
while ((c = getopt(argc, argv, "ah:")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'a': aflag = 1; break;
|
case 'a': aflag = 1; break;
|
||||||
case 'h': hflag = optarg; break;
|
case 'h': hflag = optarg; break;
|
||||||
default:
|
default:
|
||||||
|
6
magrep.c
6
magrep.c
@ -68,7 +68,7 @@ match(char *file, char *hdr, char *s)
|
|||||||
blaze822_mime_action
|
blaze822_mime_action
|
||||||
match_part(int depth, struct message *msg, char *body, size_t bodylen)
|
match_part(int depth, struct message *msg, char *body, size_t bodylen)
|
||||||
{
|
{
|
||||||
(void) depth;
|
(void)depth;
|
||||||
|
|
||||||
char *ct = blaze822_hdr(msg, "content-type");
|
char *ct = blaze822_hdr(msg, "content-type");
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "acdim:opqv")) != -1)
|
while ((c = getopt(argc, argv, "acdim:opqv")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'a': aflag = 1; break;
|
case 'a': aflag = 1; break;
|
||||||
case 'c': cflag = 1; break;
|
case 'c': cflag = 1; break;
|
||||||
case 'd': dflag = 1; break;
|
case 'd': dflag = 1; break;
|
||||||
@ -175,7 +175,7 @@ main(int argc, char *argv[])
|
|||||||
case 'q': qflag = 1; break;
|
case 'q': qflag = 1; break;
|
||||||
case 'v': vflag = 1; break;
|
case 'v': vflag = 1; break;
|
||||||
default:
|
default:
|
||||||
usage:
|
usage:
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: magrep [-c|-o|-p|-q|-m max] [-v] [-i] [-a|-d] header:regex [msgs...]\n");
|
"Usage: magrep [-c|-o|-p|-q|-m max] [-v] [-i] [-a|-d] header:regex [msgs...]\n");
|
||||||
exit(2);
|
exit(2);
|
||||||
|
@ -40,9 +40,9 @@ Only search the colon-separated list of
|
|||||||
.Ar headers
|
.Ar headers
|
||||||
for mail addresses.
|
for mail addresses.
|
||||||
Default:
|
Default:
|
||||||
.Sq Li "from:sender:reply-to:to:cc:bcc:"
|
.Sq Li from\&:sender\&:reply\&-to\&:to\&:cc\&:bcc\&:
|
||||||
and their respective
|
and their respective
|
||||||
.Sq Li "resent-"
|
.Sq Li resent\&-
|
||||||
variants.
|
variants.
|
||||||
.El
|
.El
|
||||||
.Sh EXIT STATUS
|
.Sh EXIT STATUS
|
||||||
|
@ -32,40 +32,40 @@ The following
|
|||||||
are used by
|
are used by
|
||||||
.Xr mblaze 7 :
|
.Xr mblaze 7 :
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Li "Alternate-Mailboxes:"
|
.It Li Alternate\&-Mailboxes\&:
|
||||||
A comma-separated list of mail addresses that belong to you, for
|
A comma-separated list of mail addresses that belong to you, for
|
||||||
.Xr mscan 1
|
.Xr mscan 1
|
||||||
to recognize messages sent by or directly to you.
|
to recognize messages sent by or directly to you.
|
||||||
.It Li "FQDN:"
|
.It Li FQDN\&:
|
||||||
The fully qualified domain name used for
|
The fully qualified domain name used for
|
||||||
.Li "Message-Id:"
|
.Li Message\&-Id\&:
|
||||||
generation in
|
generation in
|
||||||
.Xr mgenmid 1 .
|
.Xr mgenmid 1 .
|
||||||
.It Li "Local-Mailbox:"
|
.It Li Local\&-Mailbox\&:
|
||||||
Your primary mail address, used as the default value for
|
Your primary mail address, used as the default value for
|
||||||
.Li "From:"
|
.Li From\&:
|
||||||
in
|
in
|
||||||
.Xr mcom 1 ,
|
.Xr mcom 1 ,
|
||||||
and in
|
and in
|
||||||
.Xr mscan 1
|
.Xr mscan 1
|
||||||
to recognize messages sent to you.
|
to recognize messages sent to you.
|
||||||
.It Li "Outbox:"
|
.It Li Outbox\&:
|
||||||
If set,
|
If set,
|
||||||
.Xr mcom 1
|
.Xr mcom 1
|
||||||
will create draft messages in this Maildir,
|
will create draft messages in this Maildir,
|
||||||
and save messages there after sending.
|
and save messages there after sending.
|
||||||
.It Li "Scan-Format:"
|
.It Li Scan\&-Format\&:
|
||||||
The default format string for
|
The default format string for
|
||||||
.Xr mscan 1 .
|
.Xr mscan 1 .
|
||||||
.It Li "Sendmail:"
|
.It Li Sendmail\&:
|
||||||
The program that
|
The program that
|
||||||
.Xr mcom 1
|
.Xr mcom 1
|
||||||
will call to send mail.
|
will call to send mail.
|
||||||
(Default:
|
(Default:
|
||||||
.Sq Li sendmail ) .
|
.Sq Li sendmail ) .
|
||||||
.It Li "Sendmail-Args:"
|
.It Li Sendmail\&-Args\&:
|
||||||
Flags to be passed to the
|
Flags to be passed to the
|
||||||
.Li "Sendmail:"
|
.Li Sendmail\&:
|
||||||
program.
|
program.
|
||||||
(Default:
|
(Default:
|
||||||
.Sq Fl t ) .
|
.Sq Fl t ) .
|
||||||
|
@ -37,11 +37,11 @@ and deliver each message,
|
|||||||
decoding it according to the MBOXRD convention.
|
decoding it according to the MBOXRD convention.
|
||||||
.Nm
|
.Nm
|
||||||
will set the mtime according to the value of
|
will set the mtime according to the value of
|
||||||
.Sq Li "Date:"
|
.Sq Li Date\&:
|
||||||
and the Maildir flags according to the value of
|
and the Maildir flags according to the value of
|
||||||
.Sq Li "Status:"
|
.Sq Li Status\&:
|
||||||
or
|
or
|
||||||
.Sq Li "X-Status:" .
|
.Sq Li X-Status\&: .
|
||||||
.Pp
|
.Pp
|
||||||
The messages are delivered in a reliable way and use default
|
The messages are delivered in a reliable way and use default
|
||||||
.Xr umask 2 .
|
.Xr umask 2 .
|
||||||
|
@ -25,11 +25,11 @@ or uses the mails in the current sequence if used interactively.
|
|||||||
.Pp
|
.Pp
|
||||||
.Nm
|
.Nm
|
||||||
uses the
|
uses the
|
||||||
.Sq Li "Return-Path:"
|
.Sq Li Return\&-Path\&:
|
||||||
(or
|
(or
|
||||||
.Sq Li "X-Envelope-To:" )
|
.Sq Li X\&-Envelope\&-To\&: )
|
||||||
and
|
and
|
||||||
.Sq Li "Date:"
|
.Sq Li Date\&:
|
||||||
headers from the message for the mbox
|
headers from the message for the mbox
|
||||||
.Sq Li "From "
|
.Sq Li "From "
|
||||||
line.
|
line.
|
||||||
@ -38,9 +38,9 @@ The options are as follows:
|
|||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Fl S
|
.It Fl S
|
||||||
Add
|
Add
|
||||||
.Sq Li "Status:"
|
.Sq Li Status\&:
|
||||||
and
|
and
|
||||||
.Sq Li "X-Status:"
|
.Sq Li X\&-Status\&:
|
||||||
headers according to the
|
headers according to the
|
||||||
.Ar msgs
|
.Ar msgs
|
||||||
Maildir flags.
|
Maildir flags.
|
||||||
|
18
man/mflow.1
18
man/mflow.1
@ -1,4 +1,4 @@
|
|||||||
.Dd July 26, 2017
|
.Dd September 6, 2017
|
||||||
.Dt MFLOW 1
|
.Dt MFLOW 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -6,6 +6,9 @@
|
|||||||
.Nd reflow format=flowed plain text mails
|
.Nd reflow format=flowed plain text mails
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
|
.Op Fl f
|
||||||
|
.Op Fl q
|
||||||
|
.Op Fl w Ar width
|
||||||
\&<
|
\&<
|
||||||
.Ar file
|
.Ar file
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
@ -31,6 +34,19 @@ If defined,
|
|||||||
the environment variable
|
the environment variable
|
||||||
.Ev MAXCOLUMNS
|
.Ev MAXCOLUMNS
|
||||||
specifies the maximum line length.
|
specifies the maximum line length.
|
||||||
|
.Pp
|
||||||
|
The options are as follows:
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Fl f
|
||||||
|
Force line wrapping of long lines.
|
||||||
|
.It Fl q
|
||||||
|
Prefix lines with
|
||||||
|
.Sq Li \&< .
|
||||||
|
Can be used multiple times.
|
||||||
|
.It Fl w Ar width
|
||||||
|
Set maximum line length to
|
||||||
|
.Ar width .
|
||||||
|
.El
|
||||||
.Sh EXIT STATUS
|
.Sh EXIT STATUS
|
||||||
.Ex -std
|
.Ex -std
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
|
@ -17,7 +17,7 @@ The fully qualified domain name is computed by:
|
|||||||
.Bl -enum
|
.Bl -enum
|
||||||
.It
|
.It
|
||||||
Using
|
Using
|
||||||
.Sq Li "FQDN:"
|
.Sq Li FQDN\&:
|
||||||
from
|
from
|
||||||
.Pa "${MBLAZE:-$HOME/.mblaze}/profile"
|
.Pa "${MBLAZE:-$HOME/.mblaze}/profile"
|
||||||
(if set).
|
(if set).
|
||||||
@ -25,7 +25,7 @@ from
|
|||||||
Resolving the current hostname.
|
Resolving the current hostname.
|
||||||
.It
|
.It
|
||||||
Using the host part of the address in
|
Using the host part of the address in
|
||||||
.Sq Li "Local-Mailbox:"
|
.Sq Li Local\&-Mailbox\&:
|
||||||
from
|
from
|
||||||
.Pa "${MBLAZE:-$HOME/.mblaze}/profile"
|
.Pa "${MBLAZE:-$HOME/.mblaze}/profile"
|
||||||
(if set).
|
(if set).
|
||||||
|
13
man/mhdr.1
13
man/mhdr.1
@ -6,7 +6,7 @@
|
|||||||
.Nd show mail headers
|
.Nd show mail headers
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl h Ar header
|
.Op Fl h Ar header Op Fl p Ar parameter
|
||||||
.Op Fl d
|
.Op Fl d
|
||||||
.Op Fl H
|
.Op Fl H
|
||||||
.Op Fl M
|
.Op Fl M
|
||||||
@ -31,6 +31,10 @@ The options are as follows:
|
|||||||
.It Fl h Ar header
|
.It Fl h Ar header
|
||||||
Only print the values of the headers in the colon-separated list
|
Only print the values of the headers in the colon-separated list
|
||||||
.Ar header .
|
.Ar header .
|
||||||
|
.It Fl p Ar parameter
|
||||||
|
Extract a particular RFC 2045
|
||||||
|
.Ar parameter
|
||||||
|
from the specified headers.
|
||||||
.It Fl d
|
.It Fl d
|
||||||
Decode the headers according to RFC 2047.
|
Decode the headers according to RFC 2047.
|
||||||
.It Fl H
|
.It Fl H
|
||||||
@ -55,6 +59,13 @@ and >1 if an error occurs.
|
|||||||
.Rs
|
.Rs
|
||||||
.%A N. Freed
|
.%A N. Freed
|
||||||
.%A N. Borenstein
|
.%A N. Borenstein
|
||||||
|
.%D November 1996
|
||||||
|
.%R RFC 2045
|
||||||
|
.%T Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies
|
||||||
|
.Re
|
||||||
|
.Rs
|
||||||
|
.%A N. Freed
|
||||||
|
.%A N. Borenstein
|
||||||
.%B MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text
|
.%B MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text
|
||||||
.%R RFC 2047
|
.%R RFC 2047
|
||||||
.%D November 1996
|
.%D November 1996
|
||||||
|
@ -72,8 +72,9 @@ Don't list messages in
|
|||||||
Don't list messages in
|
Don't list messages in
|
||||||
.Pa new .
|
.Pa new .
|
||||||
.It Fl i
|
.It Fl i
|
||||||
Don't print filenames. Instead, print a one-line summary for each
|
Don't print filenames.
|
||||||
folder, showing the number of unseen, flagged and total messages,
|
Instead, print a one-line summary for each folder,
|
||||||
|
showing the number of unseen, flagged and total messages,
|
||||||
along with the folder name.
|
along with the folder name.
|
||||||
.Pp
|
.Pp
|
||||||
If two or more folders are specified, a total will also be printed.
|
If two or more folders are specified, a total will also be printed.
|
||||||
|
@ -49,6 +49,8 @@ Defaults to
|
|||||||
.Sh EXIT STATUS
|
.Sh EXIT STATUS
|
||||||
.Ex -std
|
.Ex -std
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
|
.Xr makemime 1 ,
|
||||||
|
.Xr mhbuild 1
|
||||||
.Rs
|
.Rs
|
||||||
.%A N. Freed
|
.%A N. Freed
|
||||||
.%A N. Borenstein
|
.%A N. Borenstein
|
||||||
|
@ -74,7 +74,7 @@ Deleted messages.
|
|||||||
New messages.
|
New messages.
|
||||||
.It Cm o
|
.It Cm o
|
||||||
Old messages.
|
Old messages.
|
||||||
.It Cm r, Cm S
|
.It Cm r , Cm S
|
||||||
Read messages.
|
Read messages.
|
||||||
.It Cm u
|
.It Cm u
|
||||||
Unread messages.
|
Unread messages.
|
||||||
|
22
man/mscan.1
22
man/mscan.1
@ -94,9 +94,9 @@ is greater or equal to 19,
|
|||||||
seconds will also be shown.
|
seconds will also be shown.
|
||||||
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "f"
|
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "f"
|
||||||
The
|
The
|
||||||
.Sq Li From:
|
.Sq Li From\&:
|
||||||
(or
|
(or
|
||||||
.Sq Li To: ,
|
.Sq Li To\&: ,
|
||||||
if the message is from us).
|
if the message is from us).
|
||||||
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "F"
|
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "F"
|
||||||
The Maildir folder the message resides in.
|
The Maildir folder the message resides in.
|
||||||
@ -106,7 +106,7 @@ The Maildir folder the message resides in.
|
|||||||
spaces per indentation depth in the thread tree.
|
spaces per indentation depth in the thread tree.
|
||||||
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "I"
|
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "I"
|
||||||
The
|
The
|
||||||
.Sq Li "Message-ID:"
|
.Sq Li Message\&-ID\&:
|
||||||
of the message.
|
of the message.
|
||||||
.It Cm "%M"
|
.It Cm "%M"
|
||||||
The raw Maildir flags of the message.
|
The raw Maildir flags of the message.
|
||||||
@ -125,22 +125,22 @@ The subject of the message (defaults to remaining width).
|
|||||||
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "S"
|
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "S"
|
||||||
The subject of the message (defaults to remaining width),
|
The subject of the message (defaults to remaining width),
|
||||||
with leading
|
with leading
|
||||||
.Sq Li "Re:" ,
|
.Sq Li Re\&: ,
|
||||||
.Sq Li "Fwd:"
|
.Sq Li Fwd\&:
|
||||||
etc. stripped.
|
etc. stripped.
|
||||||
.It Cm "%t"
|
.It Cm "%t"
|
||||||
A
|
A
|
||||||
.Sq Li \&>
|
.Sq Li \&>
|
||||||
if you are in
|
if you are in
|
||||||
.Sq Li "To:" ,
|
.Sq Li To\&: ,
|
||||||
a
|
a
|
||||||
.Sq Li \&+
|
.Sq Li \&+
|
||||||
if you are in
|
if you are in
|
||||||
.Sq Li "Cc:" ,
|
.Sq Li Cc\&: ,
|
||||||
a
|
a
|
||||||
.Sq Li \&:
|
.Sq Li \&:
|
||||||
if you are in
|
if you are in
|
||||||
.Sq Li "Resent-To:" ,
|
.Sq Li Resent\&-To\&: ,
|
||||||
or a blank.
|
or a blank.
|
||||||
.It Cm "%u"
|
.It Cm "%u"
|
||||||
An
|
An
|
||||||
@ -169,13 +169,13 @@ A replied-to message
|
|||||||
.Bl -tag -width 2n -compact
|
.Bl -tag -width 2n -compact
|
||||||
.It Li \&>
|
.It Li \&>
|
||||||
You are in
|
You are in
|
||||||
.Sq Li "To:" .
|
.Sq Li To\&: .
|
||||||
.It Li \&+
|
.It Li \&+
|
||||||
You are in
|
You are in
|
||||||
.Sq Li "Cc:" .
|
.Sq Li Cc\:& .
|
||||||
.It Li \&:
|
.It Li \&:
|
||||||
You are in
|
You are in
|
||||||
.Sq Li "Resent-To:" .
|
.Sq Li Resent\&-To\&: .
|
||||||
.El
|
.El
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
.Bl -tag -width MBLAZE_PAGER
|
.Bl -tag -width MBLAZE_PAGER
|
||||||
|
@ -71,10 +71,10 @@ will delete all headers starting with
|
|||||||
and
|
and
|
||||||
.Sq Li "/from:to:cc/d"
|
.Sq Li "/from:to:cc/d"
|
||||||
will delete the headers
|
will delete the headers
|
||||||
.Sq Li "From:" ,
|
.Sq Li From\&: ,
|
||||||
.Sq Li "To:" ,
|
.Sq Li To\&: ,
|
||||||
and
|
and
|
||||||
.Sq Li "Cc:" .
|
.Sq Li Cc\&: .
|
||||||
.It Oo Cm \&/ Ns Ar headers Ns Cm \&/ Oc Ns Ic s Ns Cm \&/ Ns Ar regex Ns Cm \&/ Ns Ar replacement Ns Cm \&/ Ns Op Ar flags
|
.It Oo Cm \&/ Ns Ar headers Ns Cm \&/ Oc Ns Ic s Ns Cm \&/ Ns Ar regex Ns Cm \&/ Ns Ar replacement Ns Cm \&/ Ns Op Ar flags
|
||||||
Substitute matches of the POSIX Basic Regular Expression
|
Substitute matches of the POSIX Basic Regular Expression
|
||||||
.Ar regex
|
.Ar regex
|
||||||
|
@ -39,7 +39,7 @@ The options are as follows:
|
|||||||
Display the headers in the colon-separated list
|
Display the headers in the colon-separated list
|
||||||
.Ar headers ,
|
.Ar headers ,
|
||||||
instead of the default headers
|
instead of the default headers
|
||||||
.Sq Li from:subject:to:cc:date:reply-to: .
|
.Sq Li from\&:subject\&:to\&:cc\&:date\&:reply\&-to\&: .
|
||||||
.It Fl A Ar mimetypes
|
.It Fl A Ar mimetypes
|
||||||
Define
|
Define
|
||||||
.Sq Li "mixed/alternative"
|
.Sq Li "mixed/alternative"
|
||||||
|
@ -28,14 +28,14 @@ The options are as follows:
|
|||||||
Reverse order.
|
Reverse order.
|
||||||
.It Fl f
|
.It Fl f
|
||||||
Sort by
|
Sort by
|
||||||
.Sq Li From: .
|
.Sq Li From\&: .
|
||||||
.It Fl d
|
.It Fl d
|
||||||
Sort by date.
|
Sort by date.
|
||||||
.It Fl s
|
.It Fl s
|
||||||
Sort by
|
Sort by
|
||||||
.Sq Li Subject\&:
|
.Sq Li Subject\&:
|
||||||
(modulo various variants of
|
(modulo various variants of
|
||||||
.Sq Li Re: ) .
|
.Sq Li Re\&: ) .
|
||||||
.It Fl F
|
.It Fl F
|
||||||
Sort by filename, using proper order for numbers in filenames.
|
Sort by filename, using proper order for numbers in filenames.
|
||||||
.It Fl M
|
.It Fl M
|
||||||
|
@ -152,7 +152,7 @@ tryagain:
|
|||||||
int i, j;
|
int i, j;
|
||||||
for (i = sizeof statusflags - 1; i >= 0; i--)
|
for (i = sizeof statusflags - 1; i >= 0; i--)
|
||||||
if (!statusflags[i])
|
if (!statusflags[i])
|
||||||
for (j = i+1; j < (int) sizeof statusflags; j++)
|
for (j = i+1; j < (int)sizeof statusflags; j++)
|
||||||
statusflags[j-1] = statusflags[j];
|
statusflags[j-1] = statusflags[j];
|
||||||
|
|
||||||
if (Mflag) {
|
if (Mflag) {
|
||||||
@ -173,8 +173,8 @@ tryagain:
|
|||||||
}
|
}
|
||||||
|
|
||||||
snprintf(dst, sizeof dst, "%s/%s/%s:2,%s",
|
snprintf(dst, sizeof dst, "%s/%s/%s:2,%s",
|
||||||
targetdir, (cflag || is_old) ? "cur" : "new", id,
|
targetdir, (cflag || is_old) ? "cur" : "new", id,
|
||||||
Xflag ? Xflag : statusflags);
|
Xflag ? Xflag : statusflags);
|
||||||
if (rename(tmp, dst) != 0)
|
if (rename(tmp, dst) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "cMvX:")) != -1)
|
while ((c = getopt(argc, argv, "cMvX:")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'c': cflag = 1; break;
|
case 'c': cflag = 1; break;
|
||||||
case 'M': Mflag = 1; break;
|
case 'M': Mflag = 1; break;
|
||||||
case 'v': vflag = 1; break;
|
case 'v': vflag = 1; break;
|
||||||
|
4
mdirs.c
4
mdirs.c
@ -72,9 +72,9 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c, i;
|
int c, i;
|
||||||
while ((c = getopt(argc, argv, "")) != -1)
|
while ((c = getopt(argc, argv, "")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
default:
|
default:
|
||||||
usage:
|
usage:
|
||||||
fprintf(stderr, "Usage: mdirs dirs...\n");
|
fprintf(stderr, "Usage: mdirs dirs...\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ export(char *file)
|
|||||||
if (e) {
|
if (e) {
|
||||||
s++;
|
s++;
|
||||||
snprintf(from, sizeof from, "%.*s",
|
snprintf(from, sizeof from, "%.*s",
|
||||||
(int)(e-s), s);
|
(int)(e-s), s);
|
||||||
}
|
}
|
||||||
} else { // return-path without <>
|
} else { // return-path without <>
|
||||||
snprintf(from, sizeof from, "%s", v);
|
snprintf(from, sizeof from, "%s", v);
|
||||||
@ -132,7 +132,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "S")) != -1)
|
while ((c = getopt(argc, argv, "S")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'S': Sflag = 1; break;
|
case 'S': Sflag = 1; break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Usage: mexport [-S] [msgs...]\n");
|
fprintf(stderr, "Usage: mexport [-S] [msgs...]\n");
|
||||||
|
7
mflag.c
7
mflag.c
@ -110,7 +110,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "PRSTDFprstdfX:x:v")) != -1)
|
while ((c = getopt(argc, argv, "PRSTDFprstdfX:x:v")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'P': case 'R': case 'S': case 'T': case 'D': case 'F':
|
case 'P': case 'R': case 'S': case 'T': case 'D': case 'F':
|
||||||
flags[(unsigned int)c] = 1;
|
flags[(unsigned int)c] = 1;
|
||||||
break;
|
break;
|
||||||
@ -142,6 +142,11 @@ main(int argc, char *argv[])
|
|||||||
curfile = blaze822_seq_cur();
|
curfile = blaze822_seq_cur();
|
||||||
|
|
||||||
if (vflag) {
|
if (vflag) {
|
||||||
|
if (argc == optind && !isatty(0)) {
|
||||||
|
blaze822_loop(0, 0, flag); // read from stdin
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
args = calloc(sizeof (char *), argsalloc);
|
args = calloc(sizeof (char *), argsalloc);
|
||||||
if (!args)
|
if (!args)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
48
mflow.c
48
mflow.c
@ -32,7 +32,7 @@ fixed(int quotes, char *line, size_t linelen)
|
|||||||
{
|
{
|
||||||
chgquote(quotes);
|
chgquote(quotes);
|
||||||
|
|
||||||
if (linelen > (size_t)(maxcolumn - column)) {
|
if (column && linelen > (size_t)(maxcolumn - column)) {
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
column = 0;
|
column = 0;
|
||||||
}
|
}
|
||||||
@ -75,7 +75,8 @@ flowed(int quotes, char *line, ssize_t linelen)
|
|||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (column + (eow - line) > maxcolumn) {
|
if (column + (eow - line) > maxcolumn &&
|
||||||
|
eow - line < maxcolumn) {
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
column = 0;
|
column = 0;
|
||||||
if (*line == ' ') {
|
if (*line == ' ') {
|
||||||
@ -92,23 +93,26 @@ flowed(int quotes, char *line, ssize_t linelen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *linebuf = 0;
|
char *linebuf = 0;
|
||||||
char *line;
|
char *line;
|
||||||
size_t linelen = 0;
|
size_t linelen = 0;
|
||||||
int quotes = 0;
|
int outer_quotes = 0;
|
||||||
|
int quotes;
|
||||||
|
|
||||||
int reflow = 1; // re-evaluated on $PIPE_CONTENTTYPE
|
int reflow = 1; // re-evaluated on $PIPE_CONTENTTYPE
|
||||||
|
int force = 0;
|
||||||
int delsp = 0;
|
int delsp = 0;
|
||||||
|
|
||||||
char *ct = getenv("PIPE_CONTENTTYPE");
|
char *ct = getenv("PIPE_CONTENTTYPE");
|
||||||
if (ct) {
|
if (ct) {
|
||||||
char *s, *se;
|
char *s, *se;
|
||||||
blaze822_mime_parameter(ct, "format", &s, &se);
|
reflow = 0;
|
||||||
reflow = s && (strncasecmp(s, "flowed", 6) == 0);
|
if (blaze822_mime_parameter(ct, "format", &s, &se) && s)
|
||||||
blaze822_mime_parameter(ct, "delsp", &s, &se);
|
reflow = (strncasecmp(s, "flowed", 6) == 0);
|
||||||
delsp = s && (strncasecmp(s, "yes", 3) == 0);
|
if (blaze822_mime_parameter(ct, "delsp", &s, &se) && s)
|
||||||
|
delsp = (strncasecmp(s, "yes", 3) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *cols = getenv("COLUMNS");
|
char *cols = getenv("COLUMNS");
|
||||||
@ -131,6 +135,17 @@ main()
|
|||||||
maxcolumn = m;
|
maxcolumn = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int c;
|
||||||
|
while ((c = getopt(argc, argv, "fqw:")) != -1)
|
||||||
|
switch (c) {
|
||||||
|
case 'f': force = 1; break;
|
||||||
|
case 'q': outer_quotes++; break;
|
||||||
|
case 'w': maxcolumn = atoi(optarg); break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "Usage: mflow [-f] [-q] [-w MAXCOLUMNS]\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
ssize_t rd = getdelim(&linebuf, &linelen, '\n', stdin);
|
ssize_t rd = getdelim(&linebuf, &linelen, '\n', stdin);
|
||||||
@ -144,24 +159,24 @@ main()
|
|||||||
|
|
||||||
line = linebuf;
|
line = linebuf;
|
||||||
|
|
||||||
if (!reflow) {
|
if (!reflow && !force) {
|
||||||
fwrite(line, 1, rd, stdout);
|
fwrite(line, 1, rd, stdout);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rd > 0 && line[rd-1] == '\n')
|
if (rd > 0 && line[rd-1] == '\n')
|
||||||
line[--rd] = 0;
|
line[--rd] = 0;
|
||||||
if (rd > 0 && line[rd-1] == '\r')
|
if (rd > 0 && line[rd-1] == '\r')
|
||||||
line[--rd] = 0;
|
line[--rd] = 0;
|
||||||
|
|
||||||
quotes = 0;
|
quotes = outer_quotes;
|
||||||
while (*line == '>') { // measure quote depth
|
while (*line == '>') { // measure quote depth
|
||||||
line++;
|
line++;
|
||||||
quotes++;
|
quotes++;
|
||||||
rd--;
|
rd--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*line == ' ') { // space stuffing
|
if (reflow && *line == ' ') { // space stuffing
|
||||||
line++;
|
line++;
|
||||||
rd--;
|
rd--;
|
||||||
}
|
}
|
||||||
@ -178,7 +193,12 @@ main()
|
|||||||
line[--rd] = 0;
|
line[--rd] = 0;
|
||||||
flowed(quotes, line, rd);
|
flowed(quotes, line, rd);
|
||||||
} else {
|
} else {
|
||||||
fixed(quotes, line, rd);
|
if (force && rd > maxcolumn) {
|
||||||
|
flowed(quotes, line, rd);
|
||||||
|
fixed(quotes, "", 0);
|
||||||
|
} else {
|
||||||
|
fixed(quotes, line, rd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,10 @@ printb36(uint64_t x)
|
|||||||
|
|
||||||
char outbuf[16];
|
char outbuf[16];
|
||||||
char *o = outbuf + sizeof outbuf;
|
char *o = outbuf + sizeof outbuf;
|
||||||
*o = 0;
|
|
||||||
|
|
||||||
|
*--o = 0;
|
||||||
do { *--o = base36[x % 36]; } while (x /= 36);
|
do { *--o = base36[x % 36]; } while (x /= 36);
|
||||||
|
|
||||||
fputs(o, stdout);
|
fputs(o, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,8 +47,8 @@ int main()
|
|||||||
hostbuf[sizeof hostbuf - 1] = 0;
|
hostbuf[sizeof hostbuf - 1] = 0;
|
||||||
|
|
||||||
struct addrinfo hints = { .ai_family = AF_UNSPEC,
|
struct addrinfo hints = { .ai_family = AF_UNSPEC,
|
||||||
.ai_socktype = SOCK_STREAM,
|
.ai_socktype = SOCK_STREAM,
|
||||||
.ai_flags = AI_CANONNAME };
|
.ai_flags = AI_CANONNAME };
|
||||||
struct addrinfo *info;
|
struct addrinfo *info;
|
||||||
if (getaddrinfo(hostbuf, 0, &hints, &info) == 0) {
|
if (getaddrinfo(hostbuf, 0, &hints, &info) == 0) {
|
||||||
// sanity checks: no (null), at least one dot,
|
// sanity checks: no (null), at least one dot,
|
||||||
|
18
mhdr.c
18
mhdr.c
@ -13,6 +13,7 @@
|
|||||||
#include "blaze822.h"
|
#include "blaze822.h"
|
||||||
|
|
||||||
static char *hflag;
|
static char *hflag;
|
||||||
|
static char *pflag;
|
||||||
static int Aflag;
|
static int Aflag;
|
||||||
static int Dflag;
|
static int Dflag;
|
||||||
static int Hflag;
|
static int Hflag;
|
||||||
@ -101,6 +102,16 @@ print_decode_header(char *s)
|
|||||||
void
|
void
|
||||||
print_header(char *v)
|
print_header(char *v)
|
||||||
{
|
{
|
||||||
|
if (pflag) {
|
||||||
|
char *s, *se;
|
||||||
|
if (blaze822_mime_parameter(v, pflag, &s, &se)) {
|
||||||
|
*se = 0;
|
||||||
|
v = s;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
status = 0;
|
status = 0;
|
||||||
|
|
||||||
if (Hflag && !Aflag)
|
if (Hflag && !Aflag)
|
||||||
@ -189,9 +200,10 @@ int
|
|||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "h:ADHMd")) != -1)
|
while ((c = getopt(argc, argv, "h:p:ADHMd")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'h': hflag = optarg; break;
|
case 'h': hflag = optarg; break;
|
||||||
|
case 'p': pflag = optarg; break;
|
||||||
case 'A': Aflag = 1; break;
|
case 'A': Aflag = 1; break;
|
||||||
case 'D': Dflag = 1; break;
|
case 'D': Dflag = 1; break;
|
||||||
case 'H': Hflag = 1; break;
|
case 'H': Hflag = 1; break;
|
||||||
@ -199,7 +211,7 @@ main(int argc, char *argv[])
|
|||||||
case 'd': dflag = 1; break;
|
case 'd': dflag = 1; break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: mhdr [-h header] [-d] [-H] [-M] [-A|-D] [msgs...]\n");
|
"Usage: mhdr [-h header [-p parameter]] [-d] [-H] [-M] [-A|-D] [msgs...]\n");
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
minc.c
4
minc.c
@ -66,10 +66,10 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c, i;
|
int c, i;
|
||||||
while ((c = getopt(argc, argv, "q")) != -1)
|
while ((c = getopt(argc, argv, "q")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'q': qflag = 1; break;
|
case 'q': qflag = 1; break;
|
||||||
default:
|
default:
|
||||||
usage:
|
usage:
|
||||||
fprintf(stderr, "Usage: minc [-q] dirs...\n");
|
fprintf(stderr, "Usage: minc [-q] dirs...\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
14
mlist.c
14
mlist.c
@ -99,11 +99,11 @@ list(char *prefix, char *file)
|
|||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
struct linux_dirent64 {
|
struct linux_dirent64 {
|
||||||
ino64_t d_ino; /* 64-bit inode number */
|
ino64_t d_ino; /* 64-bit inode number */
|
||||||
off64_t d_off; /* 64-bit offset to next structure */
|
off64_t d_off; /* 64-bit offset to next structure */
|
||||||
unsigned short d_reclen; /* Size of this dirent */
|
unsigned short d_reclen; /* Size of this dirent */
|
||||||
unsigned char d_type; /* File type */
|
unsigned char d_type; /* File type */
|
||||||
char d_name[]; /* Filename (null-terminated) */
|
char d_name[]; /* Filename (null-terminated) */
|
||||||
};
|
};
|
||||||
#define BUF_SIZE 1024000
|
#define BUF_SIZE 1024000
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ listdir(char *dir)
|
|||||||
if (nread == 0)
|
if (nread == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (bpos = 0; bpos < nread;) {
|
for (bpos = 0; bpos < nread; ) {
|
||||||
d = (struct linux_dirent64 *)(buf + bpos);
|
d = (struct linux_dirent64 *)(buf + bpos);
|
||||||
if (d->d_type != DT_REG && d->d_type != DT_UNKNOWN)
|
if (d->d_type != DT_REG && d->d_type != DT_UNKNOWN)
|
||||||
goto next;
|
goto next;
|
||||||
@ -225,7 +225,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "PRSTDFprstdfX:x:NnCci")) != -1)
|
while ((c = getopt(argc, argv, "PRSTDFprstdfX:x:NnCci")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'P': case 'R': case 'S': case 'T': case 'D': case 'F':
|
case 'P': case 'R': case 'S': case 'T': case 'D': case 'F':
|
||||||
flags[(unsigned int)c] = 1;
|
flags[(unsigned int)c] = 1;
|
||||||
break;
|
break;
|
||||||
@ -246,7 +246,7 @@ main(int argc, char *argv[])
|
|||||||
case 'c': Cflag = -1; break;
|
case 'c': Cflag = -1; break;
|
||||||
case 'i': iflag = 1; break;
|
case 'i': iflag = 1; break;
|
||||||
default:
|
default:
|
||||||
usage:
|
usage:
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: mlist [-DFPRST] [-X str]\n"
|
"Usage: mlist [-DFPRST] [-X str]\n"
|
||||||
" [-dfprst] [-x str]\n"
|
" [-dfprst] [-x str]\n"
|
||||||
|
12
mmime.c
12
mmime.c
@ -135,7 +135,7 @@ gen_attachment(const char *filename, char *content_disposition)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (s = (char *) filename; *s; s++) {
|
for (s = (char *)filename; *s; s++) {
|
||||||
if (*s < 32 || *s == '"' || *s >= 127 || s - filename > 35)
|
if (*s < 32 || *s == '"' || *s >= 127 || s - filename > 35)
|
||||||
goto rfc2231;
|
goto rfc2231;
|
||||||
if (strchr(" ()<>@,;:\\/[]?=", *s))
|
if (strchr(" ()<>@,;:\\/[]?=", *s))
|
||||||
@ -162,9 +162,9 @@ rfc2231:
|
|||||||
}
|
}
|
||||||
while (*s && i < 78 - 3) {
|
while (*s && i < 78 - 3) {
|
||||||
if (*s <= 32 || *s == '"' || *s > 126)
|
if (*s <= 32 || *s == '"' || *s > 126)
|
||||||
i += printf("%%%02x", (uint8_t) *s++);
|
i += printf("%%%02x", (uint8_t)*s++);
|
||||||
else
|
else
|
||||||
i += printf("%c", (uint8_t) *s++);
|
i += printf("%c", (uint8_t)*s++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ print_header(char *line) {
|
|||||||
while (*e && *e == ' ')
|
while (*e && *e == ' ')
|
||||||
e++;
|
e++;
|
||||||
for (; *e && *e != ' '; e++) {
|
for (; *e && *e != ' '; e++) {
|
||||||
if ((uint8_t) *e >= 127)
|
if ((uint8_t)*e >= 127)
|
||||||
highbit++;
|
highbit++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,12 +471,12 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "crt:")) != -1)
|
while ((c = getopt(argc, argv, "crt:")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'r': rflag = 1; break;
|
case 'r': rflag = 1; break;
|
||||||
case 'c': cflag = 1; break;
|
case 'c': cflag = 1; break;
|
||||||
case 't': tflag = optarg; break;
|
case 't': tflag = optarg; break;
|
||||||
default:
|
default:
|
||||||
usage:
|
usage:
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: mmime [-c|-r] [-t CONTENT-TYPE] < message\n");
|
"Usage: mmime [-c|-r] [-t CONTENT-TYPE] < message\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
26
mpick.c
26
mpick.c
@ -29,17 +29,17 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <regex.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <locale.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <regex.h>
|
|
||||||
|
|
||||||
#include "blaze822.h"
|
#include "blaze822.h"
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ static int prune;
|
|||||||
static void
|
static void
|
||||||
ws()
|
ws()
|
||||||
{
|
{
|
||||||
while (isspace((unsigned char) *pos))
|
while (isspace((unsigned char)*pos))
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ parse_string(char **s)
|
|||||||
char t;
|
char t;
|
||||||
char *e = ++pos;
|
char *e = ++pos;
|
||||||
|
|
||||||
while (isalnum((unsigned char) *pos) || *pos == '_')
|
while (isalnum((unsigned char)*pos) || *pos == '_')
|
||||||
pos++;
|
pos++;
|
||||||
if (e == pos)
|
if (e == pos)
|
||||||
parse_error("invalid environment variable name");
|
parse_error("invalid environment variable name");
|
||||||
@ -407,12 +407,12 @@ static int64_t
|
|||||||
parse_num(int64_t *r)
|
parse_num(int64_t *r)
|
||||||
{
|
{
|
||||||
char *s = pos;
|
char *s = pos;
|
||||||
if (isdigit((unsigned char) *pos)) {
|
if (isdigit((unsigned char)*pos)) {
|
||||||
int64_t n;
|
int64_t n;
|
||||||
|
|
||||||
for (n = 0; isdigit((unsigned char) *pos) && n <= INT64_MAX / 10 - 10; pos++)
|
for (n = 0; isdigit((unsigned char)*pos) && n <= INT64_MAX / 10 - 10; pos++)
|
||||||
n = 10 * n + (*pos - '0');
|
n = 10 * n + (*pos - '0');
|
||||||
if (isdigit((unsigned char) *pos))
|
if (isdigit((unsigned char)*pos))
|
||||||
parse_error("number too big: %s", s);
|
parse_error("number too big: %s", s);
|
||||||
if (token("c")) ;
|
if (token("c")) ;
|
||||||
else if (token("b")) n *= 512LL;
|
else if (token("b")) n *= 512LL;
|
||||||
@ -499,7 +499,7 @@ parse_cmp()
|
|||||||
e->a.prop = prop;
|
e->a.prop = prop;
|
||||||
e->b.num = n;
|
e->b.num = n;
|
||||||
return e;
|
return e;
|
||||||
} else if(token("cur")) {
|
} else if (token("cur")) {
|
||||||
struct expr *e = mkexpr(op);
|
struct expr *e = mkexpr(op);
|
||||||
e->a.prop = prop;
|
e->a.prop = prop;
|
||||||
e->b.var = VAR_CUR;
|
e->b.var = VAR_CUR;
|
||||||
@ -905,7 +905,7 @@ eval(struct expr *e, struct mailinfo *m)
|
|||||||
case EXPR_REGEX:
|
case EXPR_REGEX:
|
||||||
case EXPR_REGEXI: {
|
case EXPR_REGEXI: {
|
||||||
const char *s = "";
|
const char *s = "";
|
||||||
switch(e->a.prop) {
|
switch (e->a.prop) {
|
||||||
case PROP_PATH: s = m->fpath; break;
|
case PROP_PATH: s = m->fpath; break;
|
||||||
case PROP_FROM: s = msg_addr(m, "from", e->extra); break;
|
case PROP_FROM: s = msg_addr(m, "from", e->extra); break;
|
||||||
case PROP_TO: s = msg_addr(m, "to", e->extra); break;
|
case PROP_TO: s = msg_addr(m, "to", e->extra); break;
|
||||||
@ -951,7 +951,7 @@ mailfile(char *file)
|
|||||||
m->sb = 0;
|
m->sb = 0;
|
||||||
m->msg = 0;
|
m->msg = 0;
|
||||||
|
|
||||||
while (*m->fpath == ' ' || *m->fpath== '\t') {
|
while (*m->fpath == ' ' || *m->fpath == '\t') {
|
||||||
m->depth++;
|
m->depth++;
|
||||||
m->fpath++;
|
m->fpath++;
|
||||||
}
|
}
|
||||||
@ -1079,7 +1079,7 @@ collect(char *file)
|
|||||||
} else if (thr->cur->m->depth > m->depth) {
|
} else if (thr->cur->m->depth > m->depth) {
|
||||||
/* find parent mail */
|
/* find parent mail */
|
||||||
struct mlist *pl;
|
struct mlist *pl;
|
||||||
for (pl = thr->cur; pl->m->depth >= m->depth; pl--);
|
for (pl = thr->cur; pl->m->depth >= m->depth; pl--) ;
|
||||||
ml->parent = pl;
|
ml->parent = pl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
mquote
2
mquote
@ -7,6 +7,6 @@
|
|||||||
|
|
||||||
printf '%s wrote:\n' "$from"
|
printf '%s wrote:\n' "$from"
|
||||||
mshow -R "$1" |
|
mshow -R "$1" |
|
||||||
sed -n '/^-- $/!p;//q' | # strip signature
|
sed -n '/^-- $/,$!p' | # strip signature
|
||||||
sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | # strip empty lines
|
sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | # strip empty lines
|
||||||
sed 's/^/> /' # prefix with >
|
sed 's/^/> /' # prefix with >
|
||||||
|
10
mscan.c
10
mscan.c
@ -9,6 +9,7 @@
|
|||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <locale.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -16,7 +17,6 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <locale.h>
|
|
||||||
|
|
||||||
#include "blaze822.h"
|
#include "blaze822.h"
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "If:n")) != -1)
|
while ((c = getopt(argc, argv, "If:n")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'I': Iflag++; break;
|
case 'I': Iflag++; break;
|
||||||
case 'f': fflag = optarg; break;
|
case 'f': fflag = optarg; break;
|
||||||
case 'n': nflag = 1; break;
|
case 'n': nflag = 1; break;
|
||||||
@ -517,7 +517,7 @@ main(int argc, char *argv[])
|
|||||||
struct tm *tm = localtime(&now);
|
struct tm *tm = localtime(&now);
|
||||||
curyear = tm->tm_year;
|
curyear = tm->tm_year;
|
||||||
|
|
||||||
setlocale(LC_ALL, ""); // for wcwidth later
|
setlocale(LC_ALL, ""); // for wcwidth later
|
||||||
if (wcwidth(0xfffd) > 0)
|
if (wcwidth(0xfffd) > 0)
|
||||||
replacement = 0xfffd;
|
replacement = 0xfffd;
|
||||||
|
|
||||||
@ -549,12 +549,12 @@ main(int argc, char *argv[])
|
|||||||
char *v, *d, *a;
|
char *v, *d, *a;
|
||||||
if ((v = blaze822_hdr(config, "local-mailbox")))
|
if ((v = blaze822_hdr(config, "local-mailbox")))
|
||||||
while (alias_idx < (int)(sizeof aliases / sizeof aliases[0]) &&
|
while (alias_idx < (int)(sizeof aliases / sizeof aliases[0]) &&
|
||||||
(v = blaze822_addr(v, &d, &a)))
|
(v = blaze822_addr(v, &d, &a)))
|
||||||
if (a)
|
if (a)
|
||||||
aliases[alias_idx++] = strdup(a);
|
aliases[alias_idx++] = strdup(a);
|
||||||
if ((v = blaze822_hdr(config, "alternate-mailboxes")))
|
if ((v = blaze822_hdr(config, "alternate-mailboxes")))
|
||||||
while (alias_idx < (int)(sizeof aliases / sizeof aliases[0]) &&
|
while (alias_idx < (int)(sizeof aliases / sizeof aliases[0]) &&
|
||||||
(v = blaze822_addr(v, &d, &a)))
|
(v = blaze822_addr(v, &d, &a)))
|
||||||
if (a)
|
if (a)
|
||||||
aliases[alias_idx++] = strdup(a);
|
aliases[alias_idx++] = strdup(a);
|
||||||
if ((v = blaze822_hdr(config, "scan-format")))
|
if ((v = blaze822_hdr(config, "scan-format")))
|
||||||
|
70
msed.c
70
msed.c
@ -24,8 +24,8 @@ subst(char *str, char *srch, char *repl, char *flags)
|
|||||||
int iflag = !!strchr(flags, 'i');
|
int iflag = !!strchr(flags, 'i');
|
||||||
int gflag = !!strchr(flags, 'g');
|
int gflag = !!strchr(flags, 'g');
|
||||||
|
|
||||||
#define APP(o,l) do {if(bufe-b<(ssize_t)l) return str; memcpy(b,str+i+o,l); b+=l;} while(0)
|
#define APP(o, l) do { if (bufe-b < (ssize_t)l) return str; memcpy(b, str+i+o, l); b += l; } while (0)
|
||||||
#define APPC(c) do {if(b>=bufe) return str; *b++=c;} while(0)
|
#define APPC(c) do { if (b >= bufe) return str; *b++ = c; } while (0)
|
||||||
|
|
||||||
regex_t srchrx;
|
regex_t srchrx;
|
||||||
regmatch_t pmatch[10];
|
regmatch_t pmatch[10];
|
||||||
@ -250,43 +250,43 @@ sed(char *file)
|
|||||||
char *h = 0;
|
char *h = 0;
|
||||||
char *v = 0;
|
char *v = 0;
|
||||||
switch (*e) {
|
switch (*e) {
|
||||||
case 'a':
|
case 'a':
|
||||||
if (he != hs) {
|
if (he != hs) {
|
||||||
h = strndup(hs, he-hs);
|
h = strndup(hs, he-hs);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "msed: used command a without header name\n");
|
fprintf(stderr, "msed: used command a without header name\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
e++;
|
||||||
|
if (*e == ' ' || *e == '\t' || *e == '\n' || *e == ';' || !*e) {
|
||||||
|
fprintf(stderr, "msed: no header value for %s\n", h);
|
||||||
|
exit(1);
|
||||||
|
} else {
|
||||||
|
sep = *e;
|
||||||
|
if (!sep) {
|
||||||
|
fprintf(stderr, "msed: unterminated a command\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
s = ++e;
|
||||||
|
while (*e && *e != sep)
|
||||||
|
e++;
|
||||||
|
v = strndup(s, e-s);
|
||||||
|
}
|
||||||
|
|
||||||
e++;
|
if (blaze822_chdr(msg, h))
|
||||||
if (*e == ' ' || *e == '\t' || *e == '\n' || *e == ';' || !*e) {
|
|
||||||
fprintf(stderr, "msed: no header value for %s\n", h);
|
|
||||||
exit(1);
|
|
||||||
} else {
|
|
||||||
sep = *e;
|
|
||||||
if (!sep) {
|
|
||||||
fprintf(stderr, "msed: unterminated a command\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
s = ++e;
|
|
||||||
while (*e && *e != sep)
|
|
||||||
e++;
|
|
||||||
v = strndup(s, e-s);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blaze822_chdr(msg, h))
|
|
||||||
break;
|
|
||||||
|
|
||||||
printhdr(h, 0);
|
|
||||||
printf(": %s\n", v);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
printhdr(h, 0);
|
||||||
case 'd':
|
printf(": %s\n", v);
|
||||||
case 's':
|
|
||||||
// ignore here;
|
break;
|
||||||
break;
|
|
||||||
|
case 'c':
|
||||||
|
case 'd':
|
||||||
|
case 's':
|
||||||
|
// ignore here;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
while (*e && *e != ';' && *e != '\n')
|
while (*e && *e != ';' && *e != '\n')
|
||||||
e++;
|
e++;
|
||||||
@ -301,7 +301,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "")) != -1)
|
while ((c = getopt(argc, argv, "")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Usage: msed [expr] [msgs...]\n");
|
fprintf(stderr, "Usage: msed [expr] [msgs...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
8
mseq.c
8
mseq.c
@ -3,9 +3,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <search.h>
|
#include <search.h>
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "blaze822.h"
|
#include "blaze822.h"
|
||||||
@ -152,7 +152,7 @@ fix(FILE *out, char *file)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
ok:
|
ok:
|
||||||
while(i--)
|
while (i--)
|
||||||
putc(' ', out);
|
putc(' ', out);
|
||||||
fprintf(out, "%s\n", bufptr);
|
fprintf(out, "%s\n", bufptr);
|
||||||
return 1;
|
return 1;
|
||||||
@ -277,7 +277,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "c:frAC:S")) != -1)
|
while ((c = getopt(argc, argv, "c:frAC:S")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'c': cflag = optarg; break;
|
case 'c': cflag = optarg; break;
|
||||||
case 'f': fflag = 1; break;
|
case 'f': fflag = 1; break;
|
||||||
case 'r': rflag = 1; break;
|
case 'r': rflag = 1; break;
|
||||||
@ -285,7 +285,7 @@ main(int argc, char *argv[])
|
|||||||
case 'C': Cflag = optarg; break;
|
case 'C': Cflag = optarg; break;
|
||||||
case 'S': Sflag = 1; break;
|
case 'S': Sflag = 1; break;
|
||||||
default:
|
default:
|
||||||
usage:
|
usage:
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: mseq [-fr] [-c msg] [msgs...]\n"
|
"Usage: mseq [-fr] [-c msg] [msgs...]\n"
|
||||||
" mseq -S [-fr] < sequence\n"
|
" mseq -S [-fr] < sequence\n"
|
||||||
|
54
mshow.c
54
mshow.c
@ -97,7 +97,7 @@ print_u8recode(char *body, size_t bodylen, char *srcenc)
|
|||||||
final_char = bufptr[-1];
|
final_char = bufptr[-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r != (size_t)-1) { // done, flush iconv
|
if (r != (size_t)-1) { // done, flush iconv
|
||||||
bufptr = buf;
|
bufptr = buf;
|
||||||
buflen = sizeof buf;
|
buflen = sizeof buf;
|
||||||
r = iconv(ic, 0, 0, &bufptr, &buflen);
|
r = iconv(ic, 0, 0, &bufptr, &buflen);
|
||||||
@ -218,11 +218,14 @@ render_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
|||||||
size_t outlen;
|
size_t outlen;
|
||||||
int e = filter(body, bodylen, cmd, &output, &outlen);
|
int e = filter(body, bodylen, cmd, &output, &outlen);
|
||||||
|
|
||||||
if (e == 0) { // replace output
|
if (e == 0 || e == 62) { // replace output (62 == raw)
|
||||||
if (!Nflag)
|
if (!Nflag)
|
||||||
printf(" render=\"%s\" ---\n", cmd);
|
printf(" render=\"%s\" ---\n", cmd);
|
||||||
if (outlen) {
|
if (outlen) {
|
||||||
print_ascii(output, outlen);
|
if (e == 0)
|
||||||
|
print_ascii(output, outlen);
|
||||||
|
else
|
||||||
|
return fwrite(output, 1, outlen, stdout);
|
||||||
if (output[outlen-1] != '\n')
|
if (output[outlen-1] != '\n')
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
@ -268,7 +271,7 @@ nofilter:
|
|||||||
strcasecmp(charset, "utf8") == 0 ||
|
strcasecmp(charset, "utf8") == 0 ||
|
||||||
strcasecmp(charset, "us-ascii") == 0) {
|
strcasecmp(charset, "us-ascii") == 0) {
|
||||||
print_ascii(body, bodylen);
|
print_ascii(body, bodylen);
|
||||||
if (body[bodylen-1] != '\n')
|
if (bodylen > 0 && body[bodylen-1] != '\n')
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
} else {
|
} else {
|
||||||
print_u8recode(body, bodylen, charset);
|
print_u8recode(body, bodylen, charset);
|
||||||
@ -336,7 +339,7 @@ choose_alternative(struct message *msg, int depth)
|
|||||||
blaze822_mime_action
|
blaze822_mime_action
|
||||||
reply_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
reply_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
||||||
{
|
{
|
||||||
(void) depth;
|
(void)depth;
|
||||||
|
|
||||||
char *ct = blaze822_hdr(msg, "content-type");
|
char *ct = blaze822_hdr(msg, "content-type");
|
||||||
char *mt = mimetype(ct);
|
char *mt = mimetype(ct);
|
||||||
@ -365,7 +368,7 @@ reply_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
|||||||
blaze822_mime_action
|
blaze822_mime_action
|
||||||
list_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
list_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
||||||
{
|
{
|
||||||
(void) body;
|
(void)body;
|
||||||
|
|
||||||
char *ct = blaze822_hdr(msg, "content-type");
|
char *ct = blaze822_hdr(msg, "content-type");
|
||||||
if (!ct)
|
if (!ct)
|
||||||
@ -441,7 +444,7 @@ writefile(char *name, char *buf, ssize_t len)
|
|||||||
blaze822_mime_action
|
blaze822_mime_action
|
||||||
extract_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
extract_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
||||||
{
|
{
|
||||||
(void) depth;
|
(void)depth;
|
||||||
|
|
||||||
char *filename = mime_filename(msg);
|
char *filename = mime_filename(msg);
|
||||||
|
|
||||||
@ -497,7 +500,7 @@ extract_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
|||||||
writefile(bufptr, body, bodylen);
|
writefile(bufptr, body, bodylen);
|
||||||
}
|
}
|
||||||
} else if (filename &&
|
} else if (filename &&
|
||||||
fnmatch(a, filename, FNM_PATHNAME) == 0) {
|
fnmatch(a, filename, FNM_PATHNAME) == 0) {
|
||||||
// extract by name
|
// extract by name
|
||||||
if (extract_stdout) {
|
if (extract_stdout) {
|
||||||
if (rflag) {
|
if (rflag) {
|
||||||
@ -574,55 +577,55 @@ print_date_header(char *v)
|
|||||||
int p = 3;
|
int p = 3;
|
||||||
|
|
||||||
int z;
|
int z;
|
||||||
switch(l) {
|
switch (l) {
|
||||||
case 'y':
|
case 'y':
|
||||||
z = d / (60*60*24*7*52);
|
z = d / (60*60*24*7*52);
|
||||||
d = d % (60*60*24*7*52);
|
d = d % (60*60*24*7*52);
|
||||||
if (z > 0) {
|
if (z > 0) {
|
||||||
printf("%d year%s", z, z>1 ? "s" : "");
|
printf("%d year%s", z, z > 1 ? "s" : "");
|
||||||
if (!--p) break;
|
if (!--p) break;
|
||||||
printf(", ");
|
printf(", ");
|
||||||
}
|
}
|
||||||
/* FALL THROUGH */
|
/* FALL THROUGH */
|
||||||
case 'w':
|
case 'w':
|
||||||
z = d / (60*60*24*7);
|
z = d / (60*60*24*7);
|
||||||
d = d % (60*60*24*7);
|
d = d % (60*60*24*7);
|
||||||
if (z > 0) {
|
if (z > 0) {
|
||||||
printf("%d week%s", z, z>1 ? "s" : "");
|
printf("%d week%s", z, z > 1 ? "s" : "");
|
||||||
if (!--p) break;
|
if (!--p) break;
|
||||||
printf(", ");
|
printf(", ");
|
||||||
}
|
}
|
||||||
/* FALL THROUGH */
|
/* FALL THROUGH */
|
||||||
case 'd':
|
case 'd':
|
||||||
z = d / (60*60*24);
|
z = d / (60*60*24);
|
||||||
d = d % (60*60*24);
|
d = d % (60*60*24);
|
||||||
if (z > 0) {
|
if (z > 0) {
|
||||||
printf("%d day%s", z, z>1 ? "s" : "");
|
printf("%d day%s", z, z > 1 ? "s" : "");
|
||||||
if (!--p) break;
|
if (!--p) break;
|
||||||
printf(", ");
|
printf(", ");
|
||||||
}
|
}
|
||||||
/* FALL THROUGH */
|
/* FALL THROUGH */
|
||||||
case 'h':
|
case 'h':
|
||||||
z = d / (60*60);
|
z = d / (60*60);
|
||||||
d = d % (60*60);
|
d = d % (60*60);
|
||||||
if (z > 0) {
|
if (z > 0) {
|
||||||
printf("%d hour%s", z, z>1 ? "s" : "");
|
printf("%d hour%s", z, z > 1 ? "s" : "");
|
||||||
if (!--p) break;
|
if (!--p) break;
|
||||||
printf(", ");
|
printf(", ");
|
||||||
}
|
}
|
||||||
/* FALL THROUGH */
|
/* FALL THROUGH */
|
||||||
case 'm':
|
case 'm':
|
||||||
z = d / (60);
|
z = d / (60);
|
||||||
d = d % (60);
|
d = d % (60);
|
||||||
if (z > 0) {
|
if (z > 0) {
|
||||||
printf("%d minute%s", z, z>1 ? "s" : "");
|
printf("%d minute%s", z, z > 1 ? "s" : "");
|
||||||
if (!--p) break;
|
if (!--p) break;
|
||||||
printf(", ");
|
printf(", ");
|
||||||
}
|
}
|
||||||
/* FALL THROUGH */
|
/* FALL THROUGH */
|
||||||
case 's':
|
case 's':
|
||||||
z = d;
|
z = d;
|
||||||
printf("%d second%s", z, z>1 ? "s" : "");
|
printf("%d second%s", z, z > 1 ? "s" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t < now)
|
if (t < now)
|
||||||
@ -707,7 +710,7 @@ show(char *file)
|
|||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (rflag || !blaze822_check_mime(msg)) { // raw body
|
if (rflag) { // raw body
|
||||||
print_ascii(blaze822_body(msg), blaze822_bodylen(msg));
|
print_ascii(blaze822_body(msg), blaze822_bodylen(msg));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -726,7 +729,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt(argc, argv, "h:A:qrtHLNx:O:Rn")) != -1)
|
while ((c = getopt(argc, argv, "h:A:qrtHLNx:O:Rn")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'h': hflag = optarg; break;
|
case 'h': hflag = optarg; break;
|
||||||
case 'A': Aflag = optarg; break;
|
case 'A': Aflag = optarg; break;
|
||||||
case 'q': qflag = 1; break;
|
case 'q': qflag = 1; break;
|
||||||
@ -759,8 +762,13 @@ main(int argc, char *argv[])
|
|||||||
if (safe_output && isatty(1)) {
|
if (safe_output && isatty(1)) {
|
||||||
char *pg;
|
char *pg;
|
||||||
pg = getenv("MBLAZE_PAGER");
|
pg = getenv("MBLAZE_PAGER");
|
||||||
if (!pg)
|
if (!pg) {
|
||||||
pg = getenv("PAGER");
|
pg = getenv("PAGER");
|
||||||
|
if (pg && strcmp(pg, "less") == 0) {
|
||||||
|
static char lesscmd[] = "less -RFXe";
|
||||||
|
pg = lesscmd;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (pg && *pg && strcmp(pg, "cat") != 0) {
|
if (pg && *pg && strcmp(pg, "cat") != 0) {
|
||||||
pid2 = pipeto(pg);
|
pid2 = pipeto(pg);
|
||||||
if (pid2 < 0)
|
if (pid2 < 0)
|
||||||
|
4
msort.c
4
msort.c
@ -1,5 +1,5 @@
|
|||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
@ -301,7 +301,7 @@ main(int argc, char *argv[])
|
|||||||
int c, i;
|
int c, i;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "fdsFMSUIr")) != -1)
|
while ((c = getopt(argc, argv, "fdsFMSUIr")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'f': addorder(fromorder); break;
|
case 'f': addorder(fromorder); break;
|
||||||
case 'd': addorder(dateorder); break;
|
case 'd': addorder(dateorder); break;
|
||||||
case 's': addorder(subjorder); break;
|
case 's': addorder(subjorder); break;
|
||||||
|
16
mthread.c
16
mthread.c
@ -279,7 +279,7 @@ find_root(const void *nodep, const VISIT which, const int depth)
|
|||||||
void
|
void
|
||||||
find_roots()
|
find_roots()
|
||||||
{
|
{
|
||||||
top = malloc (sizeof (struct container));
|
top = malloc(sizeof (struct container));
|
||||||
top->msg = 0;
|
top->msg = 0;
|
||||||
top->date = -1;
|
top->date = -1;
|
||||||
top->file = 0;
|
top->file = 0;
|
||||||
@ -404,14 +404,14 @@ main(int argc, char *argv[])
|
|||||||
if (pledge("stdio rpath tty", NULL) == -1)
|
if (pledge("stdio rpath tty", NULL) == -1)
|
||||||
err(1, "pledge");
|
err(1, "pledge");
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "S:v")) != -1)
|
while ((c = getopt(argc, argv, "S:v")) != -1)
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'S': blaze822_loop1(optarg, thread); break;
|
case 'S': blaze822_loop1(optarg, thread); break;
|
||||||
case 'v': vflag = 1; break;
|
case 'v': vflag = 1; break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Usage: mthread [-v] [-S dir] [msgs...]\n");
|
fprintf(stderr, "Usage: mthread [-v] [-S dir] [msgs...]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
optional = 0;
|
optional = 0;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <strings.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
#include "blaze822.h"
|
#include "blaze822.h"
|
||||||
#include "blaze822_priv.h"
|
#include "blaze822_priv.h"
|
||||||
|
@ -82,7 +82,7 @@ blaze822_decode_b64(char *s, char *e, char **deco, size_t *decleno)
|
|||||||
*deco = buf;
|
*deco = buf;
|
||||||
|
|
||||||
while (s + 4 <= e) {
|
while (s + 4 <= e) {
|
||||||
while (s < e && isfws((unsigned char) *s))
|
while (s < e && isfws((unsigned char)*s))
|
||||||
s++;
|
s++;
|
||||||
if (s >= e)
|
if (s >= e)
|
||||||
break;
|
break;
|
||||||
@ -90,7 +90,7 @@ blaze822_decode_b64(char *s, char *e, char **deco, size_t *decleno)
|
|||||||
uint32_t v = 0;
|
uint32_t v = 0;
|
||||||
unsigned char t = 0;
|
unsigned char t = 0;
|
||||||
|
|
||||||
unsigned char c0=s[0], c1=s[1], c2=s[2], c3=s[3];
|
unsigned char c0 = s[0], c1 = s[1], c2 = s[2], c3 = s[3];
|
||||||
s += 4;
|
s += 4;
|
||||||
|
|
||||||
if ((c0 | c1 | c2 | c3) > 127)
|
if ((c0 | c1 | c2 | c3) > 127)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
safe_u8putstr(char *s0, size_t l, FILE *stream)
|
safe_u8putstr(char *s0, size_t l, FILE *stream)
|
||||||
@ -10,7 +10,7 @@ safe_u8putstr(char *s0, size_t l, FILE *stream)
|
|||||||
// - rest is assumed to be latin1, and translated into utf8
|
// - rest is assumed to be latin1, and translated into utf8
|
||||||
// - translate CRLF to CR
|
// - translate CRLF to CR
|
||||||
|
|
||||||
unsigned char *s = (unsigned char* )s0;
|
unsigned char *s = (unsigned char *)s0;
|
||||||
unsigned char *e = s + l;
|
unsigned char *e = s + l;
|
||||||
|
|
||||||
while (s < e) {
|
while (s < e) {
|
||||||
@ -61,8 +61,8 @@ safe_u8putstr(char *s0, size_t l, FILE *stream)
|
|||||||
else if ((f & 0xf0c0c000) == 0xe0808000) goto u3;
|
else if ((f & 0xf0c0c000) == 0xe0808000) goto u3;
|
||||||
else if ((f & 0xf8c0c0c0) == 0xf0808080) {
|
else if ((f & 0xf8c0c0c0) == 0xf0808080) {
|
||||||
fputc(*s++, stream);
|
fputc(*s++, stream);
|
||||||
u3: fputc(*s++, stream);
|
u3: fputc(*s++, stream);
|
||||||
u2: fputc(*s++, stream);
|
u2: fputc(*s++, stream);
|
||||||
fputc(*s, stream);
|
fputc(*s, stream);
|
||||||
} else {
|
} else {
|
||||||
latin1:
|
latin1:
|
||||||
|
4
seq.c
4
seq.c
@ -349,7 +349,7 @@ parse_range(char *map, char *a, long *start, long *stop, long cur, long lines)
|
|||||||
a = b;
|
a = b;
|
||||||
}
|
}
|
||||||
if (*start == 0)
|
if (*start == 0)
|
||||||
*start = strchr("=^_", *a) ? cur : 1;
|
*start = strchr("=^_", *a) ? cur : 1;
|
||||||
|
|
||||||
while (*a == '^') {
|
while (*a == '^') {
|
||||||
a++;
|
a++;
|
||||||
@ -428,7 +428,7 @@ blaze822_seq_next(char *map, char *range, struct blaze822_seq_iter *iter)
|
|||||||
|
|
||||||
if (!iter->start) {
|
if (!iter->start) {
|
||||||
int ret = parse_range(map, range, &iter->start, &iter->stop,
|
int ret = parse_range(map, range, &iter->start, &iter->stop,
|
||||||
iter->cur, iter->lines);
|
iter->cur, iter->lines);
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
fprintf(stderr, "can't parse range: %s\n", range);
|
fprintf(stderr, "can't parse range: %s\n", range);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user