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
0e8eca71
...
0e8eca7175d3da6adcc0efcd654843010f4d91e7
authored
2005-06-15 07:26:00 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Use new pager functions.
1 parent
4d92c48c
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
150 additions
and
218 deletions
mail/delete.c
mail/edit.c
mail/eq.c
mail/file.c
mail/followup.c
mail/from.c
mail/headers.c
mail/hold.c
mail/mail.c
mail/mailline.c
mail/mbox.c
mail/msgset.y
mail/next.c
mail/previous.c
mail/print.c
mail/reply.c
mail/size.c
mail/summary.c
mail/top.c
mail/touch.c
mail/undelete.c
mail/util.c
mail/visual.c
mail/write.c
mail/z.c
mail/delete.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002, 2003
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -29,50 +29,15 @@ mail_delete_msg (msgset_t *mspec, message_t msg, void *data)
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
;
}
cond_page_invalidate
(
mspec
->
msg_part
[
0
]);
return
0
;
}
int
mail_delete
(
int
argc
,
char
**
argv
)
{
int
reset_cursor
=
0
;
int
rc
=
util_foreach_msg
(
argc
,
argv
,
MSG_NODELETED
|
MSG_SILENT
,
mail_delete_msg
,
&
reset_cursor
);
/* Readjust the cursor not to point to the deleted messages. */
if
(
reset_cursor
)
{
unsigned
int
here
;
for
(
here
=
cursor
;
here
<=
total
;
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
;
}
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
;
}
mail_delete_msg
,
NULL
);
if
(
util_getenv
(
NULL
,
"autoprint"
,
Mail_env_boolean
,
0
)
==
0
)
util_do_command
(
"print"
);
...
...
mail/edit.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -30,7 +30,7 @@ edit0 (msgset_t *mspec, message_t msg, void *data)
util_do_command
(
"shell %s %s"
,
getenv
(
"EDITOR"
),
file
);
remove
(
file
);
free
(
file
);
cursor
=
mspec
->
msg_part
[
0
]
;
set_cursor
(
mspec
->
msg_part
[
0
])
;
return
0
;
}
...
...
mail/eq.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002, 2003
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -26,11 +26,16 @@ int
mail_eq
(
int
argc
,
char
**
argv
)
{
msgset_t
*
list
=
NULL
;
size_t
n
;
switch
(
argc
)
{
case
1
:
fprintf
(
ofile
,
"%d
\n
"
,
cursor
);
n
=
get_cursor
();
if
(
n
==
0
)
util_error
(
_
(
"No applicable message"
));
else
fprintf
(
ofile
,
"%u
\n
"
,
n
);
break
;
case
2
:
...
...
@@ -38,8 +43,8 @@ mail_eq (int argc, char **argv)
{
if
(
list
->
msg_part
[
0
]
<=
total
)
{
cursor
=
list
->
msg_part
[
0
]
;
fprintf
(
ofile
,
"%
d
\n
"
,
cursor
);
set_cursor
(
list
->
msg_part
[
0
])
;
fprintf
(
ofile
,
"%
u
\n
"
,
list
->
msg_part
[
0
]
);
}
else
util_error_range
(
list
->
msg_part
[
0
]);
...
...
mail/file.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -113,7 +113,7 @@ mail_file (int argc, char **argv)
mbox
=
newbox
;
mailbox_messages_count
(
mbox
,
&
total
);
cursor
=
1
;
set_cursor
(
1
)
;
if
(
util_getenv
(
NULL
,
"header"
,
Mail_env_boolean
,
0
)
==
0
)
{
util_do_command
(
"summary"
);
...
...
mail/followup.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002, 2003
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -32,12 +32,20 @@ mail_followup (int argc, char **argv)
msgset_t
*
msglist
,
*
mp
;
compose_env_t
env
;
int
status
;
size_t
n
;
compose_init
(
&
env
);
if
(
msgset_parse
(
argc
,
argv
,
MSG_NODELETED
,
&
msglist
))
return
1
;
if
(
util_get_message
(
mbox
,
cursor
,
&
msg
))
n
=
get_cursor
();
if
(
n
==
0
)
{
util_error
(
_
(
"No applicable message"
));
return
1
;
}
if
(
util_get_message
(
mbox
,
n
,
&
msg
))
{
msgset_free
(
msglist
);
return
1
;
...
...
@@ -58,7 +66,7 @@ mail_followup (int argc, char **argv)
}
/* Generate "to" list */
compose_header_set
(
&
env
,
MU_HEADER_TO
,
util_get_sender
(
cursor
,
0
),
compose_header_set
(
&
env
,
MU_HEADER_TO
,
util_get_sender
(
get_cursor
()
,
0
),
COMPOSE_SINGLE_LINE
);
/* Add authors of the subsequent messages to the to list
...
...
mail/from.c
View file @
0e8eca7
...
...
@@ -144,7 +144,7 @@ mail_from0 (msgset_t *mspec, message_t msg, void *data)
fromp
=
from
?
from
:
""
;
subjp
=
subj
?
subj
:
fromp
;
fprintf
(
ofile
,
"%c%c%4d %-18.18s %-16.16s %s %.*s
\n
"
,
mspec
->
msg_part
[
0
]
==
cursor
?
'>'
:
' '
,
cflag
,
is_current_message
(
mspec
->
msg_part
[
0
])
?
'>'
:
' '
,
cflag
,
mspec
->
msg_part
[
0
],
fromp
,
date
,
st
,
(
subjl
<
0
)
?
0
:
subjl
,
subjp
);
...
...
mail/headers.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2003,
2005 Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -30,39 +31,9 @@
int
mail_headers
(
int
argc
,
char
**
argv
)
{
int
low
=
1
,
high
=
total
;
msgset_t
*
list
=
NULL
,
*
mp
;
int
lines
=
util_screen_lines
();
int
num
;
if
(
msgset_parse
(
argc
,
argv
,
MSG_NODELETED
|
MSG_SILENT
,
&
list
))
return
1
;
num
=
0
;
for
(
mp
=
list
;
mp
;
mp
=
mp
->
next
)
num
++
;
if
(
num
==
0
)
return
0
;
lines
=
(
lines
/
num
)
-
2
;
if
(
lines
<
0
)
lines
=
util_screen_lines
();
if
((
unsigned
int
)
lines
<
total
)
{
low
=
list
->
msg_part
[
0
]
-
(
lines
/
2
);
if
(
low
<
1
)
low
=
1
;
high
=
low
+
util_screen_lines
();
if
((
unsigned
int
)
high
>
total
)
{
high
=
total
;
low
=
high
-
lines
;
}
}
util_range_msg
(
low
,
high
,
MSG_NODELETED
|
MSG_SILENT
,
mail_from0
,
NULL
);
msgset_free
(
list
);
if
(
argc
>
1
)
return
mail_from
(
argc
,
argv
);
page_do
(
mail_from0
,
NULL
);
return
0
;
}
...
...
mail/hold.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2001
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -31,7 +31,7 @@ hold0 (msgset_t *mspec, message_t msg, void *data)
message_get_attribute
(
msg
,
&
attr
);
attribute_unset_userflag
(
attr
,
MAIL_ATTRIBUTE_MBOXED
);
cursor
=
mspec
->
msg_part
[
0
]
;
set_cursor
(
mspec
->
msg_part
[
0
])
;
return
0
;
}
...
...
mail/mail.c
View file @
0e8eca7
...
...
@@ -20,13 +20,13 @@
#include "mail.h"
/* Global variables and constants*/
mailbox_t
mbox
;
unsigned
int
cursor
;
size_t
total
;
FILE
*
ofile
;
int
interactive
;
mailbox_t
mbox
;
/* Mailbox being operated upon */
size_t
total
;
/* Total number of messages in the mailbox */
FILE
*
ofile
;
/* Output file */
int
interactive
;
/* Is the session interactive */
static
list_t
command_list
;
static
list_t
command_list
;
/* List of commands to be executed after parsing
command line */
const
char
*
program_version
=
"mail ("
PACKAGE_STRING
")"
;
static
char
doc
[]
=
N_
(
"GNU mail -- the standard /bin/mail interface"
);
...
...
@@ -286,7 +286,7 @@ main (int argc, char **argv)
int
i
,
rc
;
ofile
=
stdout
;
cursor
=
1
;
set_cursor
(
1
)
;
/* Native Language Support */
mu_init_nls
();
...
...
@@ -495,9 +495,11 @@ main (int argc, char **argv)
void
mail_mainloop
(
char
*
(
*
input
)
__P
((
void
*
,
int
)),
void
*
closure
,
int
do_history
)
mail_mainloop
(
char
*
(
*
input
)
__P
((
void
*
,
int
)),
void
*
closure
,
int
do_history
)
{
char
*
command
,
*
cmd
;
while
((
command
=
(
*
input
)(
closure
,
0
))
!=
NULL
)
{
int
len
=
strlen
(
command
);
...
...
@@ -558,3 +560,4 @@ mail_warranty (int argc ARG_UNUSED, char **argv ARG_UNUSED)
return
0
;
}
...
...
mail/mailline.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -39,6 +39,7 @@ sig_handler (int signo)
case
SIGWINCH
:
util_do_command
(
"set screen=%d"
,
util_getlines
());
util_do_command
(
"set columns=%d"
,
util_getcols
());
page_invalidate
(
1
);
break
;
#endif
}
...
...
mail/mbox.c
View file @
0e8eca7
...
...
@@ -31,7 +31,7 @@ mbox0 (msgset_t *mspec, message_t msg, void *data)
attribute_set_userflag
(
attr
,
MAIL_ATTRIBUTE_MBOXED
);
util_mark_read
(
msg
);
cursor
=
mspec
->
msg_part
[
0
]
;
set_cursor
(
mspec
->
msg_part
[
0
])
;
return
0
;
}
...
...
mail/msgset.y
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -73,11 +74,11 @@ static msgset_t *result;
input : /* empty */
{
result = msgset_make_1 (
cursor
);
result = msgset_make_1 (
get_cursor ()
);
}
| '.'
{
result = msgset_make_1 (
cursor
);
result = msgset_make_1 (
get_cursor ()
);
}
| msgset
{
...
...
@@ -390,7 +391,7 @@ msgset_count (msgset_t *set)
/* Create a message set consisting of a single msg_num and no subparts */
msgset_t *
msgset_make_1 (
in
t number)
msgset_make_1 (
size_
t number)
{
msgset_t *mp;
...
...
mail/next.c
View file @
0e8eca7
...
...
@@ -34,8 +34,8 @@ mail_next (int argc, char **argv)
int
rc
;
attribute_t
attr
=
NULL
;
rc
=
util_get_message
(
mbox
,
cursor
,
&
msg
);
if
(
rc
)
n
=
get_cursor
(
);
if
(
n
==
0
||
util_get_message
(
mbox
,
n
,
&
msg
)
)
{
util_error
(
_
(
"No applicable message"
));
return
1
;
...
...
@@ -49,7 +49,7 @@ mail_next (int argc, char **argv)
}
rc
=
1
;
for
(
n
=
cursor
+
1
;
n
<=
total
;
n
++
)
while
(
++
n
<=
total
)
{
if
(
util_isdeleted
(
n
))
continue
;
...
...
@@ -81,7 +81,7 @@ mail_next (int argc, char **argv)
return
1
;
}
}
cursor
=
n
;
set_cursor
(
n
)
;
util_do_command
(
"print"
);
return
0
;
}
...
...
mail/previous.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002, 2003
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -32,14 +32,17 @@ mail_previous (int argc, char **argv)
if
(
argc
<
2
)
{
int
rc
=
1
;
for
(
n
=
cursor
-
1
;
n
>
0
;
n
--
)
{
if
(
util_isdeleted
(
n
))
continue
;
rc
=
util_get_message
(
mbox
,
n
,
&
msg
);
if
(
rc
==
0
)
break
;
}
n
=
get_cursor
();
if
(
n
)
while
(
--
n
>
0
)
{
if
(
util_isdeleted
(
n
))
continue
;
rc
=
util_get_message
(
mbox
,
n
,
&
msg
);
if
(
rc
==
0
)
break
;
}
if
(
rc
)
{
...
...
@@ -64,7 +67,7 @@ mail_previous (int argc, char **argv)
return
1
;
}
}
cursor
=
n
;
set_cursor
(
n
)
;
util_do_command
(
"print"
);
return
0
;
}
...
...
mail/print.c
View file @
0e8eca7
...
...
@@ -35,7 +35,6 @@ mail_print_msg (msgset_t *mspec, message_t mesg, void *data)
off_t
off
=
0
;
size_t
n
=
0
,
lines
=
0
;
FILE
*
out
=
ofile
;
attribute_t
attr
;
int
pagelines
=
util_get_crt
();
message_lines
(
mesg
,
&
lines
);
...
...
@@ -106,7 +105,7 @@ mail_print_msg (msgset_t *mspec, message_t mesg, void *data)
util_mark_read
(
mesg
);
cursor
=
mspec
->
msg_part
[
0
]
;
set_cursor
(
mspec
->
msg_part
[
0
])
;
return
0
;
}
...
...
mail/reply.c
View file @
0e8eca7
...
...
@@ -54,7 +54,7 @@ reply0 (msgset_t *mspec, message_t msg, void *data)
int
status
;
char
*
str
;
cursor
=
mspec
->
msg_part
[
0
]
;
set_cursor
(
mspec
->
msg_part
[
0
])
;
compose_init
(
&
env
);
...
...
mail/size.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
Copyright (C) 1999, 2001
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -31,7 +31,7 @@ size0 (msgset_t *mspec, message_t msg, void *data)
message_lines
(
msg
,
&
lines
);
fprintf
(
ofile
,
"%c%2d %3d/%-5d
\n
"
,
mspec
->
msg_part
[
0
]
==
cursor
?
'>'
:
' '
,
is_current_message
(
mspec
->
msg_part
[
0
])
?
'>'
:
' '
,
mspec
->
msg_part
[
0
],
lines
,
size
);
return
0
;
}
...
...
mail/summary.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -20,7 +20,7 @@
/* Simple summary dysplaying a blurb on the name of the
mailbox and how many new:deleted:read messages.
The side effect is that i
s set the cursor/
cursor
The side effect is that i
t sets the
cursor
to the newest or read message number. */
int
mail_summary
(
int
argc
ARG_UNUSED
,
char
**
argv
ARG_UNUSED
)
...
...
@@ -73,7 +73,7 @@ mail_summary (int argc ARG_UNUSED, char **argv ARG_UNUSED)
printf
(
"
\n
"
);
/* Set the cursor. */
cursor
=
(
first_new
==
0
)
?
((
first_unread
==
0
)
?
1
:
first_unread
)
:
first_new
;
set_cursor
(
(
first_new
==
0
)
?
((
first_unread
==
0
)
?
1
:
first_unread
)
:
first_new
)
;
return
0
;
}
...
...
mail/top.c
View file @
0e8eca7
...
...
@@ -43,7 +43,7 @@ top0 (msgset_t *mspec, message_t msg, void *data)
break
;
fprintf
(
ofile
,
"%s"
,
buf
);
}
cursor
=
mspec
->
msg_part
[
0
]
;
set_cursor
(
mspec
->
msg_part
[
0
])
;
util_mark_read
(
msg
);
...
...
mail/touch.c
View file @
0e8eca7
...
...
@@ -36,7 +36,8 @@ touch0 (msgset_t *mspec, message_t msg, void *data)
util_mark_read
(
msg
);
}
cursor
=
mspec
->
msg_part
[
0
];
set_cursor
(
mspec
->
msg_part
[
0
]);
return
0
;
}
int
...
...
mail/undelete.c
View file @
0e8eca7
...
...
@@ -30,9 +30,8 @@ undelete0 (msgset_t *mspec, message_t msg, void *data)
message_get_attribute
(
msg
,
&
attr
);
attribute_unset_deleted
(
attr
);
util_mark_read
(
msg
);
cond_page_invalidate
(
mspec
->
msg_part
[
0
]);
if
(
cursor
==
0
)
cursor
=
mspec
->
msg_part
[
0
];
return
0
;
}
...
...
mail/util.c
View file @
0e8eca7
...
...
@@ -193,17 +193,31 @@ util_foreach_msg (int argc, char **argv, int flags,
return
status
;
}
in
t
size_
t
util_range_msg
(
size_t
low
,
size_t
high
,
int
flags
,
msg_handler_t
func
,
void
*
data
)
{
msgset_t
msgspec
=
{
0
};
int
count
=
0
;
size_t
count
,
expect_count
;
msgspec
.
next
=
NULL
;
msgspec
.
npart
=
0
;
msgspec
.
msg_part
=
&
low
;
for
(;
low
<=
high
;
low
++
)
if
(
!
func
)
flags
|=
MSG_SILENT
;
if
(
low
>
total
)
return
0
;
if
(
!
(
flags
&
MSG_COUNT
))
{
if
(
high
<
low
)
return
0
;
expect_count
=
high
-
low
+
1
;
}
else
expect_count
=
high
;
for
(
count
=
0
;
count
<
expect_count
&&
low
<=
total
;
low
++
)
{
message_t
mesg
;
...
...
@@ -218,7 +232,8 @@ util_range_msg (size_t low, size_t high, int flags,
if
(
util_get_message
(
mbox
,
low
,
&
mesg
)
==
0
)
{
count
++
;
func
(
&
msgspec
,
mesg
,
data
)
;
if
(
func
)
func
(
&
msgspec
,
mesg
,
data
)
;
/* Bail out if we receive an interrupt. */
if
(
ml_got_interrupt
()
!=
0
)
break
;
...
...
@@ -545,27 +560,6 @@ util_setenv (const char *variable, void *value, mail_env_data_t type,
case
Mail_env_string
:
ep
->
value
.
string
=
strdup
(
value
);
if
(
strcmp
(
variable
,
"replyregex"
)
==
0
)
{
int
rc
;
char
*
err
;
if
(
rc
=
munre_set_regex
(
value
,
0
,
&
err
))
{
fprintf
(
stderr
,
"%s"
,
mu_strerror
(
rc
));
if
(
err
)
{
fprintf
(
stderr
,
"%s"
,
err
);
free
(
err
);
}
fprintf
(
stderr
,
"
\n
"
);
}
}
else
if
(
strcmp
(
variable
,
"decode-fallback"
)
==
0
)
{
if
(
mu_set_default_fallback
(
value
))
mu_error
(
_
(
"Incorrect value for decode-fallback"
));
}
break
;
case
Mail_env_boolean
:
...
...
@@ -576,6 +570,31 @@ util_setenv (const char *variable, void *value, mail_env_data_t type,
}
}
/* Special handling for some variables */
if
(
strcmp
(
variable
,
"replyregex"
)
==
0
)
{
int
rc
;
char
*
err
;
if
(
rc
=
munre_set_regex
(
value
,
0
,
&
err
))
{
fprintf
(
stderr
,
"%s"
,
mu_strerror
(
rc
));
if
(
err
)
{
fprintf
(
stderr
,
"%s"
,
err
);
free
(
err
);
}
fprintf
(
stderr
,
"
\n
"
);
}
}
else
if
(
strcmp
(
variable
,
"decode-fallback"
)
==
0
)
{
if
(
mu_set_default_fallback
(
value
))
mu_error
(
_
(
"Incorrect value for decode-fallback"
));
}
else
if
(
strcmp
(
variable
,
"screen"
)
==
0
)
page_invalidate
(
1
);
return
0
;
}
...
...
mail/visual.c
View file @
0e8eca7
...
...
@@ -36,7 +36,7 @@ visual0 (msgset_t *mspec, message_t msg, void *data)
/* Mark as read */
util_mark_read
(
msg
);
cursor
=
mspec
->
msg_part
[
0
]
;
set_cursor
(
mspec
->
msg_part
[
0
])
;
return
0
;
}
...
...
mail/write.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002, 2003
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -42,8 +42,14 @@ mail_write (int argc, char **argv)
filename
=
util_outfolder_name
(
argv
[
--
argc
]);
else
{
size_t
n
=
get_cursor
();
char
*
p
=
NULL
;
asprintf
(
&
p
,
"%d"
,
cursor
);
if
(
n
==
0
)
{
util_error
(
_
(
"No applicable message"
));
return
1
;
}
asprintf
(
&
p
,
"%u"
,
n
);
filename
=
util_outfolder_name
(
p
);
free
(
p
);
}
...
...
mail/z.c
View file @
0e8eca7
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2001, 2002
, 2005
Free Software Foundation, Inc.
GNU Mailutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -107,46 +107,27 @@ z_parse_args(int argc, char **argv,
int
mail_z
(
int
argc
,
char
**
argv
)
{
unsigned
int
i
,
nlines
;
unsigned
int
pagelines
=
util_screen_lines
();
unsigned
int
count
;
int
dir
;
int
crs
,
end
;
unsigned
int
pagelines
=
util_screen_lines
()
;
if
(
z_parse_args
(
argc
,
argv
,
&
count
,
&
dir
))
return
1
;
nlines
=
pagelines
;
count
*=
pagelines
;
crs
=
cursor
;
switch
(
dir
)
{
case
D_BWD
:
if
(
crs
<
nlines
)
if
(
page_move
(
-
count
)
==
0
)
{
fprintf
(
stdout
,
_
(
"On first screenful of messages
\n
"
));
return
0
;
}
if
(
crs
<
count
)
crs
=
1
;
else
crs
-=
count
;
break
;
case
D_FWD
:
if
(
crs
+
pagelines
>
total
)
{
fprintf
(
stdout
,
_
(
"On last screenful of messages
\n
"
));
return
0
;
}
crs
+=
count
;
if
(
crs
+
nlines
>
total
)
nlines
=
total
-
crs
+
1
;
if
(
nlines
<=
0
)
if
(
page_move
(
count
)
==
0
)
{
fprintf
(
stdout
,
_
(
"On last screenful of messages
\n
"
));
return
0
;
...
...
@@ -160,43 +141,13 @@ 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 crs 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
(
crs
>
(
unsigned
int
)
lastpage
)
{
crs
=
lastpage
;
if
(
crs
+
nlines
>
total
)
nlines
=
total
-
crs
;
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
;
}
cursor
=
crs
;
end
=
cursor
+
nlines
-
1
;
i
=
0
;
do
{
int
cnt
=
util_range_msg
(
crs
,
end
,
MSG_NODELETED
|
MSG_SILENT
,
mail_from0
,
NULL
);
if
(
cnt
==
0
)
real crs set by summary() to the new message.
FIXME: Basically it's the same as headers now. Do we need
it still? */
break
;
i
+=
cnt
;
crs
+=
nlines
;
}
}
while
(
i
<
nlines
&&
crs
<=
total
);
return
1
;
page_do
(
mail_from0
,
NULL
);
return
0
;
}
...
...
Please
register
or
sign in
to post a comment