Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
83fd9e40
...
83fd9e40c3c4f6b7bc9556b72152b0ac01773b97
authored
2002-12-29 13:37:43 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Rewritten using new iterator functions.
1 parent
7d408629
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
196 additions
and
196 deletions
mail/delete.c
mail/dp.c
mail/edit.c
mail/eq.c
mail/file.c
mail/from.c
mail/headers.c
mail/hold.c
mail/mbox.c
mail/next.c
mail/previous.c
mail/print.c
mail/reply.c
mail/size.c
mail/summary.c
mail/top.c
mail/undelete.c
mail/var.c
mail/visual.c
mail/z.c
mail/delete.c
View file @
83fd9e4
...
...
@@ -22,47 +22,55 @@
*/
static
int
mail_delete
0
(
void
)
mail_delete
_msg
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
message_t
msg
;
attribute_t
attr
;
if
(
util_get_message
(
mbox
,
cursor
,
&
msg
,
MSG_NODELETED
))
return
1
;
message_get_attribute
(
msg
,
&
attr
);
attribute_set_deleted
(
attr
);
if
(
cursor
==
mspec
->
msg_part
[
0
])
{
/* deleting current message. let the caller know */
*
(
int
*
)
data
=
1
;
}
return
0
;
}
int
mail_delete
(
int
argc
,
char
**
argv
)
{
int
rc
=
0
;
int
reset_cursor
=
0
;
int
rc
=
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
,
mail_delete_msg
,
&
reset_cursor
);
if
(
argc
>
1
)
rc
=
util_msglist_command
(
mail_delete
,
argc
,
argv
,
0
);
else
rc
=
mail_delete0
();
/* Readjust the realcursor to no point to the deleted messages. */
if
(
cursor
==
realcursor
)
/* Readjust the cursor not to point to the deleted messages. */
if
(
reset_cursor
)
{
unsigned
int
here
=
realcursor
;
do
unsigned
int
here
;
for
(
here
=
cursor
;
here
<=
total
;
here
++
)
{
message_t
msg
=
NULL
;
attribute_t
attr
=
NULL
;
mailbox_get_message
(
mbox
,
realcursor
,
&
msg
);
mailbox_get_message
(
mbox
,
here
,
&
msg
);
message_get_attribute
(
msg
,
&
attr
);
if
(
!
attribute_is_deleted
(
attr
))
break
;
if
(
++
realcursor
>
total
)
realcursor
=
1
;
}
while
(
realcursor
!=
here
);
cursor
=
realcursor
;
if
(
here
>
total
)
for
(
here
=
cursor
;
here
>
0
;
here
--
)
{
message_t
msg
=
NULL
;
attribute_t
attr
=
NULL
;
mailbox_get_message
(
mbox
,
here
,
&
msg
);
message_get_attribute
(
msg
,
&
attr
);
if
(
!
attribute_is_deleted
(
attr
))
break
;
}
cursor
=
here
;
}
if
(
util_getenv
(
NULL
,
"autoprint"
,
Mail_env_boolean
,
0
)
==
0
)
...
...
mail/dp.c
View file @
83fd9e4
...
...
@@ -25,10 +25,7 @@
int
mail_dp
(
int
argc
,
char
**
argv
)
{
if
(
argc
>
1
)
util_msglist_command
(
mail_delete
,
argc
,
argv
,
0
);
else
util_do_command
(
"delete"
);
mail_delete
(
argc
,
argv
);
util_do_command
(
"print"
);
return
0
;
}
...
...
mail/edit.c
View file @
83fd9e4
...
...
@@ -21,19 +21,21 @@
* e[dit] [msglist]
*/
int
mail_edit
(
int
argc
,
char
**
argv
)
static
int
edit0
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
if
(
argc
>
1
)
return
util_msglist_command
(
mail_edit
,
argc
,
argv
,
1
);
else
{
char
*
file
=
mu_tempname
(
NULL
);
util_do_command
(
"copy %s"
,
file
);
util_do_command
(
"shell %s %s"
,
getenv
(
"EDITOR"
),
file
);
remove
(
file
);
free
(
file
);
cursor
=
mspec
->
msg_part
[
0
];
return
0
;
}
return
1
;
}
int
mail_edit
(
int
argc
,
char
**
argv
)
{
return
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
,
edit0
,
NULL
);
}
...
...
mail/eq.c
View file @
83fd9e4
...
...
@@ -29,7 +29,7 @@ mail_eq (int argc, char **argv)
switch
(
argc
)
{
case
1
:
fprintf
(
ofile
,
"%d
\n
"
,
real
cursor
);
fprintf
(
ofile
,
"%d
\n
"
,
cursor
);
break
;
case
2
:
...
...
@@ -37,8 +37,8 @@ mail_eq (int argc, char **argv)
{
if
(
list
->
msg_part
[
0
]
<=
total
)
{
realcursor
=
cursor
=
list
->
msg_part
[
0
];
fprintf
(
ofile
,
"%d
\n
"
,
real
cursor
);
cursor
=
list
->
msg_part
[
0
];
fprintf
(
ofile
,
"%d
\n
"
,
cursor
);
}
else
util_error_range
(
list
->
msg_part
[
0
]);
...
...
mail/file.c
View file @
83fd9e4
...
...
@@ -111,7 +111,7 @@ mail_file (int argc, char **argv)
mbox
=
newbox
;
mailbox_messages_count
(
mbox
,
&
total
);
cursor
=
realcursor
=
1
;
cursor
=
1
;
if
(
util_getenv
(
NULL
,
"header"
,
Mail_env_boolean
,
0
)
==
0
)
{
util_do_command
(
"summary"
);
...
...
mail/from.c
View file @
83fd9e4
...
...
@@ -22,19 +22,8 @@
*/
int
mail_from
(
int
argc
,
char
**
argv
)
mail_from
0
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
if
(
argc
>
1
)
return
util_msglist_command
(
mail_from
,
argc
,
argv
,
0
);
else
return
mail_from0
(
cursor
,
1
);
return
1
;
}
int
mail_from0
(
int
msgno
,
int
verbose
)
{
message_t
msg
;
header_t
hdr
=
NULL
;
envelope_t
env
;
attribute_t
attr
;
...
...
@@ -48,10 +37,6 @@ mail_from0 (int msgno, int verbose)
struct
tm
tm
;
mu_timezone
tz
;
if
(
util_get_message
(
mbox
,
msgno
,
&
msg
,
MSG_NODELETED
|
(
verbose
?
0
:
MSG_SILENT
)))
return
1
;
message_get_header
(
msg
,
&
hdr
);
if
(
header_aget_value
(
hdr
,
MU_HEADER_FROM
,
&
from
)
==
0
)
{
...
...
@@ -113,7 +98,8 @@ mail_from0 (int msgno, int verbose)
fromp
=
from
?
from
:
""
;
subjp
=
subj
?
subj
:
fromp
;
fprintf
(
ofile
,
"%c%c%4d %-18.18s %-16.16s %s %.*s
\n
"
,
msgno
==
realcursor
?
'>'
:
' '
,
cflag
,
msgno
,
mspec
->
msg_part
[
0
]
==
cursor
?
'>'
:
' '
,
cflag
,
mspec
->
msg_part
[
0
],
fromp
,
date
,
st
,
(
subjl
<
0
)
?
0
:
subjl
,
subjp
);
free
(
from
);
...
...
@@ -121,3 +107,10 @@ mail_from0 (int msgno, int verbose)
return
0
;
}
int
mail_from
(
int
argc
,
char
**
argv
)
{
return
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
,
mail_from0
,
NULL
);
}
...
...
mail/headers.c
View file @
83fd9e4
...
...
@@ -52,7 +52,7 @@ mail_headers (int argc, char **argv)
low
=
list
->
msg_part
[
0
]
-
(
lines
/
2
);
if
(
low
<
1
)
low
=
1
;
high
=
low
+
lines
;
high
=
low
+
util_screen_lines
()
;
if
((
unsigned
int
)
high
>
total
)
{
high
=
total
;
...
...
@@ -60,8 +60,7 @@ mail_headers (int argc, char **argv)
}
}
for
(;
low
<=
high
;
low
++
)
mail_from0
(
low
,
0
);
util_range_msg
(
low
,
high
,
MSG_NODELETED
|
MSG_SILENT
,
mail_from0
,
NULL
);
msgset_free
(
list
);
return
0
;
...
...
mail/hold.c
View file @
83fd9e4
...
...
@@ -22,21 +22,22 @@
* pre[serve] [msglist]
*/
int
mail_hold
(
int
argc
,
char
**
argv
)
static
int
hold0
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
message_t
msg
;
attribute_t
attr
;
if
(
argc
>
1
)
return
util_msglist_command
(
mail_hold
,
argc
,
argv
,
1
);
else
{
if
(
util_get_message
(
mbox
,
cursor
,
&
msg
,
MSG_ALL
))
return
1
;
message_get_attribute
(
msg
,
&
attr
);
attribute_unset_userflag
(
attr
,
MAIL_ATTRIBUTE_MBOXED
);
}
cursor
=
mspec
->
msg_part
[
0
];
return
0
;
}
int
mail_hold
(
int
argc
,
char
**
argv
)
{
return
util_foreach_msg
(
argc
,
argv
,
MSG_ALL
,
hold0
,
NULL
);
}
...
...
mail/mbox.c
View file @
83fd9e4
...
...
@@ -21,22 +21,21 @@
* mb[ox] [msglist]
*/
int
m
ail_mbox
(
int
argc
,
char
**
argv
)
static
int
m
box0
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
message_t
msg
;
attribute_t
attr
;
if
(
argc
>
1
)
return
util_msglist_command
(
mail_mbox
,
argc
,
argv
,
1
);
else
{
if
(
util_get_message
(
mbox
,
cursor
,
&
msg
,
MSG_NODELETED
))
return
1
;
/* Mark the message */
message_get_attribute
(
msg
,
&
attr
);
attribute_set_userflag
(
attr
,
MAIL_ATTRIBUTE_MBOXED
);
}
cursor
=
mspec
->
msg_part
[
0
];
return
0
;
}
int
mail_mbox
(
int
argc
,
char
**
argv
)
{
return
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
,
mbox0
,
NULL
);
}
...
...
mail/next.c
View file @
83fd9e4
...
...
@@ -53,7 +53,7 @@ mail_next (int argc, char **argv)
if
(
util_get_message
(
mbox
,
n
,
&
msg
,
MSG_NODELETED
|
MSG_SILENT
))
return
1
;
}
cursor
=
realcursor
=
n
;
cursor
=
n
;
util_do_command
(
"print"
);
return
0
;
}
...
...
mail/previous.c
View file @
83fd9e4
...
...
@@ -53,7 +53,7 @@ mail_previous (int argc, char **argv)
if
(
util_get_message
(
mbox
,
n
,
&
msg
,
MSG_NODELETED
|
MSG_SILENT
))
return
1
;
}
cursor
=
realcursor
=
n
;
cursor
=
n
;
util_do_command
(
"print"
);
return
0
;
}
...
...
mail/print.c
View file @
83fd9e4
...
...
@@ -24,14 +24,9 @@
* T[ype] [msglist]
*/
int
mail_print
(
int
argc
,
char
**
argv
)
static
int
mail_print
_msg
(
msgset_t
*
mspec
,
message_t
mesg
,
void
*
data
)
{
if
(
argc
>
1
)
return
util_msglist_command
(
mail_print
,
argc
,
argv
,
1
);
else
{
message_t
mesg
;
header_t
hdr
;
body_t
body
;
stream_t
stream
;
...
...
@@ -42,9 +37,6 @@ mail_print (int argc, char **argv)
attribute_t
attr
;
int
pagelines
=
util_get_crt
();
if
(
util_get_message
(
mbox
,
cursor
,
&
mesg
,
MSG_NODELETED
))
return
1
;
message_lines
(
mesg
,
&
lines
);
/* If it is POP or IMAP the lines number is not known, so try
...
...
@@ -66,7 +58,7 @@ mail_print (int argc, char **argv)
if
(
pagelines
&&
lines
>
pagelines
)
out
=
popen
(
getenv
(
"PAGER"
),
"w"
);
if
(
islower
(
argv
[
0
][
0
]))
if
(
*
(
int
*
)
data
)
/* print was called with a lowercase 'p' */
{
size_t
i
,
num
=
0
;
char
buf
[
512
];
...
...
@@ -109,7 +101,17 @@ mail_print (int argc, char **argv)
message_get_attribute
(
mesg
,
&
attr
);
attribute_set_read
(
attr
);
cursor
=
mspec
->
msg_part
[
0
];
return
0
;
}
return
1
;
}
int
mail_print
(
int
argc
,
char
**
argv
)
{
int
lower
=
islower
(
argv
[
0
][
0
]);
int
rc
=
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
,
mail_print_msg
,
&
lower
);
return
rc
;
}
...
...
mail/reply.c
View file @
83fd9e4
...
...
@@ -169,13 +169,8 @@ make_references (compose_env_t *env, message_t msg)
*/
int
mail_reply
(
int
argc
,
char
**
argv
)
reply0
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
if
(
argc
>
1
)
return
util_msglist_command
(
mail_reply
,
argc
,
argv
,
1
);
else
{
message_t
msg
;
header_t
hdr
;
compose_env_t
env
;
int
status
;
...
...
@@ -183,15 +178,12 @@ mail_reply (int argc, char **argv)
compose_init
(
&
env
);
if
(
util_get_message
(
mbox
,
cursor
,
&
msg
,
MSG_NODELETED
))
return
1
;
message_get_header
(
msg
,
&
hdr
);
compose_header_set
(
&
env
,
MU_HEADER_TO
,
util_get_sender
(
cursor
,
0
),
compose_header_set
(
&
env
,
MU_HEADER_TO
,
util_get_sender
(
mspec
->
msg_part
[
0
]
,
0
),
COMPOSE_SINGLE_LINE
);
if
(
islower
(
argv
[
0
][
0
]))
if
(
*
(
int
*
)
data
)
/* reply starts with a lowercase */
{
/* Add all recepients of the originate letter */
...
...
@@ -247,7 +239,16 @@ mail_reply (int argc, char **argv)
make_references
(
&
env
,
msg
);
status
=
mail_send0
(
&
env
,
0
);
compose_destroy
(
&
env
);
cursor
=
mspec
->
msg_part
[
0
];
return
status
;
}
return
1
;
}
int
mail_reply
(
int
argc
,
char
**
argv
)
{
int
lower
=
islower
(
argv
[
0
][
0
]);
return
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
,
reply0
,
&
lower
);
}
...
...
mail/size.c
View file @
83fd9e4
...
...
@@ -21,25 +21,24 @@
* si[ze] [msglist]
*/
int
mail_size
(
int
argc
,
char
**
argv
)
static
int
size0
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
if
(
argc
>
1
)
util_msglist_command
(
mail_size
,
argc
,
argv
,
0
);
else
{
size_t
size
=
0
,
lines
=
0
;
message_t
msg
;
if
(
util_get_message
(
mbox
,
cursor
,
&
msg
,
MSG_ALL
))
return
1
;
message_size
(
msg
,
&
size
);
message_lines
(
msg
,
&
lines
);
fprintf
(
ofile
,
"%c%2d %3d/%-5d
\n
"
,
cursor
==
realcursor
?
'>'
:
' '
,
cursor
,
lines
,
size
);
fprintf
(
ofile
,
"%c%2d %3d/%-5d
\n
"
,
mspec
->
msg_part
[
0
]
==
cursor
?
'>'
:
' '
,
mspec
->
msg_part
[
0
],
lines
,
size
);
return
0
;
}
return
1
;
}
int
mail_size
(
int
argc
,
char
**
argv
)
{
return
util_foreach_msg
(
argc
,
argv
,
MSG_ALL
,
size0
,
NULL
);
}
...
...
mail/summary.c
View file @
83fd9e4
...
...
@@ -19,7 +19,7 @@
/* Simple summary dysplaying a blurb on the name of the
mailbox and how many new:deleted:read messages.
The side effect is that is set the cursor/
real
cursor
The side effect is that is set the cursor/cursor
to the newest or read message number. */
int
mail_summary
(
int
argc
,
char
**
argv
)
...
...
@@ -73,7 +73,7 @@ mail_summary (int argc, char **argv)
printf
(
"
\n
"
);
/* Set the cursor. */
cursor
=
realcursor
=
(
first_new
==
0
)
?
((
first_unread
==
0
)
?
cursor
=
(
first_new
==
0
)
?
((
first_unread
==
0
)
?
1
:
first_unread
)
:
first_new
;
return
0
;
}
...
...
mail/top.c
View file @
83fd9e4
...
...
@@ -21,14 +21,9 @@
* to[p] [msglist]
*/
int
mail_top
(
int
argc
,
char
**
argv
)
static
int
top0
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
if
(
argc
>
1
)
return
util_msglist_command
(
mail_top
,
argc
,
argv
,
1
);
else
{
message_t
msg
;
stream_t
stream
;
char
buf
[
512
];
size_t
n
;
...
...
@@ -39,9 +34,6 @@ mail_top (int argc, char **argv)
||
lines
<
0
)
return
1
;
if
(
util_get_message
(
mbox
,
cursor
,
&
msg
,
MSG_NODELETED
))
return
1
;
message_get_stream
(
msg
,
&
stream
);
for
(
n
=
0
,
off
=
0
;
lines
>
0
;
lines
--
,
off
+=
n
)
{
...
...
@@ -50,7 +42,13 @@ mail_top (int argc, char **argv)
break
;
fprintf
(
ofile
,
"%s"
,
buf
);
}
cursor
=
mspec
->
msg_part
[
0
];
return
0
;
}
return
1
;
}
int
mail_top
(
int
argc
,
char
**
argv
)
{
return
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
,
top0
,
NULL
);
}
...
...
mail/undelete.c
View file @
83fd9e4
...
...
@@ -21,22 +21,19 @@
* u[ndelete] [msglist]
*/
int
mail_undelete
(
int
argc
,
char
**
argv
)
static
int
undelete0
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
if
(
argc
>
1
)
return
util_msglist_command
(
mail_undelete
,
argc
,
argv
,
1
);
else
{
message_t
msg
;
attribute_t
attr
;
if
(
util_get_message
(
mbox
,
cursor
,
&
msg
,
MSG_ALL
))
return
1
;
message_get_attribute
(
msg
,
&
attr
);
if
(
attribute_is_deleted
(
attr
))
attribute_unset_deleted
(
attr
);
return
0
;
}
return
1
;
}
int
mail_undelete
(
int
argc
,
char
**
argv
)
{
return
util_foreach_msg
(
argc
,
argv
,
MSG_ALL
,
undelete0
,
NULL
);
}
...
...
mail/var.c
View file @
83fd9e4
...
...
@@ -436,14 +436,10 @@ var_insert (int argc, char **argv, compose_env_t *send_env)
/* ~m[mesg-list] */
/* ~M[mesg-list] */
int
var_quote
(
int
argc
,
char
**
argv
,
compose_env_t
*
env
)
quote0
(
msgset_t
*
mspec
,
message_t
mesg
,
void
*
data
)
{
if
(
argc
>
1
)
return
util_msglist_esccmd
(
var_quote
,
argc
,
argv
,
env
,
0
);
else
{
message_t
mesg
;
header_t
hdr
;
body_t
body
;
stream_t
stream
;
...
...
@@ -452,14 +448,11 @@ var_quote (int argc, char **argv, compose_env_t *env)
size_t
n
=
0
;
char
*
prefix
=
"
\t
"
;
if
(
util_get_message
(
mbox
,
cursor
,
&
mesg
,
MSG_NODELETED
))
return
1
;
fprintf
(
stdout
,
_
(
"Interpolating: %d
\n
"
),
cursor
);
fprintf
(
stdout
,
_
(
"Interpolating: %d
\n
"
),
mspec
->
msg_part
[
0
]);
util_getenv
(
&
prefix
,
"indentprefix"
,
Mail_env_string
,
0
);
if
(
islower
(
argv
[
0
][
0
])
)
if
(
*
(
int
*
)
data
)
{
size_t
i
,
num
=
0
;
char
buf
[
512
];
...
...
@@ -505,8 +498,15 @@ var_quote (int argc, char **argv, compose_env_t *env)
fprintf
(
ofile
,
"%s%s"
,
prefix
,
buffer
);
off
+=
n
;
}
return
0
;
}
int
var_quote
(
int
argc
,
char
**
argv
,
compose_env_t
*
env
)
{
int
lower
=
islower
(
argv
[
0
][
0
]);
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
|
MSG_SILENT
,
quote0
,
&
lower
);
var_continue
();
}
return
0
;
}
...
...
mail/visual.c
View file @
83fd9e4
...
...
@@ -21,14 +21,9 @@
* v[isual] [msglist]
*/
int
mail_visual
(
int
argc
,
char
**
argv
)
static
int
visual0
(
msgset_t
*
mspec
,
message_t
msg
,
void
*
data
)
{
if
(
argc
>
1
)
return
util_msglist_command
(
mail_visual
,
argc
,
argv
,
1
);
else
{
message_t
msg
=
NULL
;
attribute_t
attr
=
NULL
;
char
*
file
=
mu_tempname
(
NULL
);
...
...
@@ -39,11 +34,17 @@ mail_visual (int argc, char **argv)
free
(
file
);
/* Mark as read */
mailbox_get_message
(
mbox
,
cursor
,
&
msg
);
message_get_attribute
(
msg
,
&
attr
);
attribute_set_read
(
attr
);
cursor
=
mspec
->
msg_part
[
0
];
return
0
;
}
return
1
;
}
int
mail_visual
(
int
argc
,
char
**
argv
)
{
return
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
,
visual0
,
NULL
);
}
...
...
mail/z.c
View file @
83fd9e4
...
...
@@ -31,7 +31,8 @@
*/
static
int
z_parse_args
(
int
argc
,
char
**
argv
,
unsigned
int
*
return_count
,
int
*
return_dir
)
z_parse_args
(
int
argc
,
char
**
argv
,
unsigned
int
*
return_count
,
int
*
return_dir
)
{
int
count
=
1
;
int
mul
=
1
;
...
...
@@ -109,6 +110,7 @@ mail_z (int argc, char **argv)
unsigned
int
pagelines
=
util_screen_lines
();
unsigned
int
count
;
int
dir
;
int
crs
;
if
(
z_parse_args
(
argc
,
argv
,
&
count
,
&
dir
))
return
1
;
...
...
@@ -116,31 +118,32 @@ mail_z (int argc, char **argv)
nlines
=
pagelines
;
count
*=
pagelines
;
crs
=
cursor
;
switch
(
dir
)
{
case
D_BWD
:
if
(
c
ursor
<
nlines
)
if
(
c
rs
<
nlines
)
{
fprintf
(
stdout
,
_
(
"On first screenful of messages
\n
"
));
return
0
;
}
if
(
c
ursor
<
count
)
c
ursor
=
1
;
if
(
c
rs
<
count
)
c
rs
=
1
;
else
c
ursor
-=
count
;
c
rs
-=
count
;
break
;
case
D_FWD
:
if
(
c
ursor
+
pagelines
>
total
)
if
(
c
rs
+
pagelines
>
total
)
{
fprintf
(
stdout
,
_
(
"On last screenful of messages
\n
"
));
return
0
;
}
c
ursor
+=
count
;
c
rs
+=
count
;
if
(
c
ursor
+
nlines
>
total
)
nlines
=
total
-
c
ursor
+
1
;
if
(
c
rs
+
nlines
>
total
)
nlines
=
total
-
c
rs
+
1
;
if
(
nlines
<=
0
)
{
...
...
@@ -156,43 +159,43 @@ mail_z (int argc, char **argv)
of the last message. This behaviour is used on startup
when displaying the summary and the headers, new messages
are last but we want to display a screenful with the
real c
ursor
set by summary() to the new message. */
real c
rs
set by summary() to the new message. */
/* Find the start of the last screen page. */
int
lastpage
=
total
-
pagelines
+
1
;
if
(
lastpage
<=
0
)
lastpage
=
1
;
if
(
c
ursor
>
(
unsigned
int
)
lastpage
)
if
(
c
rs
>
(
unsigned
int
)
lastpage
)
{
realcursor
=
cursor
;
cursor
=
lastpage
;
crs
=
lastpage
;
if
(
c
ursor
+
nlines
>
total
)
nlines
=
total
-
c
ursor
+
1
;
if
(
c
rs
+
nlines
>
total
)
nlines
=
total
-
c
rs
;
for
(
i
=
0
;
i
<
nlines
;
i
++
)
{
mail_from0
(
cursor
,
0
);
cursor
++
;
}
cursor
=
realcursor
;
util_range_msg
(
crs
,
crs
+
nlines
,
MSG_NODELETED
|
MSG_SILENT
,
mail_from0
,
NULL
);
return
1
;
}
else
if
(
crs
+
nlines
>
total
)
nlines
=
total
-
crs
+
1
;
}
break
;
}
realcursor
=
cursor
;
cursor
=
crs
;
for
(
i
=
0
;
i
<
nlines
&&
cursor
<=
total
;
)
i
=
0
;
do
{
if
(
mail_from0
(
cursor
,
0
)
==
0
)
i
++
;
cursor
++
;
int
cnt
=
util_range_msg
(
crs
,
crs
+
nlines
-
1
,
MSG_NODELETED
|
MSG_SILENT
,
mail_from0
,
NULL
);
if
(
cnt
==
0
)
break
;
i
+=
cnt
;
crs
+=
nlines
;
}
cursor
=
realcursor
;
while
(
i
<
nlines
&&
crs
<=
total
);
return
1
;
}
...
...
Please
register
or
sign in
to post a comment