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
|
||||
|
||||
OS := $(shell uname)
|
||||
|
||||
ifeq ($(OS),OpenBSD)
|
||||
CFLAGS+=-I/usr/local/include -pthread
|
||||
LDLIBS=-L/usr/local/lib -liconv -pthread
|
||||
LOCALBASE=/usr/local
|
||||
CFLAGS+=-I$(LOCALBASE)/include -pthread
|
||||
LDLIBS=-L$(LOCALBASE)/lib -liconv -pthread
|
||||
endif
|
||||
|
||||
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 \
|
||||
mthread : seq.o slurp.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
|
||||
mscan : pipeto.o
|
||||
msort : mystrverscmp.o
|
||||
|
12
blaze822.c
12
blaze822.c
@ -59,8 +59,8 @@ blaze822_date(char *s) {
|
||||
|
||||
while (iswsp(*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("mar")) tm.tm_mon = 2;
|
||||
else if (i3("apr")) tm.tm_mon = 3;
|
||||
@ -79,7 +79,7 @@ blaze822_date(char *s) {
|
||||
|
||||
while (iswsp(*s))
|
||||
s++;
|
||||
|
||||
|
||||
if ((c = parse_posint(&s, 1000, 9999)) > 0) {
|
||||
tm.tm_year = c - 1900;
|
||||
} else if ((c = parse_posint(&s, 0, 49)) > 0) {
|
||||
@ -143,7 +143,7 @@ blaze822_addr(char *s, char **dispo, char **addro)
|
||||
if (addro) *addro = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
c = disp;
|
||||
e = disp + sizeof disp - 1;
|
||||
|
||||
@ -151,7 +151,7 @@ blaze822_addr(char *s, char **dispo, char **addro)
|
||||
*addr = 0;
|
||||
|
||||
while (*s && c < e) {
|
||||
startover:
|
||||
startover:
|
||||
if (*s == '<') {
|
||||
char *c = 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?
|
||||
s++;
|
||||
|
||||
if (!*addr) { // assume: user@host (name)
|
||||
if (!*addr) { // assume: user@host (name)
|
||||
*c-- = 0;
|
||||
while (c > disp && iswsp(*c))
|
||||
*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
|
10
filter.c
10
filter.c
@ -1,9 +1,9 @@
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <poll.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -24,7 +24,7 @@ filter(char *input, size_t inlen, char *cmd, char **outputo, size_t *outleno)
|
||||
sigemptyset(&mask);
|
||||
sigaddset(&mask, SIGPIPE);
|
||||
sigprocmask(SIG_BLOCK, &mask, &orig_mask);
|
||||
|
||||
|
||||
outlen = 0;
|
||||
output = malloc(outalloc);
|
||||
if (!output)
|
||||
@ -56,7 +56,7 @@ filter(char *input, size_t inlen, char *cmd, char **outputo, size_t *outleno)
|
||||
}
|
||||
close(pipe0[0]);
|
||||
close(pipe1[1]);
|
||||
|
||||
|
||||
if (pid < 0) {
|
||||
close(pipe0[1]);
|
||||
close(pipe1[0]);
|
||||
@ -89,7 +89,7 @@ filter(char *input, size_t inlen, char *cmd, char **outputo, size_t *outleno)
|
||||
} else if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
|
||||
fds[0].fd = -1;
|
||||
}
|
||||
|
||||
|
||||
if (fds[1].revents & POLLOUT) {
|
||||
ssize_t ret = write(fds[1].fd, input, inlen);
|
||||
if (ret > 0) {
|
||||
|
6
maddr.c
6
maddr.c
@ -19,7 +19,7 @@ addr(char *file)
|
||||
{
|
||||
while (*file == ' ' || *file == '\t')
|
||||
file++;
|
||||
|
||||
|
||||
struct message *msg = blaze822(file);
|
||||
if (!msg)
|
||||
return;
|
||||
@ -37,7 +37,7 @@ addr(char *file)
|
||||
blaze822_decode_rfc2047(vdec, v, sizeof vdec - 1, "UTF-8");
|
||||
vdec[sizeof vdec - 1] = 0;
|
||||
v = vdec;
|
||||
|
||||
|
||||
while ((v = blaze822_addr(v, &disp, &addr))) {
|
||||
if (disp && addr && strcmp(disp, addr) == 0)
|
||||
disp = 0;
|
||||
@ -65,7 +65,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "ah:")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'a': aflag = 1; break;
|
||||
case 'h': hflag = optarg; break;
|
||||
default:
|
||||
|
8
magrep.c
8
magrep.c
@ -68,7 +68,7 @@ match(char *file, char *hdr, char *s)
|
||||
blaze822_mime_action
|
||||
match_part(int depth, struct message *msg, char *body, size_t bodylen)
|
||||
{
|
||||
(void) depth;
|
||||
(void)depth;
|
||||
|
||||
char *ct = blaze822_hdr(msg, "content-type");
|
||||
|
||||
@ -164,7 +164,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "acdim:opqv")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'a': aflag = 1; break;
|
||||
case 'c': cflag = 1; break;
|
||||
case 'd': dflag = 1; break;
|
||||
@ -175,7 +175,7 @@ main(int argc, char *argv[])
|
||||
case 'q': qflag = 1; break;
|
||||
case 'v': vflag = 1; break;
|
||||
default:
|
||||
usage:
|
||||
usage:
|
||||
fprintf(stderr,
|
||||
"Usage: magrep [-c|-o|-p|-q|-m max] [-v] [-i] [-a|-d] header:regex [msgs...]\n");
|
||||
exit(2);
|
||||
@ -205,7 +205,7 @@ main(int argc, char *argv[])
|
||||
blaze822_loop1(":", magrep);
|
||||
else
|
||||
blaze822_loop(argc-optind, argv+optind, magrep);
|
||||
|
||||
|
||||
if (cflag && !qflag && !mflag)
|
||||
printf("%ld\n", matches);
|
||||
|
||||
|
@ -40,9 +40,9 @@ Only search the colon-separated list of
|
||||
.Ar headers
|
||||
for mail addresses.
|
||||
Default:
|
||||
.Sq Li "from:sender:reply-to:to:cc:bcc:"
|
||||
.Sq Li from\&:sender\&:reply\&-to\&:to\&:cc\&:bcc\&:
|
||||
and their respective
|
||||
.Sq Li "resent-"
|
||||
.Sq Li resent\&-
|
||||
variants.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
|
@ -32,40 +32,40 @@ The following
|
||||
are used by
|
||||
.Xr mblaze 7 :
|
||||
.Bl -tag -width Ds
|
||||
.It Li "Alternate-Mailboxes:"
|
||||
.It Li Alternate\&-Mailboxes\&:
|
||||
A comma-separated list of mail addresses that belong to you, for
|
||||
.Xr mscan 1
|
||||
to recognize messages sent by or directly to you.
|
||||
.It Li "FQDN:"
|
||||
.It Li FQDN\&:
|
||||
The fully qualified domain name used for
|
||||
.Li "Message-Id:"
|
||||
.Li Message\&-Id\&:
|
||||
generation in
|
||||
.Xr mgenmid 1 .
|
||||
.It Li "Local-Mailbox:"
|
||||
.It Li Local\&-Mailbox\&:
|
||||
Your primary mail address, used as the default value for
|
||||
.Li "From:"
|
||||
.Li From\&:
|
||||
in
|
||||
.Xr mcom 1 ,
|
||||
and in
|
||||
.Xr mscan 1
|
||||
to recognize messages sent to you.
|
||||
.It Li "Outbox:"
|
||||
.It Li Outbox\&:
|
||||
If set,
|
||||
.Xr mcom 1
|
||||
will create draft messages in this Maildir,
|
||||
and save messages there after sending.
|
||||
.It Li "Scan-Format:"
|
||||
.It Li Scan\&-Format\&:
|
||||
The default format string for
|
||||
.Xr mscan 1 .
|
||||
.It Li "Sendmail:"
|
||||
.It Li Sendmail\&:
|
||||
The program that
|
||||
.Xr mcom 1
|
||||
will call to send mail.
|
||||
(Default:
|
||||
.Sq Li sendmail ) .
|
||||
.It Li "Sendmail-Args:"
|
||||
.It Li Sendmail\&-Args\&:
|
||||
Flags to be passed to the
|
||||
.Li "Sendmail:"
|
||||
.Li Sendmail\&:
|
||||
program.
|
||||
(Default:
|
||||
.Sq Fl t ) .
|
||||
|
@ -37,11 +37,11 @@ and deliver each message,
|
||||
decoding it according to the MBOXRD convention.
|
||||
.Nm
|
||||
will set the mtime according to the value of
|
||||
.Sq Li "Date:"
|
||||
.Sq Li Date\&:
|
||||
and the Maildir flags according to the value of
|
||||
.Sq Li "Status:"
|
||||
.Sq Li Status\&:
|
||||
or
|
||||
.Sq Li "X-Status:" .
|
||||
.Sq Li X-Status\&: .
|
||||
.Pp
|
||||
The messages are delivered in a reliable way and use default
|
||||
.Xr umask 2 .
|
||||
|
@ -25,11 +25,11 @@ or uses the mails in the current sequence if used interactively.
|
||||
.Pp
|
||||
.Nm
|
||||
uses the
|
||||
.Sq Li "Return-Path:"
|
||||
.Sq Li Return\&-Path\&:
|
||||
(or
|
||||
.Sq Li "X-Envelope-To:" )
|
||||
.Sq Li X\&-Envelope\&-To\&: )
|
||||
and
|
||||
.Sq Li "Date:"
|
||||
.Sq Li Date\&:
|
||||
headers from the message for the mbox
|
||||
.Sq Li "From "
|
||||
line.
|
||||
@ -38,9 +38,9 @@ The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl S
|
||||
Add
|
||||
.Sq Li "Status:"
|
||||
.Sq Li Status\&:
|
||||
and
|
||||
.Sq Li "X-Status:"
|
||||
.Sq Li X\&-Status\&:
|
||||
headers according to the
|
||||
.Ar msgs
|
||||
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
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -6,6 +6,9 @@
|
||||
.Nd reflow format=flowed plain text mails
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl f
|
||||
.Op Fl q
|
||||
.Op Fl w Ar width
|
||||
\&<
|
||||
.Ar file
|
||||
.Sh DESCRIPTION
|
||||
@ -31,6 +34,19 @@ If defined,
|
||||
the environment variable
|
||||
.Ev MAXCOLUMNS
|
||||
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
|
||||
.Ex -std
|
||||
.Sh SEE ALSO
|
||||
|
@ -17,7 +17,7 @@ The fully qualified domain name is computed by:
|
||||
.Bl -enum
|
||||
.It
|
||||
Using
|
||||
.Sq Li "FQDN:"
|
||||
.Sq Li FQDN\&:
|
||||
from
|
||||
.Pa "${MBLAZE:-$HOME/.mblaze}/profile"
|
||||
(if set).
|
||||
@ -25,7 +25,7 @@ from
|
||||
Resolving the current hostname.
|
||||
.It
|
||||
Using the host part of the address in
|
||||
.Sq Li "Local-Mailbox:"
|
||||
.Sq Li Local\&-Mailbox\&:
|
||||
from
|
||||
.Pa "${MBLAZE:-$HOME/.mblaze}/profile"
|
||||
(if set).
|
||||
|
13
man/mhdr.1
13
man/mhdr.1
@ -6,7 +6,7 @@
|
||||
.Nd show mail headers
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl h Ar header
|
||||
.Op Fl h Ar header Op Fl p Ar parameter
|
||||
.Op Fl d
|
||||
.Op Fl H
|
||||
.Op Fl M
|
||||
@ -31,6 +31,10 @@ The options are as follows:
|
||||
.It Fl h Ar header
|
||||
Only print the values of the headers in the colon-separated list
|
||||
.Ar header .
|
||||
.It Fl p Ar parameter
|
||||
Extract a particular RFC 2045
|
||||
.Ar parameter
|
||||
from the specified headers.
|
||||
.It Fl d
|
||||
Decode the headers according to RFC 2047.
|
||||
.It Fl H
|
||||
@ -55,6 +59,13 @@ and >1 if an error occurs.
|
||||
.Rs
|
||||
.%A N. Freed
|
||||
.%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
|
||||
.%R RFC 2047
|
||||
.%D November 1996
|
||||
|
@ -72,8 +72,9 @@ Don't list messages in
|
||||
Don't list messages in
|
||||
.Pa new .
|
||||
.It Fl i
|
||||
Don't print filenames. Instead, print a one-line summary for each
|
||||
folder, showing the number of unseen, flagged and total messages,
|
||||
Don't print filenames.
|
||||
Instead, print a one-line summary for each folder,
|
||||
showing the number of unseen, flagged and total messages,
|
||||
along with the folder name.
|
||||
.Pp
|
||||
If two or more folders are specified, a total will also be printed.
|
||||
|
@ -49,6 +49,8 @@ Defaults to
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh SEE ALSO
|
||||
.Xr makemime 1 ,
|
||||
.Xr mhbuild 1
|
||||
.Rs
|
||||
.%A N. Freed
|
||||
.%A N. Borenstein
|
||||
|
@ -74,7 +74,7 @@ Deleted messages.
|
||||
New messages.
|
||||
.It Cm o
|
||||
Old messages.
|
||||
.It Cm r, Cm S
|
||||
.It Cm r , Cm S
|
||||
Read messages.
|
||||
.It Cm u
|
||||
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.
|
||||
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "f"
|
||||
The
|
||||
.Sq Li From:
|
||||
.Sq Li From\&:
|
||||
(or
|
||||
.Sq Li To: ,
|
||||
.Sq Li To\&: ,
|
||||
if the message is from us).
|
||||
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "F"
|
||||
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.
|
||||
.It Cm "%" Ns Oo Ar wd Oc Ns Cm "I"
|
||||
The
|
||||
.Sq Li "Message-ID:"
|
||||
.Sq Li Message\&-ID\&:
|
||||
of the message.
|
||||
.It Cm "%M"
|
||||
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"
|
||||
The subject of the message (defaults to remaining width),
|
||||
with leading
|
||||
.Sq Li "Re:" ,
|
||||
.Sq Li "Fwd:"
|
||||
.Sq Li Re\&: ,
|
||||
.Sq Li Fwd\&:
|
||||
etc. stripped.
|
||||
.It Cm "%t"
|
||||
A
|
||||
.Sq Li \&>
|
||||
if you are in
|
||||
.Sq Li "To:" ,
|
||||
.Sq Li To\&: ,
|
||||
a
|
||||
.Sq Li \&+
|
||||
if you are in
|
||||
.Sq Li "Cc:" ,
|
||||
.Sq Li Cc\&: ,
|
||||
a
|
||||
.Sq Li \&:
|
||||
if you are in
|
||||
.Sq Li "Resent-To:" ,
|
||||
.Sq Li Resent\&-To\&: ,
|
||||
or a blank.
|
||||
.It Cm "%u"
|
||||
An
|
||||
@ -169,13 +169,13 @@ A replied-to message
|
||||
.Bl -tag -width 2n -compact
|
||||
.It Li \&>
|
||||
You are in
|
||||
.Sq Li "To:" .
|
||||
.Sq Li To\&: .
|
||||
.It Li \&+
|
||||
You are in
|
||||
.Sq Li "Cc:" .
|
||||
.Sq Li Cc\:& .
|
||||
.It Li \&:
|
||||
You are in
|
||||
.Sq Li "Resent-To:" .
|
||||
.Sq Li Resent\&-To\&: .
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width MBLAZE_PAGER
|
||||
|
@ -71,10 +71,10 @@ will delete all headers starting with
|
||||
and
|
||||
.Sq Li "/from:to:cc/d"
|
||||
will delete the headers
|
||||
.Sq Li "From:" ,
|
||||
.Sq Li "To:" ,
|
||||
.Sq Li From\&: ,
|
||||
.Sq Li To\&: ,
|
||||
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
|
||||
Substitute matches of the POSIX Basic Regular Expression
|
||||
.Ar regex
|
||||
|
@ -39,7 +39,7 @@ The options are as follows:
|
||||
Display the headers in the colon-separated list
|
||||
.Ar 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
|
||||
Define
|
||||
.Sq Li "mixed/alternative"
|
||||
|
@ -28,14 +28,14 @@ The options are as follows:
|
||||
Reverse order.
|
||||
.It Fl f
|
||||
Sort by
|
||||
.Sq Li From: .
|
||||
.Sq Li From\&: .
|
||||
.It Fl d
|
||||
Sort by date.
|
||||
.It Fl s
|
||||
Sort by
|
||||
.Sq Li Subject\&:
|
||||
(modulo various variants of
|
||||
.Sq Li Re: ) .
|
||||
.Sq Li Re\&: ) .
|
||||
.It Fl F
|
||||
Sort by filename, using proper order for numbers in filenames.
|
||||
.It Fl M
|
||||
|
14
mdeliver.c
14
mdeliver.c
@ -82,9 +82,9 @@ tryagain:
|
||||
snprintf(id, sizeof id, "%ld.M%06ldP%ldQ%ld.%s",
|
||||
(long)tv.tv_sec, (long)tv.tv_usec, (long)getpid(),
|
||||
delivery, host);
|
||||
|
||||
|
||||
snprintf(tmp, sizeof tmp, "%s/tmp/%s", targetdir, id);
|
||||
|
||||
|
||||
outfd = open(tmp, O_CREAT | O_WRONLY | O_EXCL, 0666);
|
||||
if (outfd < 0) {
|
||||
if (errno == EEXIST)
|
||||
@ -152,14 +152,14 @@ tryagain:
|
||||
int i, j;
|
||||
for (i = sizeof statusflags - 1; i >= 0; 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];
|
||||
|
||||
if (Mflag) {
|
||||
struct message *msg = blaze822_file(tmp);
|
||||
time_t date = -1;
|
||||
char *v;
|
||||
|
||||
|
||||
if (msg && (v = blaze822_hdr(msg, "date"))) {
|
||||
date = blaze822_date(v);
|
||||
if (date != -1) {
|
||||
@ -173,8 +173,8 @@ tryagain:
|
||||
}
|
||||
|
||||
snprintf(dst, sizeof dst, "%s/%s/%s:2,%s",
|
||||
targetdir, (cflag || is_old) ? "cur" : "new", id,
|
||||
Xflag ? Xflag : statusflags);
|
||||
targetdir, (cflag || is_old) ? "cur" : "new", id,
|
||||
Xflag ? Xflag : statusflags);
|
||||
if (rename(tmp, dst) != 0)
|
||||
return -1;
|
||||
|
||||
@ -189,7 +189,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "cMvX:")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'c': cflag = 1; break;
|
||||
case 'M': Mflag = 1; break;
|
||||
case 'v': vflag = 1; break;
|
||||
|
8
mdirs.c
8
mdirs.c
@ -57,10 +57,10 @@ mdirs(char *fpath)
|
||||
|
||||
if (dotonly && d->d_name[0] != '.')
|
||||
continue;
|
||||
|
||||
|
||||
mdirs(d->d_name);
|
||||
}
|
||||
|
||||
|
||||
if (chdir("..") < 0)
|
||||
exit(-1);
|
||||
|
||||
@ -72,9 +72,9 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c, i;
|
||||
while ((c = getopt(argc, argv, "")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
default:
|
||||
usage:
|
||||
usage:
|
||||
fprintf(stderr, "Usage: mdirs dirs...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
18
mexport.c
18
mexport.c
@ -51,7 +51,7 @@ export(char *file)
|
||||
if (e) {
|
||||
s++;
|
||||
snprintf(from, sizeof from, "%.*s",
|
||||
(int)(e-s), s);
|
||||
(int)(e-s), s);
|
||||
}
|
||||
} else { // return-path without <>
|
||||
snprintf(from, sizeof from, "%s", v);
|
||||
@ -66,7 +66,7 @@ export(char *file)
|
||||
|
||||
char *line = 0;
|
||||
size_t linelen = 0;
|
||||
|
||||
|
||||
printf("From %s %s", from, ctime(&date));
|
||||
|
||||
int in_header = 1;
|
||||
@ -83,7 +83,7 @@ export(char *file)
|
||||
status = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (in_header && line[0] == '\n' && !line[1]) {
|
||||
if (Sflag) {
|
||||
char *flags = strstr(file, ":2,");
|
||||
@ -94,21 +94,21 @@ export(char *file)
|
||||
if (strchr(flags, 'S'))
|
||||
putchar('R');
|
||||
char *ee = strrchr(file, '/');
|
||||
if (!ee ||
|
||||
if (!ee ||
|
||||
!(ee >= file + 3 && ee[-3] == 'n' && ee[-2] == 'e' && ee[-1] == 'w'))
|
||||
putchar('O');
|
||||
putchar('\n');
|
||||
|
||||
|
||||
fputs("X-Status: ", stdout);
|
||||
if (strchr(flags, 'R')) putchar('A');
|
||||
if (strchr(flags, 'T')) putchar('D');
|
||||
if (strchr(flags, 'F')) putchar('F');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
|
||||
in_header = 0;
|
||||
}
|
||||
|
||||
|
||||
// MBOXRD: add first > to >>..>>From
|
||||
char *s = line;
|
||||
while (*s == '>')
|
||||
@ -132,7 +132,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "S")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'S': Sflag = 1; break;
|
||||
default:
|
||||
fprintf(stderr, "Usage: mexport [-S] [msgs...]\n");
|
||||
@ -148,6 +148,6 @@ main(int argc, char *argv[])
|
||||
blaze822_loop1(":", export);
|
||||
else
|
||||
blaze822_loop(argc-optind, argv+optind, export);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
11
mflag.c
11
mflag.c
@ -99,7 +99,7 @@ doit:
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
skip:
|
||||
if (vflag)
|
||||
printf("%s\n", file);
|
||||
@ -110,7 +110,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
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':
|
||||
flags[(unsigned int)c] = 1;
|
||||
break;
|
||||
@ -142,6 +142,11 @@ main(int argc, char *argv[])
|
||||
curfile = blaze822_seq_cur();
|
||||
|
||||
if (vflag) {
|
||||
if (argc == optind && !isatty(0)) {
|
||||
blaze822_loop(0, 0, flag); // read from stdin
|
||||
return 0;
|
||||
}
|
||||
|
||||
args = calloc(sizeof (char *), argsalloc);
|
||||
if (!args)
|
||||
exit(-1);
|
||||
@ -155,7 +160,7 @@ main(int argc, char *argv[])
|
||||
blaze822_loop1(":", flag);
|
||||
else
|
||||
blaze822_loop(0, 0, flag);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
50
mflow.c
50
mflow.c
@ -32,7 +32,7 @@ fixed(int quotes, char *line, size_t linelen)
|
||||
{
|
||||
chgquote(quotes);
|
||||
|
||||
if (linelen > (size_t)(maxcolumn - column)) {
|
||||
if (column && linelen > (size_t)(maxcolumn - column)) {
|
||||
putchar('\n');
|
||||
column = 0;
|
||||
}
|
||||
@ -75,7 +75,8 @@ flowed(int quotes, char *line, ssize_t linelen)
|
||||
done = 1;
|
||||
}
|
||||
|
||||
if (column + (eow - line) > maxcolumn) {
|
||||
if (column + (eow - line) > maxcolumn &&
|
||||
eow - line < maxcolumn) {
|
||||
putchar('\n');
|
||||
column = 0;
|
||||
if (*line == ' ') {
|
||||
@ -92,23 +93,26 @@ flowed(int quotes, char *line, ssize_t linelen)
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *linebuf = 0;
|
||||
char *line;
|
||||
size_t linelen = 0;
|
||||
int quotes = 0;
|
||||
int outer_quotes = 0;
|
||||
int quotes;
|
||||
|
||||
int reflow = 1; // re-evaluated on $PIPE_CONTENTTYPE
|
||||
int force = 0;
|
||||
int delsp = 0;
|
||||
|
||||
char *ct = getenv("PIPE_CONTENTTYPE");
|
||||
if (ct) {
|
||||
char *s, *se;
|
||||
blaze822_mime_parameter(ct, "format", &s, &se);
|
||||
reflow = s && (strncasecmp(s, "flowed", 6) == 0);
|
||||
blaze822_mime_parameter(ct, "delsp", &s, &se);
|
||||
delsp = s && (strncasecmp(s, "yes", 3) == 0);
|
||||
reflow = 0;
|
||||
if (blaze822_mime_parameter(ct, "format", &s, &se) && s)
|
||||
reflow = (strncasecmp(s, "flowed", 6) == 0);
|
||||
if (blaze822_mime_parameter(ct, "delsp", &s, &se) && s)
|
||||
delsp = (strncasecmp(s, "yes", 3) == 0);
|
||||
}
|
||||
|
||||
char *cols = getenv("COLUMNS");
|
||||
@ -131,6 +135,17 @@ main()
|
||||
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) {
|
||||
errno = 0;
|
||||
ssize_t rd = getdelim(&linebuf, &linelen, '\n', stdin);
|
||||
@ -144,24 +159,24 @@ main()
|
||||
|
||||
line = linebuf;
|
||||
|
||||
if (!reflow) {
|
||||
if (!reflow && !force) {
|
||||
fwrite(line, 1, rd, stdout);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rd > 0 && line[rd-1] == '\n')
|
||||
line[--rd] = 0;
|
||||
line[--rd] = 0;
|
||||
if (rd > 0 && line[rd-1] == '\r')
|
||||
line[--rd] = 0;
|
||||
|
||||
quotes = 0;
|
||||
line[--rd] = 0;
|
||||
|
||||
quotes = outer_quotes;
|
||||
while (*line == '>') { // measure quote depth
|
||||
line++;
|
||||
quotes++;
|
||||
rd--;
|
||||
}
|
||||
|
||||
if (*line == ' ') { // space stuffing
|
||||
if (reflow && *line == ' ') { // space stuffing
|
||||
line++;
|
||||
rd--;
|
||||
}
|
||||
@ -178,7 +193,12 @@ main()
|
||||
line[--rd] = 0;
|
||||
flowed(quotes, line, rd);
|
||||
} 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 *o = outbuf + sizeof outbuf;
|
||||
*o = 0;
|
||||
|
||||
*--o = 0;
|
||||
do { *--o = base36[x % 36]; } while (x /= 36);
|
||||
|
||||
fputs(o, stdout);
|
||||
}
|
||||
|
||||
@ -46,8 +47,8 @@ int main()
|
||||
hostbuf[sizeof hostbuf - 1] = 0;
|
||||
|
||||
struct addrinfo hints = { .ai_family = AF_UNSPEC,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
.ai_flags = AI_CANONNAME };
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
.ai_flags = AI_CANONNAME };
|
||||
struct addrinfo *info;
|
||||
if (getaddrinfo(hostbuf, 0, &hints, &info) == 0) {
|
||||
// sanity checks: no (null), at least one dot,
|
||||
@ -83,7 +84,7 @@ int main()
|
||||
" or add a FQDN to /etc/hosts.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
struct timeval tp;
|
||||
gettimeofday(&tp, (struct timezone *)0);
|
||||
|
||||
|
22
mhdr.c
22
mhdr.c
@ -13,6 +13,7 @@
|
||||
#include "blaze822.h"
|
||||
|
||||
static char *hflag;
|
||||
static char *pflag;
|
||||
static int Aflag;
|
||||
static int Dflag;
|
||||
static int Hflag;
|
||||
@ -75,7 +76,7 @@ print_addresses(char *s)
|
||||
printf("%s\t", curfile);
|
||||
|
||||
if (disp && addr)
|
||||
printf("%s <%s>\n", disp, addr);
|
||||
printf("%s <%s>\n", disp, addr);
|
||||
else if (addr)
|
||||
printf("%s\n", addr);
|
||||
}
|
||||
@ -101,6 +102,16 @@ print_decode_header(char *s)
|
||||
void
|
||||
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;
|
||||
|
||||
if (Hflag && !Aflag)
|
||||
@ -189,9 +200,10 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "h:ADHMd")) != -1)
|
||||
switch(c) {
|
||||
while ((c = getopt(argc, argv, "h:p:ADHMd")) != -1)
|
||||
switch (c) {
|
||||
case 'h': hflag = optarg; break;
|
||||
case 'p': pflag = optarg; break;
|
||||
case 'A': Aflag = 1; break;
|
||||
case 'D': Dflag = 1; break;
|
||||
case 'H': Hflag = 1; break;
|
||||
@ -199,7 +211,7 @@ main(int argc, char *argv[])
|
||||
case 'd': dflag = 1; break;
|
||||
default:
|
||||
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);
|
||||
}
|
||||
|
||||
@ -212,6 +224,6 @@ main(int argc, char *argv[])
|
||||
blaze822_loop1(".", header);
|
||||
else
|
||||
blaze822_loop(argc-optind, argv+optind, header);
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
4
minc.c
4
minc.c
@ -66,10 +66,10 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c, i;
|
||||
while ((c = getopt(argc, argv, "q")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'q': qflag = 1; break;
|
||||
default:
|
||||
usage:
|
||||
usage:
|
||||
fprintf(stderr, "Usage: minc [-q] dirs...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
18
mlist.c
18
mlist.c
@ -99,11 +99,11 @@ list(char *prefix, char *file)
|
||||
#include <sys/syscall.h>
|
||||
|
||||
struct linux_dirent64 {
|
||||
ino64_t d_ino; /* 64-bit inode number */
|
||||
off64_t d_off; /* 64-bit offset to next structure */
|
||||
ino64_t d_ino; /* 64-bit inode number */
|
||||
off64_t d_off; /* 64-bit offset to next structure */
|
||||
unsigned short d_reclen; /* Size of this dirent */
|
||||
unsigned char d_type; /* File type */
|
||||
char d_name[]; /* Filename (null-terminated) */
|
||||
unsigned char d_type; /* File type */
|
||||
char d_name[]; /* Filename (null-terminated) */
|
||||
};
|
||||
#define BUF_SIZE 1024000
|
||||
|
||||
@ -120,18 +120,18 @@ listdir(char *dir)
|
||||
perror("open");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
nread = syscall(SYS_getdents64, fd, buf, BUF_SIZE);
|
||||
if (nread == -1) {
|
||||
perror("getdents64");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (nread == 0)
|
||||
break;
|
||||
|
||||
for (bpos = 0; bpos < nread;) {
|
||||
for (bpos = 0; bpos < nread; ) {
|
||||
d = (struct linux_dirent64 *)(buf + bpos);
|
||||
if (d->d_type != DT_REG && d->d_type != DT_UNKNOWN)
|
||||
goto next;
|
||||
@ -225,7 +225,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
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':
|
||||
flags[(unsigned int)c] = 1;
|
||||
break;
|
||||
@ -246,7 +246,7 @@ main(int argc, char *argv[])
|
||||
case 'c': Cflag = -1; break;
|
||||
case 'i': iflag = 1; break;
|
||||
default:
|
||||
usage:
|
||||
usage:
|
||||
fprintf(stderr,
|
||||
"Usage: mlist [-DFPRST] [-X str]\n"
|
||||
" [-dfprst] [-x str]\n"
|
||||
|
16
mmime.c
16
mmime.c
@ -135,7 +135,7 @@ gen_attachment(const char *filename, char *content_disposition)
|
||||
return;
|
||||
}
|
||||
|
||||
for (s = (char *) filename; *s; s++) {
|
||||
for (s = (char *)filename; *s; s++) {
|
||||
if (*s < 32 || *s == '"' || *s >= 127 || s - filename > 35)
|
||||
goto rfc2231;
|
||||
if (strchr(" ()<>@,;:\\/[]?=", *s))
|
||||
@ -162,9 +162,9 @@ rfc2231:
|
||||
}
|
||||
while (*s && i < 78 - 3) {
|
||||
if (*s <= 32 || *s == '"' || *s > 126)
|
||||
i += printf("%%%02x", (uint8_t) *s++);
|
||||
i += printf("%%%02x", (uint8_t)*s++);
|
||||
else
|
||||
i += printf("%c", (uint8_t) *s++);
|
||||
i += printf("%c", (uint8_t)*s++);
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ gen_file(char *file, char *ct)
|
||||
file, strerror(r));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(ct, "mblaze/raw") == 0)
|
||||
goto raw;
|
||||
|
||||
@ -292,7 +292,7 @@ print_header(char *line) {
|
||||
while (*e && *e == ' ')
|
||||
e++;
|
||||
for (; *e && *e != ' '; e++) {
|
||||
if ((uint8_t) *e >= 127)
|
||||
if ((uint8_t)*e >= 127)
|
||||
highbit++;
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@ gen_build()
|
||||
printf("Content-Type: text/plain; charset=UTF-8\n");
|
||||
printf("Content-Disposition: inline\n");
|
||||
printf("Content-Transfer-Encoding: quoted-printable\n\n");
|
||||
|
||||
|
||||
intext = 1;
|
||||
}
|
||||
|
||||
@ -471,12 +471,12 @@ main(int argc, char *argv[])
|
||||
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "crt:")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'r': rflag = 1; break;
|
||||
case 'c': cflag = 1; break;
|
||||
case 't': tflag = optarg; break;
|
||||
default:
|
||||
usage:
|
||||
usage:
|
||||
fprintf(stderr,
|
||||
"Usage: mmime [-c|-r] [-t CONTENT-TYPE] < message\n");
|
||||
exit(1);
|
||||
|
26
mpick.c
26
mpick.c
@ -29,17 +29,17 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <regex.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
#include <locale.h>
|
||||
#include <limits.h>
|
||||
#include <regex.h>
|
||||
|
||||
#include "blaze822.h"
|
||||
|
||||
@ -163,7 +163,7 @@ static int prune;
|
||||
static void
|
||||
ws()
|
||||
{
|
||||
while (isspace((unsigned char) *pos))
|
||||
while (isspace((unsigned char)*pos))
|
||||
pos++;
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ parse_string(char **s)
|
||||
char t;
|
||||
char *e = ++pos;
|
||||
|
||||
while (isalnum((unsigned char) *pos) || *pos == '_')
|
||||
while (isalnum((unsigned char)*pos) || *pos == '_')
|
||||
pos++;
|
||||
if (e == pos)
|
||||
parse_error("invalid environment variable name");
|
||||
@ -407,12 +407,12 @@ static int64_t
|
||||
parse_num(int64_t *r)
|
||||
{
|
||||
char *s = pos;
|
||||
if (isdigit((unsigned char) *pos)) {
|
||||
if (isdigit((unsigned char)*pos)) {
|
||||
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');
|
||||
if (isdigit((unsigned char) *pos))
|
||||
if (isdigit((unsigned char)*pos))
|
||||
parse_error("number too big: %s", s);
|
||||
if (token("c")) ;
|
||||
else if (token("b")) n *= 512LL;
|
||||
@ -499,7 +499,7 @@ parse_cmp()
|
||||
e->a.prop = prop;
|
||||
e->b.num = n;
|
||||
return e;
|
||||
} else if(token("cur")) {
|
||||
} else if (token("cur")) {
|
||||
struct expr *e = mkexpr(op);
|
||||
e->a.prop = prop;
|
||||
e->b.var = VAR_CUR;
|
||||
@ -905,7 +905,7 @@ eval(struct expr *e, struct mailinfo *m)
|
||||
case EXPR_REGEX:
|
||||
case EXPR_REGEXI: {
|
||||
const char *s = "";
|
||||
switch(e->a.prop) {
|
||||
switch (e->a.prop) {
|
||||
case PROP_PATH: s = m->fpath; break;
|
||||
case PROP_FROM: s = msg_addr(m, "from", 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->msg = 0;
|
||||
|
||||
while (*m->fpath == ' ' || *m->fpath== '\t') {
|
||||
while (*m->fpath == ' ' || *m->fpath == '\t') {
|
||||
m->depth++;
|
||||
m->fpath++;
|
||||
}
|
||||
@ -1079,7 +1079,7 @@ collect(char *file)
|
||||
} else if (thr->cur->m->depth > m->depth) {
|
||||
/* find parent mail */
|
||||
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;
|
||||
}
|
||||
|
||||
|
2
mquote
2
mquote
@ -7,6 +7,6 @@
|
||||
|
||||
printf '%s wrote:\n' "$from"
|
||||
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 's/^/> /' # prefix with >
|
||||
|
12
mscan.c
12
mscan.c
@ -9,6 +9,7 @@
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -16,7 +17,6 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "blaze822.h"
|
||||
|
||||
@ -281,7 +281,7 @@ oneline(char *file)
|
||||
indent++;
|
||||
file++;
|
||||
}
|
||||
|
||||
|
||||
struct message *msg = blaze822(file);
|
||||
char *flags = msg ? strstr(file, ":2,") : 0;
|
||||
if (!flags)
|
||||
@ -493,7 +493,7 @@ main(int argc, char *argv[])
|
||||
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "If:n")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'I': Iflag++; break;
|
||||
case 'f': fflag = optarg; break;
|
||||
case 'n': nflag = 1; break;
|
||||
@ -517,7 +517,7 @@ main(int argc, char *argv[])
|
||||
struct tm *tm = localtime(&now);
|
||||
curyear = tm->tm_year;
|
||||
|
||||
setlocale(LC_ALL, ""); // for wcwidth later
|
||||
setlocale(LC_ALL, ""); // for wcwidth later
|
||||
if (wcwidth(0xfffd) > 0)
|
||||
replacement = 0xfffd;
|
||||
|
||||
@ -549,12 +549,12 @@ main(int argc, char *argv[])
|
||||
char *v, *d, *a;
|
||||
if ((v = blaze822_hdr(config, "local-mailbox")))
|
||||
while (alias_idx < (int)(sizeof aliases / sizeof aliases[0]) &&
|
||||
(v = blaze822_addr(v, &d, &a)))
|
||||
(v = blaze822_addr(v, &d, &a)))
|
||||
if (a)
|
||||
aliases[alias_idx++] = strdup(a);
|
||||
if ((v = blaze822_hdr(config, "alternate-mailboxes")))
|
||||
while (alias_idx < (int)(sizeof aliases / sizeof aliases[0]) &&
|
||||
(v = blaze822_addr(v, &d, &a)))
|
||||
(v = blaze822_addr(v, &d, &a)))
|
||||
if (a)
|
||||
aliases[alias_idx++] = strdup(a);
|
||||
if ((v = blaze822_hdr(config, "scan-format")))
|
||||
|
84
msed.c
84
msed.c
@ -24,9 +24,9 @@ subst(char *str, char *srch, char *repl, char *flags)
|
||||
int iflag = !!strchr(flags, 'i');
|
||||
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 APPC(c) do {if(b>=bufe) return str; *b++=c;} 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)
|
||||
|
||||
regex_t srchrx;
|
||||
regmatch_t pmatch[10];
|
||||
if (regcomp(&srchrx, srch, iflag ? REG_ICASE : 0) != 0)
|
||||
@ -53,7 +53,7 @@ subst(char *str, char *srch, char *repl, char *flags)
|
||||
t++;
|
||||
n = *t++ - '0';
|
||||
}
|
||||
|
||||
|
||||
APP(pmatch[n].rm_so,
|
||||
pmatch[n].rm_eo - pmatch[n].rm_so);
|
||||
} else if (*t == '\\' && *(t+1)) {
|
||||
@ -63,7 +63,7 @@ subst(char *str, char *srch, char *repl, char *flags)
|
||||
APPC(*t++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
i += pmatch[0].rm_eo; // advance to end of match
|
||||
if (!gflag)
|
||||
break;
|
||||
@ -199,7 +199,7 @@ sed(char *file)
|
||||
char *from = strndup(s, t-s-1);
|
||||
char *to = strndup(t, u-t-1);
|
||||
char *flags = strndup(u, e-u);
|
||||
|
||||
|
||||
char *ov = v;
|
||||
v = strdup(subst(ov, from, to, flags));
|
||||
free(ov);
|
||||
@ -232,7 +232,7 @@ sed(char *file)
|
||||
while (*e &&
|
||||
(*e == ' ' || *e == '\t' || *e == '\n' || *e == ';'))
|
||||
e++;
|
||||
|
||||
|
||||
hs = he = 0;
|
||||
if (*e == '/') {
|
||||
e++;
|
||||
@ -244,49 +244,49 @@ sed(char *file)
|
||||
if (*e)
|
||||
e++;
|
||||
}
|
||||
|
||||
|
||||
char sep;
|
||||
char *s;
|
||||
char *h = 0;
|
||||
char *v = 0;
|
||||
switch (*e) {
|
||||
case 'a':
|
||||
if (he != hs) {
|
||||
h = strndup(hs, he-hs);
|
||||
} else {
|
||||
fprintf(stderr, "msed: used command a without header name\n");
|
||||
case 'a':
|
||||
if (he != hs) {
|
||||
h = strndup(hs, he-hs);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
s = ++e;
|
||||
while (*e && *e != sep)
|
||||
e++;
|
||||
v = strndup(s, e-s);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
|
||||
if (blaze822_chdr(msg, h))
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 's':
|
||||
// ignore here;
|
||||
break;
|
||||
printhdr(h, 0);
|
||||
printf(": %s\n", v);
|
||||
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 's':
|
||||
// ignore here;
|
||||
break;
|
||||
}
|
||||
while (*e && *e != ';' && *e != '\n')
|
||||
e++;
|
||||
@ -301,7 +301,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
default:
|
||||
fprintf(stderr, "Usage: msed [expr] [msgs...]\n");
|
||||
exit(1);
|
||||
@ -317,6 +317,6 @@ main(int argc, char *argv[])
|
||||
blaze822_loop1(".", sed);
|
||||
else
|
||||
blaze822_loop(argc-optind, argv+optind, sed);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
8
mseq.c
8
mseq.c
@ -3,9 +3,9 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <search.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "blaze822.h"
|
||||
@ -152,7 +152,7 @@ fix(FILE *out, char *file)
|
||||
|
||||
return 0;
|
||||
ok:
|
||||
while(i--)
|
||||
while (i--)
|
||||
putc(' ', out);
|
||||
fprintf(out, "%s\n", bufptr);
|
||||
return 1;
|
||||
@ -277,7 +277,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "c:frAC:S")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'c': cflag = optarg; break;
|
||||
case 'f': fflag = 1; break;
|
||||
case 'r': rflag = 1; break;
|
||||
@ -285,7 +285,7 @@ main(int argc, char *argv[])
|
||||
case 'C': Cflag = optarg; break;
|
||||
case 'S': Sflag = 1; break;
|
||||
default:
|
||||
usage:
|
||||
usage:
|
||||
fprintf(stderr,
|
||||
"Usage: mseq [-fr] [-c msg] [msgs...]\n"
|
||||
" mseq -S [-fr] < sequence\n"
|
||||
|
58
mshow.c
58
mshow.c
@ -97,7 +97,7 @@ print_u8recode(char *body, size_t bodylen, char *srcenc)
|
||||
final_char = bufptr[-1];
|
||||
}
|
||||
|
||||
if (r != (size_t)-1) { // done, flush iconv
|
||||
if (r != (size_t)-1) { // done, flush iconv
|
||||
bufptr = buf;
|
||||
buflen = sizeof buf;
|
||||
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;
|
||||
int e = filter(body, bodylen, cmd, &output, &outlen);
|
||||
|
||||
if (e == 0) { // replace output
|
||||
if (e == 0 || e == 62) { // replace output (62 == raw)
|
||||
if (!Nflag)
|
||||
printf(" render=\"%s\" ---\n", cmd);
|
||||
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')
|
||||
putchar('\n');
|
||||
}
|
||||
@ -268,7 +271,7 @@ nofilter:
|
||||
strcasecmp(charset, "utf8") == 0 ||
|
||||
strcasecmp(charset, "us-ascii") == 0) {
|
||||
print_ascii(body, bodylen);
|
||||
if (body[bodylen-1] != '\n')
|
||||
if (bodylen > 0 && body[bodylen-1] != '\n')
|
||||
putchar('\n');
|
||||
} else {
|
||||
print_u8recode(body, bodylen, charset);
|
||||
@ -336,7 +339,7 @@ choose_alternative(struct message *msg, int depth)
|
||||
blaze822_mime_action
|
||||
reply_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
||||
{
|
||||
(void) depth;
|
||||
(void)depth;
|
||||
|
||||
char *ct = blaze822_hdr(msg, "content-type");
|
||||
char *mt = mimetype(ct);
|
||||
@ -365,7 +368,7 @@ reply_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
||||
blaze822_mime_action
|
||||
list_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
||||
{
|
||||
(void) body;
|
||||
(void)body;
|
||||
|
||||
char *ct = blaze822_hdr(msg, "content-type");
|
||||
if (!ct)
|
||||
@ -441,7 +444,7 @@ writefile(char *name, char *buf, ssize_t len)
|
||||
blaze822_mime_action
|
||||
extract_mime(int depth, struct message *msg, char *body, size_t bodylen)
|
||||
{
|
||||
(void) depth;
|
||||
(void)depth;
|
||||
|
||||
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);
|
||||
}
|
||||
} else if (filename &&
|
||||
fnmatch(a, filename, FNM_PATHNAME) == 0) {
|
||||
fnmatch(a, filename, FNM_PATHNAME) == 0) {
|
||||
// extract by name
|
||||
if (extract_stdout) {
|
||||
if (rflag) {
|
||||
@ -556,7 +559,7 @@ print_date_header(char *v)
|
||||
|
||||
printf("Date: ");
|
||||
print_ascii(v, strlen(v));
|
||||
|
||||
|
||||
time_t t = blaze822_date(v);
|
||||
if (t == -1) {
|
||||
printf(" (invalid)");
|
||||
@ -572,57 +575,57 @@ print_date_header(char *v)
|
||||
else if (d > 60) l = 'm';
|
||||
else l = 's';
|
||||
int p = 3;
|
||||
|
||||
|
||||
int z;
|
||||
switch(l) {
|
||||
switch (l) {
|
||||
case 'y':
|
||||
z = d / (60*60*24*7*52);
|
||||
d = d % (60*60*24*7*52);
|
||||
if (z > 0) {
|
||||
printf("%d year%s", z, z>1 ? "s" : "");
|
||||
printf("%d year%s", z, z > 1 ? "s" : "");
|
||||
if (!--p) break;
|
||||
printf(", ");
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
/* FALL THROUGH */
|
||||
case 'w':
|
||||
z = d / (60*60*24*7);
|
||||
d = d % (60*60*24*7);
|
||||
if (z > 0) {
|
||||
printf("%d week%s", z, z>1 ? "s" : "");
|
||||
printf("%d week%s", z, z > 1 ? "s" : "");
|
||||
if (!--p) break;
|
||||
printf(", ");
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
/* FALL THROUGH */
|
||||
case 'd':
|
||||
z = d / (60*60*24);
|
||||
d = d % (60*60*24);
|
||||
if (z > 0) {
|
||||
printf("%d day%s", z, z>1 ? "s" : "");
|
||||
printf("%d day%s", z, z > 1 ? "s" : "");
|
||||
if (!--p) break;
|
||||
printf(", ");
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
/* FALL THROUGH */
|
||||
case 'h':
|
||||
z = d / (60*60);
|
||||
d = d % (60*60);
|
||||
if (z > 0) {
|
||||
printf("%d hour%s", z, z>1 ? "s" : "");
|
||||
printf("%d hour%s", z, z > 1 ? "s" : "");
|
||||
if (!--p) break;
|
||||
printf(", ");
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
/* FALL THROUGH */
|
||||
case 'm':
|
||||
z = d / (60);
|
||||
d = d % (60);
|
||||
if (z > 0) {
|
||||
printf("%d minute%s", z, z>1 ? "s" : "");
|
||||
printf("%d minute%s", z, z > 1 ? "s" : "");
|
||||
if (!--p) break;
|
||||
printf(", ");
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
/* FALL THROUGH */
|
||||
case 's':
|
||||
z = d;
|
||||
printf("%d second%s", z, z>1 ? "s" : "");
|
||||
printf("%d second%s", z, z > 1 ? "s" : "");
|
||||
}
|
||||
|
||||
if (t < now)
|
||||
@ -707,7 +710,7 @@ show(char *file)
|
||||
|
||||
printf("\n");
|
||||
|
||||
if (rflag || !blaze822_check_mime(msg)) { // raw body
|
||||
if (rflag) { // raw body
|
||||
print_ascii(blaze822_body(msg), blaze822_bodylen(msg));
|
||||
goto done;
|
||||
}
|
||||
@ -726,7 +729,7 @@ main(int argc, char *argv[])
|
||||
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "h:A:qrtHLNx:O:Rn")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'h': hflag = optarg; break;
|
||||
case 'A': Aflag = optarg; break;
|
||||
case 'q': qflag = 1; break;
|
||||
@ -759,8 +762,13 @@ main(int argc, char *argv[])
|
||||
if (safe_output && isatty(1)) {
|
||||
char *pg;
|
||||
pg = getenv("MBLAZE_PAGER");
|
||||
if (!pg)
|
||||
if (!pg) {
|
||||
pg = getenv("PAGER");
|
||||
if (pg && strcmp(pg, "less") == 0) {
|
||||
static char lesscmd[] = "less -RFXe";
|
||||
pg = lesscmd;
|
||||
}
|
||||
}
|
||||
if (pg && *pg && strcmp(pg, "cat") != 0) {
|
||||
pid2 = pipeto(pg);
|
||||
if (pid2 < 0)
|
||||
|
4
msort.c
4
msort.c
@ -1,5 +1,5 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
@ -301,7 +301,7 @@ main(int argc, char *argv[])
|
||||
int c, i;
|
||||
|
||||
while ((c = getopt(argc, argv, "fdsFMSUIr")) != -1)
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
case 'f': addorder(fromorder); break;
|
||||
case 'd': addorder(dateorder); break;
|
||||
case 's': addorder(subjorder); break;
|
||||
|
22
mthread.c
22
mthread.c
@ -171,7 +171,7 @@ thread(char *file)
|
||||
parent = me;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
v = blaze822_hdr(msg, "in-reply-to");
|
||||
char *irt;
|
||||
if (v) {
|
||||
@ -182,7 +182,7 @@ thread(char *file)
|
||||
if (!v)
|
||||
goto out;
|
||||
irt = strndup(m+1, v-m-1);
|
||||
|
||||
|
||||
if (strcmp(irt, mid) != 0) {
|
||||
parent = midcont(irt);
|
||||
}
|
||||
@ -279,7 +279,7 @@ find_root(const void *nodep, const VISIT which, const int depth)
|
||||
void
|
||||
find_roots()
|
||||
{
|
||||
top = malloc (sizeof (struct container));
|
||||
top = malloc(sizeof (struct container));
|
||||
top->msg = 0;
|
||||
top->date = -1;
|
||||
top->file = 0;
|
||||
@ -388,7 +388,7 @@ print_tree(struct container *c, int depth)
|
||||
else
|
||||
printf("<%s>\n", c->mid);
|
||||
}
|
||||
|
||||
|
||||
if (c->child)
|
||||
print_tree(c->child, depth+1);
|
||||
} while ((c = c->next));
|
||||
@ -404,14 +404,14 @@ main(int argc, char *argv[])
|
||||
if (pledge("stdio rpath tty", NULL) == -1)
|
||||
err(1, "pledge");
|
||||
|
||||
while ((c = getopt(argc, argv, "S:v")) != -1)
|
||||
switch(c) {
|
||||
case 'S': blaze822_loop1(optarg, thread); break;
|
||||
case 'v': vflag = 1; break;
|
||||
default:
|
||||
while ((c = getopt(argc, argv, "S:v")) != -1)
|
||||
switch (c) {
|
||||
case 'S': blaze822_loop1(optarg, thread); break;
|
||||
case 'v': vflag = 1; break;
|
||||
default:
|
||||
fprintf(stderr, "Usage: mthread [-v] [-S dir] [msgs...]\n");
|
||||
exit(1);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
optional = 0;
|
||||
|
||||
|
4
pipeto.c
4
pipeto.c
@ -47,7 +47,7 @@ pipeto(const char *cmdline)
|
||||
break;
|
||||
*cp++ = 0;
|
||||
while (*cp == ' ')
|
||||
cp++;
|
||||
cp++;
|
||||
}
|
||||
argv[argc] = 0;
|
||||
|
||||
@ -96,6 +96,6 @@ pipeclose(pid_t pid)
|
||||
fflush(0);
|
||||
close(1);
|
||||
waitpid(pid, &s, 0);
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "blaze822.h"
|
||||
#include "blaze822_priv.h"
|
||||
|
@ -82,7 +82,7 @@ blaze822_decode_b64(char *s, char *e, char **deco, size_t *decleno)
|
||||
*deco = buf;
|
||||
|
||||
while (s + 4 <= e) {
|
||||
while (s < e && isfws((unsigned char) *s))
|
||||
while (s < e && isfws((unsigned char)*s))
|
||||
s++;
|
||||
if (s >= e)
|
||||
break;
|
||||
@ -90,7 +90,7 @@ blaze822_decode_b64(char *s, char *e, char **deco, size_t *decleno)
|
||||
uint32_t v = 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;
|
||||
|
||||
if ((c0 | c1 | c2 | c3) > 127)
|
||||
@ -273,7 +273,7 @@ nocodeok:
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
int
|
||||
int
|
||||
main() {
|
||||
char *r;
|
||||
size_t l;
|
||||
|
@ -39,7 +39,7 @@ blaze822_mime2231_parameter(char *s, char *name,
|
||||
i = 100;
|
||||
goto found_plain;
|
||||
}
|
||||
|
||||
|
||||
while (i < 100) {
|
||||
snprintf(namenum, sizeof namenum, "%s*%d*", name, i);
|
||||
if (blaze822_mime_parameter(s, namenum, &sbuf, &ebuf)) {
|
||||
@ -48,13 +48,13 @@ found_extended:
|
||||
if (i == 0 || i == 100) { // extended-initial-value
|
||||
char *encstart = sbuf;
|
||||
sbuf = strchr(sbuf, '\'');
|
||||
if (!sbuf)
|
||||
if (!sbuf)
|
||||
return 0;
|
||||
srcenc = strndup(encstart, sbuf - encstart);
|
||||
if (!srcenc)
|
||||
return 0;
|
||||
sbuf = strchr(sbuf+1, '\'');
|
||||
if (!sbuf)
|
||||
if (!sbuf)
|
||||
return 0;
|
||||
sbuf++;
|
||||
}
|
||||
@ -110,7 +110,7 @@ found_plain:
|
||||
|
||||
size_t dstlen = dst - dststart;
|
||||
dst = dststart;
|
||||
|
||||
|
||||
int r = iconv(ic, &dst, &dstlen, &tmpend, &tmplen);
|
||||
if (r < 0) {
|
||||
free(tmp);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void
|
||||
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
|
||||
// - translate CRLF to CR
|
||||
|
||||
unsigned char *s = (unsigned char* )s0;
|
||||
unsigned char *s = (unsigned char *)s0;
|
||||
unsigned char *e = s + l;
|
||||
|
||||
while (s < e) {
|
||||
@ -56,13 +56,13 @@ safe_u8putstr(char *s0, size_t l, FILE *stream)
|
||||
f = (s[0]<<24) | (s[1]<<16);
|
||||
else if (e - s == 1)
|
||||
f = (s[0]<<24);
|
||||
|
||||
|
||||
if ((f & 0xe0c00000) == 0xc0800000) goto u2;
|
||||
else if ((f & 0xf0c0c000) == 0xe0808000) goto u3;
|
||||
else if ((f & 0xf8c0c0c0) == 0xf0808080) {
|
||||
fputc(*s++, stream);
|
||||
u3: fputc(*s++, stream);
|
||||
u2: fputc(*s++, stream);
|
||||
u3: fputc(*s++, stream);
|
||||
u2: fputc(*s++, stream);
|
||||
fputc(*s, stream);
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
if (*start == 0)
|
||||
*start = strchr("=^_", *a) ? cur : 1;
|
||||
*start = strchr("=^_", *a) ? cur : 1;
|
||||
|
||||
while (*a == '^') {
|
||||
a++;
|
||||
@ -428,7 +428,7 @@ blaze822_seq_next(char *map, char *range, struct blaze822_seq_iter *iter)
|
||||
|
||||
if (!iter->start) {
|
||||
int ret = parse_range(map, range, &iter->start, &iter->stop,
|
||||
iter->cur, iter->lines);
|
||||
iter->cur, iter->lines);
|
||||
if (ret == 1) {
|
||||
fprintf(stderr, "can't parse range: %s\n", range);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user