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
df07ce7d
...
df07ce7dc7115193dac0b1f15a1dfa1d338e540d
authored
2010-12-11 20:15:17 +0200
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
mail: use mu_strout; remove util_error in favor of mu_error.
1 parent
a52aac19
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
188 additions
and
211 deletions
mail/alias.c
mail/alt.c
mail/copy.c
mail/decode.c
mail/echo.c
mail/envelope.c
mail/eq.c
mail/escape.c
mail/file.c
mail/folders.c
mail/followup.c
mail/from.c
mail/if.c
mail/inc.c
mail/mail.c
mail/mail.h
mail/mailline.c
mail/mailvar.c
mail/msgset.y
mail/next.c
mail/previous.c
mail/print.c
mail/quit.c
mail/reply.c
mail/retain.c
mail/send.c
mail/setenv.c
mail/shell.c
mail/size.c
mail/source.c
mail/struct.c
mail/summary.c
mail/top.c
mail/unalias.c
mail/util.c
mail/version.c
mail/write.c
mail/z.c
mail/alias.c
View file @
df07ce7
...
...
@@ -36,9 +36,9 @@ alias_free (void *data)
static
void
alias_print_group
(
const
char
*
name
,
alias_t
al
)
{
mu_
stream_printf
(
ostream
,
"%s "
,
name
);
mu_
printf
(
"%s "
,
name
);
util_slist_print
(
al
->
list
,
0
);
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"
\n
"
);
}
static
alias_t
...
...
@@ -75,7 +75,7 @@ alias_print (char *name)
al
=
alias_lookup
(
name
);
if
(
!
al
)
{
util
_error
(
_
(
"
\"
%s
\"
: not a group"
),
name
);
mu
_error
(
_
(
"
\"
%s
\"
: not a group"
),
name
);
return
;
}
alias_print_group
(
name
,
al
);
...
...
mail/alt.c
View file @
df07ce7
...
...
@@ -34,7 +34,7 @@ mail_alt (int argc, char **argv)
if
(
alternate_names
)
{
util_slist_print
(
alternate_names
,
0
);
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"
\n
"
);
}
}
else
...
...
@@ -60,7 +60,7 @@ mail_set_my_name (char *name)
struct
passwd
*
pw
=
getpwuid
(
getuid
());
if
(
!
pw
)
{
util
_error
(
_
(
"Cannot determine my username"
));
mu
_error
(
_
(
"Cannot determine my username"
));
exit
(
1
);
}
name
=
pw
->
pw_name
;
...
...
@@ -69,7 +69,7 @@ mail_set_my_name (char *name)
my_email
=
mu_get_user_email
(
name
);
if
(
!
my_email
)
{
util
_error
(
_
(
"Cannot determine my email address: %s"
),
mu
_error
(
_
(
"Cannot determine my email address: %s"
),
mu_strerror
(
errno
));
exit
(
1
);
}
...
...
mail/copy.c
View file @
df07ce7
...
...
@@ -64,7 +64,7 @@ mail_copy0 (int argc, char **argv, int mark)
if
((
status
=
mu_mailbox_create_default
(
&
mbx
,
filename
))
!=
0
)
{
util
_error
(
_
(
"Cannot create mailbox %s: %s"
),
filename
,
mu
_error
(
_
(
"Cannot create mailbox %s: %s"
),
filename
,
mu_strerror
(
status
));
free
(
filename
);
msgset_free
(
msglist
);
...
...
@@ -72,7 +72,7 @@ mail_copy0 (int argc, char **argv, int mark)
}
if
((
status
=
mu_mailbox_open
(
mbx
,
MU_STREAM_WRITE
|
MU_STREAM_CREAT
))
!=
0
)
{
util
_error
(
_
(
"Cannot open mailbox %s: %s"
),
filename
,
mu
_error
(
_
(
"Cannot open mailbox %s: %s"
),
filename
,
mu_strerror
(
status
));
free
(
filename
);
msgset_free
(
msglist
);
...
...
@@ -88,7 +88,7 @@ mail_copy0 (int argc, char **argv, int mark)
status
=
mu_mailbox_append_message
(
mbx
,
msg
);
if
(
status
)
{
util
_error
(
_
(
"Cannot append message: %s"
),
mu_strerror
(
status
));
mu
_error
(
_
(
"Cannot append message: %s"
),
mu_strerror
(
status
));
break
;
}
...
...
@@ -106,7 +106,7 @@ mail_copy0 (int argc, char **argv, int mark)
}
if
(
status
==
0
)
mu_
stream_printf
(
ostream
,
"
\"
%s
\"
%3lu/%-5lu
\n
"
,
filename
,
mu_
printf
(
"
\"
%s
\"
%3lu/%-5lu
\n
"
,
filename
,
(
unsigned
long
)
total_lines
,
(
unsigned
long
)
total_size
);
mu_mailbox_close
(
mbx
);
...
...
mail/decode.c
View file @
df07ce7
...
...
@@ -275,7 +275,7 @@ display_submessage (struct mime_descend_closure *closure, void *data)
else
stream
=
b_stream
;
display_part_header
(
ostream
,
display_part_header
(
mu_strout
,
closure
->
msgset
,
closure
->
type
,
closure
->
encoding
);
...
...
@@ -328,7 +328,7 @@ print_stream (mu_stream_t stream, mu_stream_t out)
{
if
(
ml_got_interrupt
())
{
util
_error
(
_
(
"
\n
Interrupt"
));
mu
_error
(
_
(
"
\n
Interrupt"
));
break
;
}
buffer
[
n
]
=
'\0'
;
...
...
@@ -368,12 +368,12 @@ run_metamail (const char *mailcap_cmd, mu_message_t mesg)
sigemptyset
(
&
ignore
.
sa_mask
);
if
(
sigaction
(
SIGINT
,
&
ignore
,
&
saveintr
)
<
0
)
{
util
_error
(
"sigaction: %s"
,
strerror
(
errno
));
mu
_error
(
"sigaction: %s"
,
strerror
(
errno
));
return
;
}
if
(
sigaction
(
SIGQUIT
,
&
ignore
,
&
savequit
)
<
0
)
{
util
_error
(
"sigaction: %s"
,
strerror
(
errno
));
mu
_error
(
"sigaction: %s"
,
strerror
(
errno
));
sigaction
(
SIGINT
,
&
saveintr
,
NULL
);
return
;
}
...
...
@@ -391,7 +391,7 @@ run_metamail (const char *mailcap_cmd, mu_message_t mesg)
pid
=
fork
();
if
(
pid
<
0
)
{
util
_error
(
"fork: %s"
,
strerror
(
errno
));
mu
_error
(
"fork: %s"
,
strerror
(
errno
));
}
else
if
(
pid
==
0
)
{
...
...
mail/echo.c
View file @
df07ce7
...
...
@@ -50,7 +50,7 @@ echo (char *s)
}
else
{
mu_
stream_printf
(
ostream
,
"%s"
,
ws
.
ws_wordv
[
0
]);
mu_
printf
(
"%s"
,
ws
.
ws_wordv
[
0
]);
mu_wordsplit_free
(
&
ws
);
}
return
rc
;
...
...
@@ -66,9 +66,9 @@ mail_echo (int argc, char **argv)
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
echo
(
argv
[
i
]))
mu_
stream_printf
(
ostream
,
" "
);
mu_
printf
(
" "
);
}
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"
\n
"
);
}
return
0
;
}
...
...
mail/envelope.c
View file @
df07ce7
...
...
@@ -38,8 +38,8 @@ print_envelope (msgset_t *mspec, mu_message_t msg, void *data)
mu_envelope_sget_sender
(
env
,
&
sender
);
mu_envelope_sget_date
(
env
,
&
date
);
if
(
data
)
mu_
stream_printf
(
ostream
,
"%s "
,
(
char
*
)
data
);
mu_
stream_printf
(
ostream
,
"%s %s"
,
sender
,
date
);
mu_
printf
(
"%s "
,
(
char
*
)
data
);
mu_
printf
(
"%s %s"
,
sender
,
date
);
}
return
0
;
}
...
...
mail/eq.c
View file @
df07ce7
...
...
@@ -32,9 +32,9 @@ mail_eq (int argc, char **argv)
case
1
:
n
=
get_cursor
();
if
(
n
==
0
)
util
_error
(
_
(
"No applicable message"
));
mu
_error
(
_
(
"No applicable message"
));
else
mu_
stream_printf
(
ostream
,
"%lu
\n
"
,
(
unsigned
long
)
n
);
mu_
printf
(
"%lu
\n
"
,
(
unsigned
long
)
n
);
break
;
case
2
:
...
...
@@ -43,7 +43,7 @@ mail_eq (int argc, char **argv)
if
(
list
->
msg_part
[
0
]
<=
total
)
{
set_cursor
(
list
->
msg_part
[
0
]);
mu_
stream_printf
(
ostream
,
"%lu
\n
"
,
mu_
printf
(
"%lu
\n
"
,
(
unsigned
long
)
list
->
msg_part
[
0
]);
}
else
...
...
mail/escape.c
View file @
df07ce7
...
...
@@ -29,7 +29,7 @@ dump_headers (mu_stream_t out, compose_env_t *env)
rc
=
mu_header_get_streamref
(
env
->
header
,
&
stream
);
if
(
rc
)
{
util
_error
(
"mu_header_get_streamref: %s"
,
mu
_error
(
"mu_header_get_streamref: %s"
,
mu_stream_strerror
(
stream
,
rc
));
return
;
}
...
...
@@ -55,7 +55,7 @@ parse_headers (mu_stream_t input, compose_env_t *env)
if
((
status
=
mu_header_create
(
&
header
,
NULL
,
0
))
!=
0
)
{
util
_error
(
_
(
"Cannot create header: %s"
),
mu_strerror
(
status
));
mu
_error
(
_
(
"Cannot create header: %s"
),
mu_strerror
(
status
));
return
1
;
}
...
...
@@ -91,7 +91,7 @@ parse_headers (mu_stream_t input, compose_env_t *env)
}
else
{
util
_error
(
_
(
"%d: not a header line"
),
line
);
mu
_error
(
_
(
"%d: not a header line"
),
line
);
errcnt
++
;
}
}
...
...
@@ -117,7 +117,7 @@ parse_headers (mu_stream_t input, compose_env_t *env)
}
else
{
util
_error
(
_
(
"%d: not a header line"
),
line
);
mu
_error
(
_
(
"%d: not a header line"
),
line
);
errcnt
++
;
}
}
...
...
@@ -153,7 +153,7 @@ parse_headers (mu_stream_t input, compose_env_t *env)
static
void
escape_continue
(
void
)
{
mu_
stream_printf
(
ostream
,
_
(
"(continue)
\n
"
));
mu_
printf
(
_
(
"(continue)
\n
"
));
}
static
int
...
...
@@ -163,7 +163,7 @@ escape_check_args (int argc, char **argv)
{
char
*
escape
=
"~"
;
mailvar_get
(
&
escape
,
"escape"
,
mailvar_type_string
,
0
);
util
_error
(
_
(
"%c%s requires an argument"
),
escape
[
0
],
argv
[
0
]);
mu
_error
(
_
(
"%c%s requires an argument"
),
escape
[
0
],
argv
[
0
]);
return
1
;
}
return
0
;
...
...
@@ -183,7 +183,6 @@ escape_command (int argc, char **argv, compose_env_t *env)
{
const
struct
mail_command_entry
*
entry
;
int
status
;
mu_stream_t
s
;
if
(
escape_check_args
(
argc
,
argv
))
return
1
;
...
...
@@ -192,20 +191,16 @@ escape_command (int argc, char **argv, compose_env_t *env)
entry
=
mail_find_command
(
argv
[
1
]);
if
(
!
entry
)
{
util
_error
(
_
(
"Unknown command: %s"
),
argv
[
1
]);
mu
_error
(
_
(
"Unknown command: %s"
),
argv
[
1
]);
return
1
;
}
if
(
entry
->
flags
&
(
EF_FLOW
|
EF_SEND
))
{
util
_error
(
_
(
"Command not allowed in an escape sequence
\n
"
));
mu
_error
(
_
(
"Command not allowed in an escape sequence
\n
"
));
return
1
;
}
/* FIXME: Do we need this? */
s
=
ostream
;
ostream
=
env
->
compstr
;
status
=
(
*
entry
->
func
)
(
argc
-
1
,
argv
+
1
);
ostream
=
s
;
return
status
;
}
...
...
@@ -242,10 +237,10 @@ escape_sign (int argc MU_ARG_UNUSED, char **argv, compose_env_t *env)
rc
=
mu_file_stream_create
(
&
signstr
,
name
,
MU_STREAM_READ
);
if
(
rc
)
util
_error
(
_
(
"Cannot open %s: %s"
),
name
,
mu_strerror
(
rc
));
mu
_error
(
_
(
"Cannot open %s: %s"
),
name
,
mu_strerror
(
rc
));
else
{
mu_
stream_printf
(
ostream
,
_
(
"Reading %s
\n
"
),
name
);
mu_
printf
(
_
(
"Reading %s
\n
"
),
name
);
mu_stream_copy
(
env
->
compstr
,
signstr
,
0
,
NULL
);
mu_stream_destroy
(
&
signstr
);
}
...
...
@@ -297,7 +292,7 @@ verbose_copy (mu_stream_t dest, mu_stream_t src, const char *filename,
}
if
(
rc
)
mu_error
(
_
(
"error copying data: %s"
),
mu_strerror
(
rc
));
mu_
stream_printf
(
ostream
,
"
\"
%s
\"
%lu/%lu
\n
"
,
filename
,
mu_
printf
(
"
\"
%s
\"
%lu/%lu
\n
"
,
filename
,
(
unsigned
long
)
lines
,
(
unsigned
long
)
total
);
if
(
psize
)
*
psize
=
total
;
...
...
@@ -314,7 +309,7 @@ escape_deadletter (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED,
int
rc
=
mu_file_stream_create
(
&
str
,
name
,
MU_STREAM_READ
);
if
(
rc
)
{
util
_error
(
_
(
"Cannot open file %s: %s"
),
name
,
strerror
(
rc
));
mu
_error
(
_
(
"Cannot open file %s: %s"
),
name
,
strerror
(
rc
));
return
1
;
}
verbose_copy
(
env
->
compstr
,
str
,
name
,
NULL
);
...
...
@@ -488,7 +483,7 @@ quote0 (msgset_t *mspec, mu_message_t mesg, void *data)
mu_stream_t
flt
;
char
*
argv
[
3
];
mu_
stream_printf
(
ostream
,
_
(
"Interpolating: %lu
\n
"
),
mu_
printf
(
_
(
"Interpolating: %lu
\n
"
),
(
unsigned
long
)
mspec
->
msg_part
[
0
]);
mailvar_get
(
&
prefix
,
"indentprefix"
,
mailvar_type_string
,
0
);
...
...
@@ -534,7 +529,7 @@ quote0 (msgset_t *mspec, mu_message_t mesg, void *data)
if
(
rc
)
{
util
_error
(
_
(
"get_streamref error: %s"
),
mu_strerror
(
rc
));
mu
_error
(
_
(
"get_streamref error: %s"
),
mu_strerror
(
rc
));
return
rc
;
}
...
...
@@ -563,10 +558,10 @@ int
escape_type_input
(
int
argc
,
char
**
argv
,
compose_env_t
*
env
)
{
/* FIXME: Enable paging */
mu_
stream_printf
(
ostream
,
_
(
"Message contains:
\n
"
));
dump_headers
(
ostream
,
env
);
mu_
printf
(
_
(
"Message contains:
\n
"
));
dump_headers
(
mu_strout
,
env
);
mu_stream_seek
(
env
->
compstr
,
0
,
MU_SEEK_SET
,
NULL
);
mu_stream_copy
(
ostream
,
env
->
compstr
,
0
,
NULL
);
mu_stream_copy
(
mu_strout
,
env
->
compstr
,
0
,
NULL
);
escape_continue
();
return
0
;
}
...
...
@@ -586,7 +581,7 @@ escape_read (int argc, char **argv, compose_env_t *env MU_ARG_UNUSED)
rc
=
mu_file_stream_create
(
&
instr
,
filename
,
MU_STREAM_READ
);
if
(
rc
)
{
util
_error
(
_
(
"Cannot open %s: %s"
),
filename
,
mu_strerror
(
rc
));
mu
_error
(
_
(
"Cannot open %s: %s"
),
filename
,
mu_strerror
(
rc
));
free
(
filename
);
return
1
;
}
...
...
@@ -636,7 +631,7 @@ escape_write (int argc, char **argv, compose_env_t *env)
MU_STREAM_WRITE
|
MU_STREAM_CREAT
);
if
(
rc
)
{
util
_error
(
_
(
"Cannot open %s for writing: %s"
),
mu
_error
(
_
(
"Cannot open %s for writing: %s"
),
filename
,
mu_strerror
(
rc
));
free
(
filename
);
return
1
;
...
...
@@ -663,7 +658,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
if
(
pipe
(
p
))
{
util
_error
(
"pipe: %s"
,
mu_strerror
(
errno
));
mu
_error
(
"pipe: %s"
,
mu_strerror
(
errno
));
return
1
;
}
...
...
@@ -675,7 +670,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
close
(
p
[
0
]);
close
(
p
[
1
]);
close
(
fd
);
util
_error
(
"fork: %s"
,
mu_strerror
(
errno
));
mu
_error
(
"fork: %s"
,
mu_strerror
(
errno
));
return
1
;
}
else
if
(
pid
==
0
)
...
...
@@ -693,7 +688,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
close
(
fd
);
execvp
(
argv
[
1
],
argv
+
1
);
util
_error
(
_
(
"Cannot execute `%s': %s"
),
argv
[
1
],
mu_strerror
(
errno
));
mu
_error
(
_
(
"Cannot execute `%s': %s"
),
argv
[
1
],
mu_strerror
(
errno
));
_exit
(
127
);
}
...
...
@@ -714,13 +709,13 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
waitpid
(
pid
,
&
status
,
0
);
if
(
!
WIFEXITED
(
status
))
util
_error
(
_
(
"Child terminated abnormally: %d"
),
mu
_error
(
_
(
"Child terminated abnormally: %d"
),
WEXITSTATUS
(
status
));
else
{
struct
stat
st
;
if
(
fstat
(
fd
,
&
st
))
util
_error
(
_
(
"Cannot stat output file: %s"
),
mu_strerror
(
errno
));
mu
_error
(
_
(
"Cannot stat output file: %s"
),
mu_strerror
(
errno
));
else
osize
=
st
.
st_size
;
}
...
...
@@ -738,7 +733,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
MU_STREAM_RDWR
|
MU_STREAM_SEEK
);
if
(
rc
)
{
util
_error
(
_
(
"Cannot open composition stream: %s"
),
mu
_error
(
_
(
"Cannot open composition stream: %s"
),
mu_strerror
(
rc
));
close
(
fd
);
}
...
...
mail/file.c
View file @
df07ce7
...
...
@@ -37,7 +37,7 @@ mail_expand_name (const char *name)
case
'#'
:
if
(
!
prev_name
)
{
util
_error
(
_
(
"No previous file"
));
mu
_error
(
_
(
"No previous file"
));
return
NULL
;
}
else
...
...
@@ -47,7 +47,7 @@ mail_expand_name (const char *name)
case
'&'
:
name
=
getenv
(
"MBOX"
);
if
(
!
name
)
util
_error
(
_
(
"MBOX environment variable not set"
));
mu
_error
(
_
(
"MBOX environment variable not set"
));
else
name
=
xstrdup
(
name
);
break
;
...
...
@@ -91,7 +91,7 @@ mail_file (int argc, char **argv)
||
(
status
=
mu_mailbox_open
(
newbox
,
MU_STREAM_RDWR
))
!=
0
)
{
mu_mailbox_destroy
(
&
newbox
);
util
_error
(
_
(
"Cannot open mailbox %s: %s"
),
name
,
mu_strerror
(
status
));
mu
_error
(
_
(
"Cannot open mailbox %s: %s"
),
name
,
mu_strerror
(
status
));
free
(
name
);
return
1
;
}
...
...
@@ -126,7 +126,7 @@ mail_file (int argc, char **argv)
}
else
{
util_error
(
_
(
"%s takes only one argument"
),
argv
[
0
]);
mu_error
(
_
(
"%s takes only one argument"
),
argv
[
0
]);
}
return
1
;
}
...
...
mail/folders.c
View file @
df07ce7
...
...
@@ -34,7 +34,7 @@ mail_folders (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
char
*
tmp
=
alloca
(
strlen
(
path
)
+
3
);
if
(
!
tmp
)
{
util
_error
(
_
(
"Not enough memory"
));
mu
_error
(
_
(
"Not enough memory"
));
return
1
;
}
...
...
mail/followup.c
View file @
df07ce7
...
...
@@ -40,7 +40,7 @@ mail_followup (int argc, char **argv)
n
=
get_cursor
();
if
(
n
==
0
)
{
util
_error
(
_
(
"No applicable message"
));
mu
_error
(
_
(
"No applicable message"
));
return
1
;
}
...
...
@@ -77,9 +77,9 @@ mail_followup (int argc, char **argv)
msgset_free
(
msglist
);
mu_
stream_printf
(
ostream
,
"To: %s
\n
"
,
mu_
printf
(
"To: %s
\n
"
,
compose_header_get
(
&
env
,
MU_HEADER_TO
,
""
));
mu_
stream_printf
(
ostream
,
"Subject: %s
\n\n
"
,
mu_
printf
(
"Subject: %s
\n\n
"
,
compose_header_get
(
&
env
,
MU_HEADER_SUBJECT
,
""
));
status
=
mail_send0
(
&
env
,
mu_isupper
(
argv
[
0
][
0
]));
...
...
mail/from.c
View file @
df07ce7
...
...
@@ -72,7 +72,7 @@ static void
format_pad
(
size_t
n
)
{
for
(;
n
;
n
--
)
mu_stream_write
(
ostream
,
" "
,
1
,
NULL
);
mu_stream_write
(
mu_strout
,
" "
,
1
,
NULL
);
}
static
void
...
...
@@ -113,17 +113,17 @@ format_headline (struct header_segm *seg, msgset_t *mspec, mu_message_t msg)
if
(
seg
->
align
==
ALIGN_RIGHT
)
{
format_pad
(
width
-
len
);
mu_
stream_printf
(
ostream
,
"%*.*s"
,
(
int
)
len
,
(
int
)
len
,
p
);
mu_
printf
(
"%*.*s"
,
(
int
)
len
,
(
int
)
len
,
p
);
}
else
{
mu_
stream_printf
(
ostream
,
"%*.*s"
,
(
int
)
len
,
(
int
)
len
,
p
);
mu_
printf
(
"%*.*s"
,
(
int
)
len
,
(
int
)
len
,
p
);
format_pad
(
width
-
len
);
}
out_cols
+=
width
;
}
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"
\n
"
);
free
(
args
.
buf
);
}
...
...
mail/if.c
View file @
df07ce7
...
...
@@ -52,7 +52,7 @@ _cond_push(int val)
if
(
!
_cond_stack
)
{
util
_error
(
_
(
"Not enough memory"
));
mu
_error
(
_
(
"Not enough memory"
));
exit
(
EXIT_FAILURE
);
}
_cond_stack
[
_cond_level
++
]
=
val
;
...
...
@@ -63,7 +63,7 @@ _cond_pop()
{
if
(
_cond_level
==
0
)
{
util
_error
(
_
(
"Internal error: condition stack underflow"
));
mu
_error
(
_
(
"Internal error: condition stack underflow"
));
abort
();
}
return
_cond_stack
[
--
_cond_level
];
...
...
@@ -86,13 +86,13 @@ mail_if (int argc, char **argv)
if
(
argc
!=
2
)
{
/* TRANSLATORS: 'if' is the function name. Do not translate it */
util
_error
(
_
(
"if requires an argument: s | r | t"
));
mu
_error
(
_
(
"if requires an argument: s | r | t"
));
return
1
;
}
if
(
argv
[
1
][
1
]
!=
0
)
{
util
_error
(
_
(
"Valid if arguments are: s | r | t"
));
mu
_error
(
_
(
"Valid if arguments are: s | r | t"
));
return
1
;
}
...
...
@@ -116,7 +116,7 @@ mail_if (int argc, char **argv)
cond
=
isatty
(
fileno
(
stdout
));
break
;
default:
util
_error
(
_
(
"Valid if arguments are: s | r | t"
));
mu
_error
(
_
(
"Valid if arguments are: s | r | t"
));
return
1
;
}
}
...
...
@@ -133,7 +133,7 @@ mail_else (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
if
(
_cond_level
==
0
)
{
/* TRANSLATORS: 'else' and 'if' are function names. Do not translate them */
util
_error
(
_
(
"else without matching if"
));
mu
_error
(
_
(
"else without matching if"
));
return
1
;
}
cond
=
_cond_pop
();
...
...
@@ -149,7 +149,7 @@ mail_endif (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
if
(
_cond_level
==
0
)
{
/* TRANSLATORS: 'endif' and 'if' are function names. Do not translate them */
util_error
(
_
(
"endif without matching if"
));
mu_error
(
_
(
"endif without matching if"
));
return
1
;
}
_cond_pop
();
...
...
mail/inc.c
View file @
df07ce7
...
...
@@ -27,10 +27,10 @@ mail_inc (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
if
(
!
mu_mailbox_is_updated
(
mbox
))
{
mu_mailbox_messages_count
(
mbox
,
&
total
);
mu_
stream_printf
(
ostream
,
_
(
"New mail has arrived.
\n
"
));
mu_
printf
(
_
(
"New mail has arrived.
\n
"
));
}
else
mu_
stream_printf
(
ostream
,
_
(
"No new mail for %s
\n
"
),
mail_whoami
());
mu_
printf
(
_
(
"No new mail for %s
\n
"
),
mail_whoami
());
return
0
;
}
...
...
mail/mail.c
View file @
df07ce7
...
...
@@ -21,7 +21,6 @@
/* Global variables and constants*/
mu_mailbox_t
mbox
;
/* Mailbox being operated upon */
size_t
total
;
/* Total number of messages in the mailbox */
mu_stream_t
ostream
;
/* Output stream */
int
interactive
;
/* Is the session interactive */
static
mu_list_t
command_list
;
/* List of commands to be executed after parsing
...
...
@@ -221,20 +220,20 @@ mail_cmdline (void *closure, int cont MU_ARG_UNUSED)
{
mu_mailbox_messages_count
(
mbox
,
&
total
);
page_invalidate
(
0
);
mu_
stream_printf
(
ostream
,
_
(
"New mail has arrived.
\n
"
));
mu_
printf
(
_
(
"New mail has arrived.
\n
"
));
}
rc
=
ml_readline
(
prompt
);
if
(
ml_got_interrupt
())
{
util
_error
(
_
(
"Interrupt"
));
mu
_error
(
_
(
"Interrupt"
));
continue
;
}
if
(
!
rc
&&
mailvar_get
(
NULL
,
"ignoreeof"
,
mailvar_type_boolean
,
0
)
==
0
)
{
util
_error
(
_
(
"Use
\"
quit
\"
to quit."
));
mu
_error
(
_
(
"Use
\"
quit
\"
to quit."
));
continue
;
}
...
...
@@ -325,8 +324,6 @@ main (int argc, char **argv)
int
i
,
rc
;
mu_stdstream_setup
();
ostream
=
mu_strout
;
mu_stream_ref
(
mu_strout
);
set_cursor
(
1
);
/* Native Language Support */
...
...
@@ -446,10 +443,10 @@ main (int argc, char **argv)
if
((
rc
=
mu_mailbox_create_default
(
&
mbox
,
args
.
file
))
!=
0
)
{
if
(
args
.
file
)
util
_error
(
_
(
"Cannot create mailbox %s: %s"
),
args
.
file
,
mu
_error
(
_
(
"Cannot create mailbox %s: %s"
),
args
.
file
,
mu_strerror
(
rc
));
else
util
_error
(
_
(
"Cannot create mailbox: %s"
),
mu
_error
(
_
(
"Cannot create mailbox: %s"
),
mu_strerror
(
rc
));
exit
(
EXIT_FAILURE
);
}
...
...
@@ -458,7 +455,7 @@ main (int argc, char **argv)
{
mu_url_t
url
=
NULL
;
mu_mailbox_get_url
(
mbox
,
&
url
);
util
_error
(
_
(
"Cannot open mailbox %s: %s"
),
mu
_error
(
_
(
"Cannot open mailbox %s: %s"
),
mu_url_to_string
(
url
),
mu_strerror
(
rc
));
mu_mailbox_destroy
(
&
mbox
);
}
...
...
@@ -471,7 +468,7 @@ main (int argc, char **argv)
{
mu_url_t
url
=
NULL
;
mu_mailbox_get_url
(
mbox
,
&
url
);
util
_error
(
_
(
"Cannot read mailbox %s: %s"
),
mu
_error
(
_
(
"Cannot read mailbox %s: %s"
),
mu_url_to_string
(
url
),
mu_strerror
(
rc
));
exit
(
EXIT_FAILURE
);
}
...
...
@@ -487,7 +484,7 @@ main (int argc, char **argv)
do_and_quit
(
"from *"
);
else
if
(
strcmp
(
mode
,
"read"
))
{
util
_error
(
_
(
"Unknown mode `%s'"
),
mode
);
mu
_error
(
_
(
"Unknown mode `%s'"
),
mode
);
util_do_command
(
"quit"
);
return
1
;
}
...
...
@@ -498,9 +495,9 @@ main (int argc, char **argv)
||
mailvar_get
(
NULL
,
"emptystart"
,
mailvar_type_boolean
,
0
)))
{
if
(
args
.
file
)
mu_
stream_printf
(
ostream
,
_
(
"%s: 0 messages
\n
"
),
args
.
file
);
mu_
printf
(
_
(
"%s: 0 messages
\n
"
),
args
.
file
);
else
mu_
stream_printf
(
ostream
,
_
(
"No mail for %s
\n
"
),
mu_
printf
(
_
(
"No mail for %s
\n
"
),
args
.
user
?
args
.
user
:
mail_whoami
());
return
1
;
}
...
...
@@ -514,7 +511,7 @@ main (int argc, char **argv)
mailvar_get
(
&
prompt
,
"prompt"
,
mailvar_type_string
,
0
);
mail_mainloop
(
mail_cmdline
,
(
void
*
)
prompt
,
1
);
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"
\n
"
);
util_do_command
(
"quit"
);
return
0
;
}
...
...
@@ -564,11 +561,11 @@ mail_mainloop (char *(*input) (void *, int),
int
mail_warranty
(
int
argc
MU_ARG_UNUSED
,
char
**
argv
MU_ARG_UNUSED
)
{
mu_
stream_printf
(
ostream
,
mu_
printf
(
_
(
"GNU Mailutils -- a suite of utilities for electronic mail
\n
"
"Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
\n
"
"2007, 2009 Free Software Foundation, Inc.
\n\n
"
));
mu_
stream_printf
(
ostream
,
"2007, 2009
, 2010
Free Software Foundation, Inc.
\n\n
"
));
mu_
printf
(
_
(
" GNU Mailutils is free software; you can redistribute it and/or modify
\n
"
" it under the terms of the GNU General Public License as published by
\n
"
" the Free Software Foundation; either version 3 of the License, or
\n
"
...
...
mail/mail.h
View file @
df07ce7
...
...
@@ -172,7 +172,6 @@ typedef int (*msg_handler_t) (msgset_t *mp, mu_message_t mesg, void *data);
/* Global variables and constants*/
extern
mu_mailbox_t
mbox
;
extern
size_t
total
;
extern
mu_stream_t
ostream
;
extern
int
interactive
;
extern
const
char
*
program_version
;
...
...
@@ -380,7 +379,6 @@ extern char *util_slist_to_string (mu_list_t list, const char *delim);
extern
void
util_strcat
(
char
**
dest
,
const
char
*
str
);
extern
char
*
util_outfolder_name
(
char
*
str
);
extern
void
util_save_outgoing
(
mu_message_t
msg
,
char
*
savefile
);
extern
void
util_error
(
const
char
*
format
,
...)
MU_PRINTFLIKE
(
1
,
2
);
extern
int
util_error_range
(
size_t
msgno
);
extern
void
util_noapp
(
void
);
extern
int
util_tempfile
(
char
**
namep
);
...
...
mail/mailline.c
View file @
df07ce7
...
...
@@ -151,7 +151,7 @@ ml_readline_with_intr (const char *prompt)
{
char
*
str
=
ml_readline
(
prompt
);
if
(
_interrupted
)
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"
\n
"
);
return
str
;
}
...
...
@@ -782,7 +782,7 @@ ml_reread (const char *prompt, char **text)
if
(
!
line
)
{
util
_error
(
_
(
"Not enough memory to edit the line"
));
mu
_error
(
_
(
"Not enough memory to edit the line"
));
return
-
1
;
}
...
...
@@ -810,7 +810,7 @@ ml_reread (const char *prompt, char **text)
if
((
p
=
realloc
(
line
,
line_size
+
LINE_INC
))
==
NULL
)
{
fputs
(
"
\n
"
,
stdout
);
util
_error
(
_
(
"Not enough memory to edit the line"
));
mu
_error
(
_
(
"Not enough memory to edit the line"
));
break
;
}
else
...
...
@@ -857,7 +857,7 @@ ml_reread (const char *prompt, char **text)
if
((
p
=
realloc
(
line
,
line_size
+
LINE_INC
))
==
NULL
)
{
fputs
(
"
\n
"
,
stdout
);
util
_error
(
_
(
"Not enough memory to edit the line"
));
mu
_error
(
_
(
"Not enough memory to edit the line"
));
break
;
}
else
...
...
@@ -893,7 +893,7 @@ ml_reread (const char *prompt, char **text)
if
((
p
=
realloc
(
line
,
line_size
+
LINE_INC
))
==
NULL
)
{
fputs
(
"
\n
"
,
stdout
);
util
_error
(
_
(
"Not enough memory to edit the line"
));
mu
_error
(
_
(
"Not enough memory to edit the line"
));
break
;
}
else
...
...
@@ -925,8 +925,8 @@ readline (char *prompt)
{
if
(
prompt
)
{
mu_
stream_printf
(
ostream
,
"%s"
,
prompt
);
mu_stream_flush
(
ostream
);
mu_
printf
(
"%s"
,
prompt
);
mu_stream_flush
(
mu_strout
);
}
return
ml_readline_internal
();
...
...
mail/mailvar.c
View file @
df07ce7
...
...
@@ -416,7 +416,7 @@ mailvar_get (void *ptr, const char *variable, enum mailvar_type type, int warn)
if
(
!
var
->
set
||
var
->
type
!=
type
)
{
if
(
warn
)
util
_error
(
_
(
"No value set for
\"
%s
\"
"
),
variable
);
mu
_error
(
_
(
"No value set for
\"
%s
\"
"
),
variable
);
return
1
;
}
if
(
ptr
)
...
...
mail/msgset.y
View file @
df07ce7
...
...
@@ -727,7 +727,7 @@ check_set (msgset_t **pset)
}
else
{
util
_error (_("%lu: Inappropriate message (has been deleted)"),
mu
_error (_("%lu: Inappropriate message (has been deleted)"),
(unsigned long) p->msg_part[0]);
/* Delete entire set */
delset = *pset;
...
...
mail/next.c
View file @
df07ce7
...
...
@@ -36,7 +36,7 @@ mail_next (int argc, char **argv)
n
=
get_cursor
();
if
(
n
==
0
||
util_get_message
(
mbox
,
n
,
&
msg
))
{
util
_error
(
_
(
"No applicable message"
));
mu
_error
(
_
(
"No applicable message"
));
return
1
;
}
...
...
@@ -59,7 +59,7 @@ mail_next (int argc, char **argv)
if
(
rc
)
{
util
_error
(
_
(
"No applicable message"
));
mu
_error
(
_
(
"No applicable message"
));
return
1
;
}
}
...
...
@@ -76,7 +76,7 @@ mail_next (int argc, char **argv)
}
else
{
util
_error
(
_
(
"No applicable message"
));
mu
_error
(
_
(
"No applicable message"
));
return
1
;
}
}
...
...
mail/previous.c
View file @
df07ce7
...
...
@@ -45,7 +45,7 @@ mail_previous (int argc, char **argv)
if
(
rc
)
{
util
_error
(
_
(
"No applicable message"
));
mu
_error
(
_
(
"No applicable message"
));
return
1
;
}
}
...
...
@@ -62,7 +62,7 @@ mail_previous (int argc, char **argv)
}
else
{
util
_error
(
_
(
"No applicable message"
));
mu
_error
(
_
(
"No applicable message"
));
return
1
;
}
}
...
...
mail/print.c
View file @
df07ce7
...
...
@@ -102,7 +102,7 @@ mail_print_msg (msgset_t *mspec, mu_message_t mesg, void *data)
/* FIXME:
if (ml_got_interrupt())
{
util
_error (_("\nInterrupt"));
mu
_error (_("\nInterrupt"));
break;
}
*/
...
...
mail/quit.c
View file @
df07ce7
...
...
@@ -49,7 +49,7 @@ mail_mbox_close ()
mu_mailbox_get_url
(
mbox
,
&
url
);
mu_mailbox_messages_count
(
mbox
,
&
held_count
);
mu_
stream_printf
(
ostream
,
mu_
printf
(
ngettext
(
"Held %d message in %s
\n
"
,
"Held %d messages in %s
\n
"
,
held_count
),
...
...
@@ -116,14 +116,14 @@ mail_mbox_commit ()
if
((
status
=
mu_mailbox_create_default
(
&
dest_mbox
,
name
))
!=
0
)
{
util
_error
(
_
(
"Cannot create mailbox %s: %s"
),
name
,
mu
_error
(
_
(
"Cannot create mailbox %s: %s"
),
name
,
mu_strerror
(
status
));
return
1
;
}
if
((
status
=
mu_mailbox_open
(
dest_mbox
,
MU_STREAM_WRITE
|
MU_STREAM_CREAT
))
!=
0
)
{
util
_error
(
_
(
"Cannot open mailbox %s: %s"
),
name
,
mu
_error
(
_
(
"Cannot open mailbox %s: %s"
),
name
,
mu_strerror
(
status
));
return
1
;
}
...
...
@@ -131,7 +131,7 @@ mail_mbox_commit ()
status
=
mu_mailbox_append_message
(
dest_mbox
,
msg
);
if
(
status
)
util
_error
(
_
(
"Cannot append message: %s"
),
mu_strerror
(
status
));
mu
_error
(
_
(
"Cannot append message: %s"
),
mu_strerror
(
status
));
else
{
mu_attribute_set_deleted
(
attr
);
...
...
@@ -153,7 +153,7 @@ mail_mbox_commit ()
mu_url_t
u
=
NULL
;
mu_mailbox_get_url
(
dest_mbox
,
&
u
);
mu_
stream_printf
(
ostream
,
mu_
printf
(
ngettext
(
"Saved %d message in %s
\n
"
,
"Saved %d messages in %s
\n
"
,
saved_count
),
...
...
mail/reply.c
View file @
df07ce7
...
...
@@ -111,12 +111,12 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data)
else
compose_header_set
(
&
env
,
MU_HEADER_SUBJECT
,
""
,
COMPOSE_REPLACE
);
mu_
stream_printf
(
ostream
,
"To: %s
\n
"
,
mu_
printf
(
"To: %s
\n
"
,
compose_header_get
(
&
env
,
MU_HEADER_TO
,
""
));
str
=
compose_header_get
(
&
env
,
MU_HEADER_CC
,
NULL
);
if
(
str
)
mu_
stream_printf
(
ostream
,
"Cc: %s
\n
"
,
str
);
mu_
stream_printf
(
ostream
,
"Subject: %s
\n\n
"
,
mu_
printf
(
"Cc: %s
\n
"
,
str
);
mu_
printf
(
"Subject: %s
\n\n
"
,
compose_header_get
(
&
env
,
MU_HEADER_SUBJECT
,
""
));
make_in_reply_to
(
&
env
,
msg
);
...
...
mail/retain.c
View file @
df07ce7
...
...
@@ -31,7 +31,7 @@ process_list (int argc, char **argv,
if
(
argc
==
1
)
{
if
(
mu_list_is_empty
(
*
list
))
mu_
stream_printf
(
ostream
,
"%s"
,
_
(
msg
));
mu_
printf
(
"%s"
,
_
(
msg
));
else
util_slist_print
(
*
list
,
1
);
return
0
;
...
...
@@ -125,7 +125,7 @@ mail_nosender (int argc, char **argv)
if
(
argc
==
1
)
{
util_slist_destroy
(
&
sender_headers
);
mu_
stream_printf
(
ostream
,
mu_
printf
(
_
(
"Sender address is obtained from the envelope
\n
"
));
}
else
...
...
mail/send.c
View file @
df07ce7
...
...
@@ -52,7 +52,7 @@ list_headers (void *item, void *data)
if
(
!
name
||
strcmp
(
name
,
hp
->
name
)
==
0
)
{
mu_
stream_printf
(
ostream
,
"%s: %s
\n
"
,
hp
->
name
,
hp
->
value
);
mu_
printf
(
"%s: %s
\n
"
,
hp
->
name
,
hp
->
value
);
}
return
0
;
}
...
...
@@ -67,7 +67,7 @@ add_header (char *name, char *value, int mode)
int
rc
=
mu_list_create
(
&
add_header_list
);
if
(
rc
)
{
util
_error
(
_
(
"Cannot create header list: %s"
),
mu_strerror
(
rc
));
mu
_error
(
_
(
"Cannot create header list: %s"
),
mu_strerror
(
rc
));
exit
(
1
);
}
}
...
...
@@ -89,7 +89,7 @@ send_append_header (char *text)
p
=
strchr
(
text
,
':'
);
if
(
!
p
)
{
util
_error
(
_
(
"Invalid header: %s"
),
text
);
mu
_error
(
_
(
"Invalid header: %s"
),
text
);
return
;
}
len
=
p
-
text
;
...
...
@@ -223,7 +223,7 @@ compose_header_set (compose_env_t * env, const char *name,
if
(
!
env
->
header
&&
(
status
=
mu_header_create
(
&
env
->
header
,
NULL
,
0
))
!=
0
)
{
util
_error
(
_
(
"Cannot create header: %s"
),
mu_strerror
(
status
));
mu
_error
(
_
(
"Cannot create header: %s"
),
mu_strerror
(
status
));
return
status
;
}
...
...
@@ -333,7 +333,7 @@ fill_body (mu_message_t msg, mu_stream_t instr)
{
char
*
str
;
if
(
mailvar_get
(
&
str
,
"nullbodymsg"
,
mailvar_type_string
,
0
)
==
0
)
util
_error
(
"%s
\n
"
,
_
(
str
));
mu
_error
(
"%s
\n
"
,
_
(
str
));
}
else
return
1
;
...
...
@@ -356,7 +356,7 @@ save_dead_message (compose_env_t *env)
rc
=
mu_file_stream_create
(
&
dead_letter
,
name
,
MU_STREAM_WRITE
);
if
(
rc
)
{
util
_error
(
_
(
"Cannot open file %s: %s"
),
name
,
strerror
(
rc
));
mu
_error
(
_
(
"Cannot open file %s: %s"
),
name
,
strerror
(
rc
));
return
1
;
}
if
(
mailvar_get
(
NULL
,
"appenddeadletter"
,
...
...
@@ -401,17 +401,17 @@ send_message (mu_message_t msg)
mu_mailer_close
(
mailer
);
}
else
util
_error
(
_
(
"Cannot open mailer: %s"
),
mu_strerror
(
status
));
mu
_error
(
_
(
"Cannot open mailer: %s"
),
mu_strerror
(
status
));
mu_mailer_destroy
(
&
mailer
);
}
else
util
_error
(
_
(
"Cannot create mailer: %s"
),
mu
_error
(
_
(
"Cannot create mailer: %s"
),
mu_strerror
(
status
));
}
}
else
{
util
_error
(
_
(
"Variable sendmail not set: no mailer"
));
mu
_error
(
_
(
"Variable sendmail not set: no mailer"
));
status
=
ENOSYS
;
}
return
status
;
...
...
@@ -445,7 +445,7 @@ mail_send0 (compose_env_t *env, int save_to)
rc
=
mu_temp_file_stream_create
(
&
env
->
compstr
,
NULL
,
0
);
if
(
rc
)
{
util
_error
(
_
(
"Cannot open temporary file: %s"
),
mu_strerror
(
rc
));
mu
_error
(
_
(
"Cannot open temporary file: %s"
),
mu_strerror
(
rc
));
return
1
;
}
...
...
@@ -460,7 +460,7 @@ mail_send0 (compose_env_t *env, int save_to)
{
if
(
mailvar_get
(
NULL
,
"ignore"
,
mailvar_type_boolean
,
0
)
==
0
)
{
mu_
stream_printf
(
ostream
,
"@
\n
"
);
mu_
printf
(
"@
\n
"
);
}
else
{
...
...
@@ -468,7 +468,7 @@ mail_send0 (compose_env_t *env, int save_to)
free
(
buf
);
if
(
++
int_cnt
==
2
)
break
;
util
_error
(
_
(
"
\n
(Interrupt -- one more to kill letter)"
));
mu
_error
(
_
(
"
\n
(Interrupt -- one more to kill letter)"
));
}
continue
;
}
...
...
@@ -478,7 +478,7 @@ mail_send0 (compose_env_t *env, int save_to)
if
(
interactive
&&
mailvar_get
(
NULL
,
"ignoreeof"
,
mailvar_type_boolean
,
0
)
==
0
)
{
util
_error
(
mailvar_get
(
NULL
,
"dot"
,
mailvar_type_boolean
,
0
)
==
0
?
mu
_error
(
mailvar_get
(
NULL
,
"dot"
,
mailvar_type_boolean
,
0
)
==
0
?
_
(
"Use
\"
.
\"
to terminate letter."
)
:
_
(
"Use
\"
~.
\"
to terminate letter."
));
continue
;
...
...
@@ -520,15 +520,15 @@ mail_send0 (compose_env_t *env, int save_to)
status
=
(
*
entry
->
escfunc
)
(
ws
.
ws_wordc
,
ws
.
ws_wordv
,
env
);
else
util
_error
(
_
(
"Unknown escape %s"
),
ws
.
ws_wordv
[
0
]);
mu
_error
(
_
(
"Unknown escape %s"
),
ws
.
ws_wordv
[
0
]);
}
else
util
_error
(
_
(
"Unfinished escape"
));
mu
_error
(
_
(
"Unfinished escape"
));
mu_wordsplit_free
(
&
ws
);
}
else
{
util
_error
(
_
(
"Cannot parse escape sequence: %s"
),
mu
_error
(
_
(
"Cannot parse escape sequence: %s"
),
mu_wordsplit_strerror
(
&
ws
));
}
}
...
...
@@ -614,14 +614,14 @@ mail_send0 (compose_env_t *env, int save_to)
{
status
=
mu_mailbox_append_message
(
mbx
,
msg
);
if
(
status
)
util
_error
(
_
(
"Cannot append message: %s"
),
mu
_error
(
_
(
"Cannot append message: %s"
),
mu_strerror
(
status
));
mu_mailbox_close
(
mbx
);
}
mu_mailbox_destroy
(
&
mbx
);
}
if
(
status
)
util
_error
(
_
(
"Cannot create mailbox %s: %s"
),
mu
_error
(
_
(
"Cannot create mailbox %s: %s"
),
env
->
outfiles
[
i
],
mu_strerror
(
status
));
}
...
...
@@ -678,7 +678,7 @@ msg_to_pipe (const char *cmd, mu_message_t msg)
status
=
mu_command_stream_create
(
&
progstream
,
cmd
,
MU_STREAM_WRITE
);
if
(
status
)
{
util
_error
(
_
(
"Cannot pipe to %s: %s"
),
cmd
,
mu_strerror
(
status
));
mu
_error
(
_
(
"Cannot pipe to %s: %s"
),
cmd
,
mu_strerror
(
status
));
return
status
;
}
...
...
@@ -694,7 +694,7 @@ msg_to_pipe (const char *cmd, mu_message_t msg)
if
(
status
)
{
util
_error
(
_
(
"Sending data to %s failed: %s"
),
cmd
,
mu
_error
(
_
(
"Sending data to %s failed: %s"
),
cmd
,
mu_strerror
(
status
));
}
return
status
;
...
...
mail/setenv.c
View file @
df07ce7
...
...
@@ -29,7 +29,7 @@ mail_setenv (int argc, char **argv)
char
**
p
;
for
(
p
=
environ
;
*
p
;
p
++
)
mu_
stream_printf
(
ostream
,
"%s
\n
"
,
*
p
);
mu_
printf
(
"%s
\n
"
,
*
p
);
}
else
{
...
...
mail/shell.c
View file @
df07ce7
...
...
@@ -35,7 +35,7 @@ expand_bang (char **pbuf)
if
(
!
last
)
{
util
_error
(
_
(
"No previous command"
));
mu
_error
(
_
(
"No previous command"
));
return
;
}
...
...
mail/size.c
View file @
df07ce7
...
...
@@ -29,7 +29,7 @@ size0 (msgset_t *mspec, mu_message_t msg, void *data)
mu_message_size
(
msg
,
&
size
);
mu_message_lines
(
msg
,
&
lines
);
mu_
stream_printf
(
ostream
,
"%c%2lu %3lu/%-5lu
\n
"
,
mu_
printf
(
"%c%2lu %3lu/%-5lu
\n
"
,
is_current_message
(
mspec
->
msg_part
[
0
])
?
'>'
:
' '
,
(
unsigned
long
)
mspec
->
msg_part
[
0
],
(
unsigned
long
)
lines
,
...
...
mail/source.c
View file @
df07ce7
...
...
@@ -55,7 +55,7 @@ mail_source (int argc, char **argv)
if
(
argc
!=
2
)
{
/* TRANSLATORS: 'source' is a command name. Do not translate it! */
util
_error
(
_
(
"source requires a single argument"
));
mu
_error
(
_
(
"source requires a single argument"
));
return
1
;
}
...
...
@@ -63,7 +63,7 @@ mail_source (int argc, char **argv)
if
(
rc
)
{
if
(
rc
!=
ENOENT
)
util
_error
(
_
(
"Cannot open `%s': %s"
),
argv
[
1
],
strerror
(
rc
));
mu
_error
(
_
(
"Cannot open `%s': %s"
),
argv
[
1
],
strerror
(
rc
));
return
1
;
}
...
...
mail/struct.c
View file @
df07ce7
...
...
@@ -24,20 +24,20 @@ show_part (struct mime_descend_closure *closure, void *data)
size_t
width
;
size_t
size
=
0
;
format_msgset
(
ostream
,
closure
->
msgset
,
&
width
);
format_msgset
(
mu_strout
,
closure
->
msgset
,
&
width
);
for
(;
width
<
5
;
width
++
)
mu_stream_write
(
ostream
,
" "
,
1
,
NULL
);
mu_stream_write
(
mu_strout
,
" "
,
1
,
NULL
);
mu_
stream_printf
(
ostream
,
" %-25s"
,
closure
->
type
);
mu_
printf
(
" %-25s"
,
closure
->
type
);
mu_message_size
(
closure
->
message
,
&
size
);
if
(
size
<
1024
)
mu_
stream_printf
(
ostream
,
" %4lu"
,
(
unsigned
long
)
size
);
mu_
printf
(
" %4lu"
,
(
unsigned
long
)
size
);
else
if
(
size
<
1024
*
1024
)
mu_
stream_printf
(
ostream
,
"%4luK"
,
(
unsigned
long
)
size
/
1024
);
mu_
printf
(
"%4luK"
,
(
unsigned
long
)
size
/
1024
);
else
mu_
stream_printf
(
ostream
,
"%4luM"
,
(
unsigned
long
)
size
/
1024
/
1024
);
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"%4luM"
,
(
unsigned
long
)
size
/
1024
/
1024
);
mu_
printf
(
"
\n
"
);
return
0
;
}
...
...
mail/summary.c
View file @
df07ce7
...
...
@@ -60,20 +60,20 @@ mail_summary (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
{
mu_url_t
url
=
NULL
;
mu_mailbox_get_url
(
mbox
,
&
url
);
mu_
stream_printf
(
ostream
,
"
\"
%s
\"
: "
,
util_url_to_string
(
url
));
mu_
printf
(
"
\"
%s
\"
: "
,
util_url_to_string
(
url
));
}
mu_
stream_printf
(
ostream
,
mu_
printf
(
ngettext
(
"%d message"
,
"%d messages"
,
count
),
count
);
if
(
mnew
>
0
)
mu_
stream_printf
(
ostream
,
ngettext
(
" %d new"
,
" %d new"
,
mnew
),
mnew
);
mu_
printf
(
ngettext
(
" %d new"
,
" %d new"
,
mnew
),
mnew
);
if
(
mseen
>
0
)
mu_
stream_printf
(
ostream
,
ngettext
(
" %d unread"
,
" %d unread"
,
mseen
),
mu_
printf
(
ngettext
(
" %d unread"
,
" %d unread"
,
mseen
),
mseen
);
if
(
mdelete
>
0
)
mu_
stream_printf
(
ostream
,
mu_
printf
(
ngettext
(
" %d deleted"
,
" %d deleted"
,
mdelete
),
mdelete
);
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"
\n
"
);
/* Set the cursor. */
set_cursor
((
first_new
==
0
)
?
((
first_unread
==
0
)
?
...
...
mail/top.c
View file @
df07ce7
...
...
@@ -39,7 +39,7 @@ top0 (msgset_t *mspec, mu_message_t msg, void *data)
int
status
=
mu_stream_getline
(
stream
,
&
buf
,
&
size
,
&
n
);
if
(
status
!=
0
||
n
==
0
)
break
;
mu_
stream_printf
(
ostream
,
"%s"
,
buf
);
mu_
printf
(
"%s"
,
buf
);
}
free
(
buf
);
mu_stream_destroy
(
&
stream
);
...
...
mail/unalias.c
View file @
df07ce7
...
...
@@ -27,7 +27,7 @@ mail_unalias (int argc, char **argv)
if
(
argc
==
1
)
{
/* TRANSLATORS: 'unalias' is a command name. Do not translate it! */
util
_error
(
_
(
"unalias requires at least one argument"
));
mu
_error
(
_
(
"unalias requires at least one argument"
));
return
1
;
}
while
(
--
argc
)
...
...
mail/util.c
View file @
df07ce7
...
...
@@ -149,9 +149,9 @@ util_do_command (const char *fmt, ...)
else
{
if
(
argc
)
util
_error
(
_
(
"Unknown command: %s"
),
argv
[
0
]);
mu
_error
(
_
(
"Unknown command: %s"
),
argv
[
0
]);
else
util
_error
(
_
(
"Invalid command"
));
mu
_error
(
_
(
"Invalid command"
));
status
=
1
;
}
...
...
@@ -218,7 +218,7 @@ util_range_msg (size_t low, size_t high, int flags,
if
((
flags
&
MSG_NODELETED
)
&&
util_isdeleted
(
low
))
{
if
(
!
(
flags
&
MSG_SILENT
))
util
_error
(
_
(
"%lu: Inappropriate message (has been deleted)"
),
mu
_error
(
_
(
"%lu: Inappropriate message (has been deleted)"
),
(
unsigned
long
)
low
);
continue
;
}
...
...
@@ -300,11 +300,11 @@ util_help (void *table, size_t nmemb, size_t size, const char *word)
int
status
=
0
;
struct
mail_command
*
cp
=
util_find_entry
(
table
,
nmemb
,
size
,
word
);
if
(
cp
&&
cp
->
synopsis
)
mu_
stream_printf
(
ostream
,
"%s
\n
"
,
cp
->
synopsis
);
mu_
printf
(
"%s
\n
"
,
cp
->
synopsis
);
else
{
status
=
1
;
mu_
stream_printf
(
ostream
,
_
(
"Unknown command: %s
\n
"
),
word
);
mu_
printf
(
_
(
"Unknown command: %s
\n
"
),
word
);
}
return
status
;
}
...
...
@@ -337,12 +337,12 @@ util_command_list (void *table, size_t nmemb, size_t size)
if
(
pos
>=
cols
)
{
pos
=
len
+
1
;
mu_
stream_printf
(
ostream
,
"
\n
%s "
,
cmd
);
mu_
printf
(
"
\n
%s "
,
cmd
);
}
else
mu_
stream_printf
(
ostream
,
"%s "
,
cmd
);
mu_
printf
(
"%s "
,
cmd
);
}
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"
\n
"
);
return
0
;
}
...
...
@@ -471,7 +471,7 @@ util_get_homedir ()
if
(
!
homedir
)
{
/* Shouldn't happen, but one never knows */
util
_error
(
_
(
"Cannot get homedir"
));
mu
_error
(
_
(
"Cannot get homedir"
));
exit
(
EXIT_FAILURE
);
}
return
homedir
;
...
...
@@ -535,14 +535,14 @@ util_get_sender (int msgno, int strip)
if
(
mu_envelope_sget_sender
(
env
,
&
buffer
)
||
mu_address_create
(
&
addr
,
buffer
))
{
util
_error
(
_
(
"Cannot determine sender name (msg %d)"
),
msgno
);
mu
_error
(
_
(
"Cannot determine sender name (msg %d)"
),
msgno
);
return
NULL
;
}
}
if
(
mu_address_aget_email
(
addr
,
1
,
&
buf
))
{
util
_error
(
_
(
"Cannot determine sender name (msg %d)"
),
msgno
);
mu
_error
(
_
(
"Cannot determine sender name (msg %d)"
),
msgno
);
mu_address_destroy
(
&
addr
);
return
NULL
;
}
...
...
@@ -570,7 +570,7 @@ util_slist_print (mu_list_t list, int nl)
for
(
mu_iterator_first
(
itr
);
!
mu_iterator_is_done
(
itr
);
mu_iterator_next
(
itr
))
{
mu_iterator_current
(
itr
,
(
void
**
)
&
name
);
mu_
stream_printf
(
ostream
,
"%s%c"
,
name
,
nl
?
'\n'
:
' '
);
mu_
printf
(
"%s%c"
,
name
,
nl
?
'\n'
:
' '
);
}
mu_iterator_destroy
(
&
itr
);
}
...
...
@@ -725,7 +725,7 @@ util_save_outgoing (mu_message_t msg, char *savefile)
rc
=
mu_mailbox_create_default
(
&
outbox
,
filename
);
if
(
rc
)
{
util
_error
(
_
(
"Cannot create output mailbox `%s': %s"
),
mu
_error
(
_
(
"Cannot create output mailbox `%s': %s"
),
filename
,
strerror
(
rc
));
free
(
filename
);
return
;
...
...
@@ -733,13 +733,13 @@ util_save_outgoing (mu_message_t msg, char *savefile)
rc
=
mu_mailbox_open
(
outbox
,
MU_STREAM_WRITE
|
MU_STREAM_CREAT
);
if
(
rc
)
util
_error
(
_
(
"Cannot open output mailbox `%s': %s"
),
mu
_error
(
_
(
"Cannot open output mailbox `%s': %s"
),
filename
,
strerror
(
rc
));
else
{
rc
=
mu_mailbox_append_message
(
outbox
,
msg
);
if
(
rc
)
util
_error
(
_
(
"Cannot append message to `%s': %s"
),
mu
_error
(
_
(
"Cannot append message to `%s': %s"
),
filename
,
strerror
(
rc
));
}
...
...
@@ -750,19 +750,6 @@ util_save_outgoing (mu_message_t msg, char *savefile)
}
}
void
util_error
(
const
char
*
format
,
...)
{
va_list
ap
;
va_start
(
ap
,
format
);
mu_stream_vprintf
(
mu_strerr
,
format
,
ap
);
mu_stream_printf
(
mu_strerr
,
"
\n
"
);
va_end
(
ap
);
}
static
int
util_descend_subparts
(
mu_message_t
mesg
,
msgset_t
*
msgset
,
mu_message_t
*
part
)
{
...
...
@@ -781,7 +768,7 @@ util_descend_subparts (mu_message_t mesg, msgset_t *msgset, mu_message_t *part)
{
if
(
mu_message_unencapsulate
(
mesg
,
&
submsg
,
NULL
))
{
util
_error
(
_
(
"Cannot unencapsulate message/part"
));
mu
_error
(
_
(
"Cannot unencapsulate message/part"
));
return
1
;
}
mesg
=
submsg
;
...
...
@@ -790,14 +777,14 @@ util_descend_subparts (mu_message_t mesg, msgset_t *msgset, mu_message_t *part)
mu_message_get_num_parts
(
mesg
,
&
nparts
);
if
(
nparts
<
msgset
->
msg_part
[
i
])
{
util
_error
(
_
(
"No such (sub)part in the message: %lu"
),
mu
_error
(
_
(
"No such (sub)part in the message: %lu"
),
(
unsigned
long
)
msgset
->
msg_part
[
i
]);
return
1
;
}
if
(
mu_message_get_part
(
mesg
,
msgset
->
msg_part
[
i
],
&
submsg
))
{
util
_error
(
_
(
"Cannot get (sub)part from the message: %lu"
),
mu
_error
(
_
(
"Cannot get (sub)part from the message: %lu"
),
(
unsigned
long
)
msgset
->
msg_part
[
i
]);
return
1
;
}
...
...
@@ -925,7 +912,7 @@ util_header_expand (mu_header_t *phdr)
rc
=
mu_header_create
(
&
hdr
,
""
,
0
);
if
(
rc
)
{
util
_error
(
_
(
"Cannot create temporary header: %s"
),
mu_strerror
(
rc
));
mu
_error
(
_
(
"Cannot create temporary header: %s"
),
mu_strerror
(
rc
));
return
1
;
}
...
...
@@ -977,10 +964,10 @@ util_header_expand (mu_header_t *phdr)
{
errcnt
++
;
if
(
exp
)
util
_error
(
_
(
"Cannot parse address `%s' (while expanding `%s'): %s"
),
mu
_error
(
_
(
"Cannot parse address `%s' (while expanding `%s'): %s"
),
exp
,
p
,
mu_strerror
(
rc
));
else
util
_error
(
_
(
"Cannot parse address `%s': %s"
),
mu
_error
(
_
(
"Cannot parse address `%s': %s"
),
p
,
mu_strerror
(
rc
));
}
...
...
@@ -1030,7 +1017,7 @@ util_get_message (mu_mailbox_t mbox, size_t msgno, mu_message_t *msg)
status
=
mu_mailbox_get_message
(
mbox
,
msgno
,
msg
);
if
(
status
)
{
util
_error
(
_
(
"Cannot get message %lu: %s"
),
mu
_error
(
_
(
"Cannot get message %lu: %s"
),
(
unsigned
long
)
msgno
,
mu_strerror
(
status
));
return
status
;
}
...
...
@@ -1041,14 +1028,14 @@ util_get_message (mu_mailbox_t mbox, size_t msgno, mu_message_t *msg)
int
util_error_range
(
size_t
msgno
)
{
util
_error
(
_
(
"%lu: invalid message number"
),
(
unsigned
long
)
msgno
);
mu
_error
(
_
(
"%lu: invalid message number"
),
(
unsigned
long
)
msgno
);
return
1
;
}
void
util_noapp
()
{
util
_error
(
_
(
"No applicable messages"
));
mu
_error
(
_
(
"No applicable messages"
));
}
void
...
...
@@ -1162,13 +1149,13 @@ open_pager (size_t lines)
{
mu_diag_funcall
(
MU_DIAG_ERROR
,
"mu_prog_stream_create"
,
pager
,
rc
);
str
=
ostream
;
str
=
mu_strout
;
mu_stream_ref
(
str
);
}
}
else
{
str
=
ostream
;
str
=
mu_strout
;
mu_stream_ref
(
str
);
}
return
str
;
...
...
mail/version.c
View file @
df07ce7
...
...
@@ -39,16 +39,16 @@ static const char *with_defs[] =
int
mail_version
(
int
argc
MU_ARG_UNUSED
,
char
**
argv
MU_ARG_UNUSED
)
{
mu_
stream_printf
(
ostream
,
"%s"
,
program_version
);
mu_
printf
(
"%s"
,
program_version
);
if
(
with_defs
[
0
]
!=
NULL
)
{
int
i
;
mu_
stream_printf
(
ostream
,
" ("
);
mu_
printf
(
" ("
);
for
(
i
=
0
;
with_defs
[
i
];
i
++
)
mu_
stream_printf
(
ostream
,
" %s"
,
with_defs
[
i
]);
mu_
stream_printf
(
ostream
,
" )"
);
mu_
printf
(
" %s"
,
with_defs
[
i
]);
mu_
printf
(
" )"
);
}
mu_
stream_printf
(
ostream
,
"
\n
"
);
mu_
printf
(
"
\n
"
);
return
0
;
}
...
...
mail/write.c
View file @
df07ce7
...
...
@@ -43,7 +43,7 @@ mail_write (int argc, char **argv)
char
*
p
=
NULL
;
if
(
n
==
0
)
{
util
_error
(
_
(
"No applicable message"
));
mu
_error
(
_
(
"No applicable message"
));
return
1
;
}
mu_asprintf
(
&
p
,
"%lu"
,
(
unsigned
long
)
n
);
...
...
@@ -72,7 +72,7 @@ mail_write (int argc, char **argv)
MU_STREAM_APPEND
|
MU_STREAM_CREAT
);
if
(
rc
)
{
util
_error
(
_
(
"can't open %s: %s"
),
filename
,
mu_strerror
(
rc
));
mu
_error
(
_
(
"can't open %s: %s"
),
filename
,
mu_strerror
(
rc
));
free
(
filename
);
msgset_free
(
msglist
);
return
1
;
...
...
@@ -114,7 +114,7 @@ mail_write (int argc, char **argv)
mu_stream_close
(
output
);
mu_stream_destroy
(
&
output
);
mu_
stream_printf
(
ostream
,
"
\"
%s
\"
%3lu/%-5lu
\n
"
,
filename
,
mu_
printf
(
"
\"
%s
\"
%3lu/%-5lu
\n
"
,
filename
,
(
unsigned
long
)
total_lines
,
(
unsigned
long
)
total_size
);
free
(
filename
);
...
...
mail/z.c
View file @
df07ce7
...
...
@@ -61,7 +61,7 @@ z_parse_args(int argc, char **argv,
dir
=
D_NONE
;
break
;
default:
util
_error
(
_
(
"Bad arguments for the scrolling command"
));
mu
_error
(
_
(
"Bad arguments for the scrolling command"
));
return
1
;
}
...
...
@@ -76,7 +76,7 @@ z_parse_args(int argc, char **argv,
if
(
argc
>
1
)
{
util
_error
(
_
(
"Too many arguments for the scrolling command"
));
mu
_error
(
_
(
"Too many arguments for the scrolling command"
));
return
1
;
}
...
...
@@ -84,13 +84,13 @@ z_parse_args(int argc, char **argv,
{
if
(
dir
==
D_NONE
)
{
util
_error
(
_
(
"Argument not applicable for z"
));
mu
_error
(
_
(
"Argument not applicable for z"
));
return
1
;
}
if
((
mul
=
strtoul
(
argp
,
NULL
,
10
))
==
0
)
{
util
_error
(
_
(
"Bad number of pages"
));
mu
_error
(
_
(
"Bad number of pages"
));
return
1
;
}
}
...
...
@@ -120,7 +120,7 @@ mail_z (int argc, char **argv)
case
D_BWD
:
if
(
page_move
(
-
count
)
==
0
)
{
mu_
stream_printf
(
ostream
,
_
(
"On first screenful of messages
\n
"
));
mu_
printf
(
_
(
"On first screenful of messages
\n
"
));
return
0
;
}
break
;
...
...
@@ -128,7 +128,7 @@ mail_z (int argc, char **argv)
case
D_FWD
:
if
(
page_move
(
count
)
==
0
)
{
mu_
stream_printf
(
ostream
,
_
(
"On last screenful of messages
\n
"
));
mu_
printf
(
_
(
"On last screenful of messages
\n
"
));
return
0
;
}
break
;
...
...
Please
register
or
sign in
to post a comment