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
d44a6c72
...
d44a6c72504c8804e7e3763f9453e0232eb1b472
authored
2006-01-20 16:28:58 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Use mu_umaxtostr to format size_t and off_t values
1 parent
3a94393a
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
207 additions
and
167 deletions
imap4d/fetch.c
imap4d/imap4d.c
imap4d/search.c
mailbox/daemon.c
mailbox/imap/mbox.c
mailbox/message.c
mh/burst.c
mh/compcommon.c
mh/folder.c
mh/forw.c
mh/mh_global.c
mh/mh_msgset.c
mh/mh_sequence.c
mh/mhn.c
mh/mhpath.c
mh/pick.c
mh/repl.c
mh/sortm.c
pop3d/apop.c
pop3d/capa.c
pop3d/dele.c
pop3d/list.c
pop3d/logindelay.c
pop3d/pop3d.c
pop3d/stat.c
pop3d/uidl.c
pop3d/user.c
imap4d/fetch.c
View file @
d44a6c7
...
...
@@ -177,7 +177,7 @@ imap4d_fetch0 (char *arg, int isuid, char *resp, size_t resplen)
int
space
=
0
;
fcmd
=
NULL
;
util_send
(
"* %
d FETCH ("
,
msgno
);
util_send
(
"* %
s FETCH ("
,
mu_umaxtostr
(
0
,
msgno
)
);
item
[
0
]
=
'\0'
;
/* Server implementations MUST implicitly
include the UID message data item as part of any FETCH
...
...
@@ -462,7 +462,7 @@ fetch_uid (struct fetch_command *command, char **arg ARG_UNUSED)
size_t
uid
=
0
;
mu_message_get_uid
(
command
->
msg
,
&
uid
);
util_send
(
"%s %
d"
,
command
->
name
,
uid
);
util_send
(
"%s %
s"
,
command
->
name
,
mu_umaxtostr
(
0
,
uid
)
);
return
RESP_OK
;
}
...
...
@@ -916,14 +916,14 @@ bodystructure (mu_message_t msg, int extension)
mu_message_get_body
(
msg
,
&
body
);
mu_body_size
(
body
,
&
size
);
mu_body_lines
(
body
,
&
blines
);
util_send
(
" %
d"
,
size
+
blines
);
util_send
(
" %
s"
,
mu_umaxtostr
(
0
,
size
+
blines
)
);
}
/* If the mime type was text. */
if
(
text_plain
)
{
/* Add the line number of the body. */
util_send
(
" %
d"
,
blines
);
util_send
(
" %
s"
,
mu_umaxtostr
(
0
,
blines
)
);
}
else
if
(
message_rfc822
)
{
...
...
@@ -940,7 +940,7 @@ bodystructure (mu_message_t msg, int extension)
util_send
(
")"
);
/* Size in text lines of the encapsulated message. */
mu_message_lines
(
emsg
,
&
lines
);
util_send
(
" %
d"
,
lines
);
util_send
(
" %
s"
,
mu_umaxtostr
(
0
,
lines
)
);
mu_message_destroy
(
&
emsg
,
NULL
);
}
...
...
@@ -1150,7 +1150,7 @@ fetch_io (mu_stream_t stream, unsigned long start, unsigned long end,
{
mu_stream_t
rfc
=
NULL
;
size_t
n
=
0
;
off_t
offset
;
mu_
off_t
offset
;
mu_filter_create
(
&
rfc
,
stream
,
"rfc822"
,
MU_FILTER_ENCODE
,
MU_STREAM_READ
);
...
...
@@ -1195,7 +1195,7 @@ fetch_io (mu_stream_t stream, unsigned long start, unsigned long end,
util_send
(
"<%lu>"
,
start
);
if
(
total
)
{
util_send
(
" {%
u}
\r\n
"
,
total
);
util_send
(
" {%
s}
\r\n
"
,
mu_umaxtostr
(
0
,
total
)
);
util_send
(
"%s"
,
p
);
}
else
...
...
imap4d/imap4d.c
View file @
d44a6c7
...
...
@@ -381,8 +381,8 @@ imap4d_daemon (unsigned int maxchildren, unsigned int port)
{
if
(
children
>
maxchildren
)
{
syslog
(
LOG_ERR
,
_
(
"Too many children (%
lu
)"
),
(
unsigned
long
)
children
);
syslog
(
LOG_ERR
,
_
(
"Too many children (%
s
)"
),
mu_umaxtostr
(
0
,
children
)
);
pause
();
continue
;
}
...
...
imap4d/search.c
View file @
d44a6c7
...
...
@@ -286,10 +286,10 @@ do_search (struct parsebuf *pb)
{
size_t
uid
;
mu_message_get_uid
(
pb
->
msg
,
&
uid
);
util_send
(
" %
d"
,
uid
);
util_send
(
" %
s"
,
mu_umaxtostr
(
0
,
uid
)
);
}
else
util_send
(
" %
d"
,
pb
->
msgno
);
util_send
(
" %
s"
,
mu_umaxtostr
(
0
,
pb
->
msgno
)
);
}
}
util_send
(
"
\r\n
"
);
...
...
mailbox/daemon.c
View file @
d44a6c7
...
...
@@ -29,6 +29,7 @@
#include <string.h>
#include <mailutils/daemon.h>
#include <mu_umaxtostr.h>
static
char
*
pidfile
;
static
pid_t
current_pid
;
...
...
@@ -36,7 +37,7 @@ static pid_t current_pid;
int
mu_daemon_create_pidfile
(
const
char
*
filename
)
{
c
har
pid_string
[
10
];
/* 32bit PID */
c
onst
char
*
pid_string
;
int
fd
;
if
(
filename
[
0
]
!=
'/'
)
...
...
@@ -57,8 +58,7 @@ mu_daemon_create_pidfile (const char *filename)
return
2
;
/* failure */
}
snprintf
(
pid_string
,
sizeof
(
pid_string
)
-
1
,
"%lu
\n
"
,
(
unsigned
long
)
current_pid
);
pid_string
=
mu_umaxtostr
(
0
,
current_pid
);
write
(
fd
,
pid_string
,
strlen
(
pid_string
));
close
(
fd
);
...
...
mailbox/imap/mbox.c
View file @
d44a6c7
...
...
@@ -32,6 +32,7 @@
#include <assert.h>
#include <time.h>
#include <mu_umaxtostr.h>
#include <mailutils/address.h>
#include <mailutils/attribute.h>
#include <mailutils/body.h>
...
...
@@ -374,7 +375,7 @@ mailbox_imap_close (mu_mailbox_t mailbox)
m_imap_t
m_imap
=
mailbox
->
data
;
f_imap_t
f_imap
=
m_imap
->
f_imap
;
int
status
=
0
;
/* If we are not the selected mailbox, just close the stream. */
if
(
m_imap
!=
f_imap
->
selected
)
return
mu_folder_close
(
mailbox
->
folder
);
...
...
@@ -387,7 +388,8 @@ mailbox_imap_close (mu_mailbox_t mailbox)
switch
(
f_imap
->
state
)
{
case
IMAP_NO_STATE
:
status
=
imap_writeline
(
f_imap
,
"g%d CLOSE
\r\n
"
,
f_imap
->
seq
++
);
status
=
imap_writeline
(
f_imap
,
"g%s CLOSE
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_CLOSE
;
...
...
@@ -677,8 +679,8 @@ imap_messages_count (mu_mailbox_t mailbox, size_t *pnum)
switch
(
f_imap
->
state
)
{
case
IMAP_NO_STATE
:
status
=
imap_writeline
(
f_imap
,
"g%
d
%s %s
\r\n
"
,
f_imap
->
seq
++
,
status
=
imap_writeline
(
f_imap
,
"g%
s
%s %s
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
)
,
MBX_WRITABLE
(
mailbox
)
?
"SELECT"
:
"EXAMINE"
,
m_imap
->
name
);
CHECK_ERROR
(
f_imap
,
status
);
...
...
@@ -746,8 +748,9 @@ imap_scan0 (mu_mailbox_t mailbox, size_t msgno, size_t *pcount, int notif)
{
case
IMAP_NO_STATE
:
status
=
imap_writeline
(
f_imap
,
"g%d FETCH 1:* (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])
\r\n
"
,
f_imap
->
seq
++
,
MU_IMAP_CACHE_HEADERS
);
"g%s FETCH 1:* (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
MU_IMAP_CACHE_HEADERS
);
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_SCAN
;
...
...
@@ -820,7 +823,8 @@ imap_is_updated (mu_mailbox_t mailbox)
switch
(
f_imap
->
state
)
{
case
IMAP_NO_STATE
:
status
=
imap_writeline
(
f_imap
,
"g%d NOOP
\r\n
"
,
f_imap
->
seq
++
);
status
=
imap_writeline
(
f_imap
,
"g%s NOOP
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_NOOP
;
...
...
@@ -874,8 +878,9 @@ imap_expunge (mu_mailbox_t mailbox)
return
0
;
}
status
=
imap_writeline
(
f_imap
,
"g%d STORE %s +FLAGS.SILENT (
\\
Deleted)
\r\n
"
,
f_imap
->
seq
++
,
set
);
"g%s STORE %s +FLAGS.SILENT (
\\
Deleted)
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
set
);
free
(
set
);
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
...
...
@@ -896,7 +901,8 @@ imap_expunge (mu_mailbox_t mailbox)
case
IMAP_EXPUNGE
:
case
IMAP_EXPUNGE_ACK
:
status
=
imap_writeline
(
f_imap
,
"g%d EXPUNGE
\r\n
"
,
f_imap
->
seq
++
);
status
=
imap_writeline
(
f_imap
,
"g%s EXPUNGE
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
));
CHECK_ERROR
(
f_imap
,
status
);
status
=
imap_send
(
f_imap
);
CHECK_EAGAIN
(
f_imap
,
status
);
...
...
@@ -1038,8 +1044,11 @@ imap_append_message0 (mu_mailbox_t mailbox, mu_message_t msg)
mu_message_size
(
msg
,
&
size
);
mu_message_lines
(
msg
,
&
lines
);
total
=
size
+
lines
;
status
=
imap_writeline
(
f_imap
,
"g%d APPEND %s %s {%d}
\r\n
"
,
f_imap
->
seq
++
,
path
,
abuf
,
size
+
lines
);
status
=
imap_writeline
(
f_imap
,
"g%s APPEND %s %s {%s}
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
path
,
abuf
,
mu_umaxtostr
(
1
,
size
+
lines
));
free
(
abuf
);
free
(
path
);
CHECK_ERROR
(
f_imap
,
status
);
...
...
@@ -1137,8 +1146,10 @@ imap_copy_message (mu_mailbox_t mailbox, mu_message_t msg)
if
(
path
==
NULL
)
return
ENOMEM
;
mu_url_get_path
(
mailbox
->
url
,
path
,
n
+
1
,
NULL
);
status
=
imap_writeline
(
f_imap
,
"g%d COPY %d %s
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
path
);
status
=
imap_writeline
(
f_imap
,
"g%s COPY %s %s
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
path
);
free
(
path
);
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
...
...
@@ -1207,10 +1218,13 @@ imap_message_read (mu_stream_t stream, char *buffer, size_t buflen,
/* We have strip the \r, but the offset on the imap server is with that
octet(CFLF) so add it in the offset, it's the number of lines. */
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d BODY.PEEK[%s]<%d.%d>
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
"g%s FETCH %s BODY.PEEK[%s]<%s.%s>
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
(
section
)
?
section
:
""
,
offset
+
msg_imap
->
mu_message_lines
,
buflen
);
mu_umaxtostr
(
2
,
offset
+
msg_imap
->
mu_message_lines
),
mu_umaxtostr
(
3
,
buflen
));
if
(
section
)
free
(
section
);
CHECK_ERROR
(
f_imap
,
status
);
...
...
@@ -1292,8 +1306,9 @@ imap_message_size (mu_message_t msg, size_t *psize)
that octet so add it in the offset, since it's the number of
lines. */
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d RFC822.SIZE
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
);
"g%s FETCH %s RFC822.SIZE
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_FETCH
;
...
...
@@ -1332,8 +1347,9 @@ imap_message_uid (mu_message_t msg, size_t *puid)
*
puid
=
msg_imap
->
uid
;
return
0
;
}
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d UID
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
);
status
=
imap_writeline
(
f_imap
,
"g%s FETCH %s UID
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_FETCH
;
...
...
@@ -1376,8 +1392,9 @@ imap_is_multipart (mu_message_t msg, int *ismulti)
return
0
;
}
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d BODYSTRUCTURE
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
);
"g%s FETCH %s BODYSTRUCTURE
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_FETCH
;
...
...
@@ -1515,8 +1532,9 @@ imap_envelope_date (mu_envelope_t envelope, char *buffer, size_t buflen,
if
(
f_imap
->
state
==
IMAP_NO_STATE
)
{
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d INTERNALDATE
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
);
"g%s FETCH %s INTERNALDATE
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_FETCH
;
...
...
@@ -1596,8 +1614,9 @@ imap_attr_get_flags (mu_attribute_t attribute, int *pflags)
if
(
f_imap
->
state
==
IMAP_NO_STATE
)
{
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d FLAGS
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
);
status
=
imap_writeline
(
f_imap
,
"g%s FETCH %s FLAGS
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_FETCH
;
...
...
@@ -1651,8 +1670,10 @@ imap_attr_set_flags (mu_attribute_t attribute, int flag)
free
(
abuf
);
return
0
;
}
status
=
imap_writeline
(
f_imap
,
"g%d STORE %d +FLAGS.SILENT (%s)
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
abuf
);
status
=
imap_writeline
(
f_imap
,
"g%s STORE %s +FLAGS.SILENT (%s)
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
abuf
);
free
(
abuf
);
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
...
...
@@ -1698,8 +1719,10 @@ imap_attr_unset_flags (mu_attribute_t attribute, int flag)
free
(
abuf
);
return
0
;
}
status
=
imap_writeline
(
f_imap
,
"g%d STORE %d -FLAGS.SILENT (%s)
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
abuf
);
status
=
imap_writeline
(
f_imap
,
"g%s STORE %s -FLAGS.SILENT (%s)
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
abuf
);
free
(
abuf
);
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
...
...
@@ -1742,8 +1765,11 @@ imap_header_get_value (mu_header_t header, const char *field, char * buffer,
if
(
status
!=
0
)
return
status
;
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d BODY.PEEK[HEADER.FIELDS (%s)]<0.%d>
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
field
,
len
);
"g%s FETCH %s BODY.PEEK[HEADER.FIELDS (%s)]<0.%s>
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
field
,
mu_umaxtostr
(
2
,
len
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_FETCH
;
...
...
@@ -1819,8 +1845,9 @@ imap_header_get_fvalue (mu_header_t header, const char *field, char * buffer,
if
(
status
!=
0
)
return
status
;
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
"g%s FETCH %s (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
MU_IMAP_CACHE_HEADERS
);
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
...
...
@@ -1885,18 +1912,24 @@ imap_header_read (mu_header_t header, char *buffer, size_t buflen, mu_off_t offs
{
char
*
section
=
section_name
(
msg_imap
);
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d BODY.PEEK[%s.MIME]<%d.%d>
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
"g%s FETCH %s BODY.PEEK[%s.MIME]<%s.%s>
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
(
section
)
?
section
:
""
,
offset
+
msg_imap
->
header_lines
,
buflen
);
mu_umaxtostr
(
2
,
offset
+
msg_imap
->
header_lines
),
mu_umaxtostr
(
3
,
buflen
));
if
(
section
)
free
(
section
);
}
else
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d BODY.PEEK[HEADER]<%d.%d>
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
offset
+
msg_imap
->
header_lines
,
buflen
);
"g%s FETCH %s BODY.PEEK[HEADER]<%s.%s>
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
mu_umaxtostr
(
2
,
offset
+
msg_imap
->
header_lines
),
mu_umaxtostr
(
3
,
buflen
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_FETCH
;
...
...
@@ -1994,18 +2027,24 @@ imap_body_read (mu_stream_t stream, char *buffer, size_t buflen,
{
char
*
section
=
section_name
(
msg_imap
);
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d BODY.PEEK[%s]<%d.%d>
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
"g%s FETCH %s BODY.PEEK[%s]<%s.%s>
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
(
section
)
?
section
:
""
,
offset
+
msg_imap
->
body_lines
,
buflen
);
mu_umaxtostr
(
2
,
offset
+
msg_imap
->
body_lines
),
mu_umaxtostr
(
3
,
buflen
));
if
(
section
)
free
(
section
);
}
else
status
=
imap_writeline
(
f_imap
,
"g%d FETCH %d BODY.PEEK[TEXT]<%d.%d>
\r\n
"
,
f_imap
->
seq
++
,
msg_imap
->
num
,
offset
+
msg_imap
->
body_lines
,
buflen
);
"g%s FETCH %s BODY.PEEK[TEXT]<%s.%s>
\r\n
"
,
mu_umaxtostr
(
0
,
f_imap
->
seq
++
),
mu_umaxtostr
(
1
,
msg_imap
->
num
),
mu_umaxtostr
(
2
,
offset
+
msg_imap
->
body_lines
),
mu_umaxtostr
(
3
,
buflen
));
CHECK_ERROR
(
f_imap
,
status
);
MAILBOX_DEBUG0
(
m_imap
->
mailbox
,
MU_DEBUG_PROT
,
f_imap
->
buffer
);
f_imap
->
state
=
IMAP_FETCH
;
...
...
@@ -2178,7 +2217,7 @@ flags_to_string (char **pbuf, int flag)
static
int
add_number
(
char
**
pset
,
size_t
start
,
size_t
end
)
{
char
buf
[
128
];
char
buf
[
2
*
UINTMAX_STRSIZE_BOUND
+
2
];
char
*
set
;
char
*
tmp
;
size_t
set_len
=
0
;
...
...
@@ -2195,11 +2234,11 @@ add_number (char **pset, size_t start, size_t end)
if
(
start
==
0
)
*
buf
=
'\0'
;
else
if
(
start
!=
end
)
snprintf
(
buf
,
sizeof
buf
,
"%
lu:%lu
"
,
(
unsigned
long
)
start
,
(
unsigned
long
)
end
);
snprintf
(
buf
,
sizeof
buf
,
"%
s:%s
"
,
mu_umaxtostr
(
0
,
start
)
,
mu_umaxtostr
(
1
,
end
)
);
else
snprintf
(
buf
,
sizeof
buf
,
"%
lu"
,
(
unsigned
long
)
start
);
snprintf
(
buf
,
sizeof
buf
,
"%
s"
,
mu_umaxtostr
(
0
,
start
)
);
if
(
set_len
)
tmp
=
realloc
(
set
,
set_len
+
strlen
(
buf
)
+
2
/* null and comma */
);
...
...
mailbox/message.c
View file @
d44a6c7
...
...
@@ -51,6 +51,7 @@
#include <mailutils/stream.h>
#include <mailutils/mu_auth.h>
#include <mailutils/nls.h>
#include <mu_umaxtostr.h>
#define MESSAGE_MODIFIED 0x10000;
...
...
@@ -637,7 +638,8 @@ mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pwri
sprintf
(
tmp
,
"%02x"
,
md5digest
[
n
]);
*
tmp
=
'\0'
;
/* POP3 rfc says that an UID should not be longer than 70. */
snprintf
(
buf
+
32
,
70
,
".%lu.%u"
,
(
unsigned
long
)
time
(
NULL
),
uid
);
snprintf
(
buf
+
32
,
70
,
".%lu.%s"
,
(
unsigned
long
)
time
(
NULL
),
mu_umaxtostr
(
0
,
uid
));
mu_header_set_value
(
header
,
"X-UIDL"
,
buf
,
1
);
buflen
--
;
/* leave space for the NULL. */
...
...
mh/burst.c
View file @
d44a6c7
...
...
@@ -426,11 +426,11 @@ burst (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data)
if
(
burst_or_copy
(
msg
,
1
,
0
)
==
0
)
{
VERBOSE
((
ngettext
(
"%
lu message exploded from digest %lu
"
,
"%
lu messages exploded from digest %lu
"
,
map
.
count
),
(
unsigned
long
)
map
.
count
,
(
unsigned
long
)
num
));
VERBOSE
((
ngettext
(
"%
s message exploded from digest %s
"
,
"%
s messages exploded from digest %s
"
,
(
unsigned
long
)
map
.
count
),
mu_umaxtostr
(
0
,
map
.
count
)
,
mu_umaxtostr
(
1
,
num
)
));
if
(
inplace
)
{
obstack_grow
(
&
stk
,
&
map
,
sizeof
map
);
...
...
@@ -438,7 +438,7 @@ burst (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data)
}
}
else
if
(
!
quiet
)
mh_error
(
_
(
"message %
lu not in digest format"
),
(
unsigned
long
)
num
);
mh_error
(
_
(
"message %
s not in digest format"
),
mu_umaxtostr
(
0
,
num
)
);
}
...
...
@@ -453,8 +453,8 @@ burst_rename (mh_msgset_t *ms, size_t lastuid)
j
=
burst_count
-
1
;
for
(
i
=
ms
->
count
;
i
>
0
;
i
--
)
{
char
*
from
;
char
*
to
;
c
onst
c
har
*
from
;
c
onst
c
har
*
to
;
if
(
ms
->
list
[
i
-
1
]
==
burst_map
[
j
].
msgno
)
{
...
...
@@ -466,8 +466,8 @@ burst_rename (mh_msgset_t *ms, size_t lastuid)
if
(
ms
->
list
[
i
-
1
]
==
lastuid
)
continue
;
asprintf
(
&
from
,
"%lu"
,
(
unsigned
long
)
ms
->
list
[
i
-
1
]);
asprintf
(
&
to
,
"%lu"
,
(
unsigned
long
)
lastuid
);
from
=
mu_umaxtostr
(
0
,
ms
->
list
[
i
-
1
]);
to
=
mu_umaxtostr
(
1
,
lastuid
);
--
lastuid
;
VERBOSE
((
_
(
"message %s becomes message %s"
),
from
,
to
));
...
...
@@ -478,8 +478,6 @@ burst_rename (mh_msgset_t *ms, size_t lastuid)
from
,
to
,
mu_strerror
(
errno
));
exit
(
1
);
}
free
(
from
);
free
(
to
);
}
}
...
...
@@ -534,12 +532,10 @@ finalize_inplace (size_t lastuid)
/* FIXME: toc handling */
for
(
j
=
0
;
j
<
burst_map
[
i
].
count
;
j
++
)
{
char
*
to
;
asprintf
(
&
to
,
"%lu"
,
(
unsigned
long
)
(
burst_map
[
i
].
msgno
+
1
+
j
));
VERBOSE
((
_
(
"message %lu of digest %lu becomes message %s"
),
(
unsigned
long
)
(
j
+
1
),
(
unsigned
long
)
burst_map
[
i
].
msgno
,
to
));
const
char
*
to
=
mu_umaxtostr
(
0
,
burst_map
[
i
].
msgno
+
1
+
j
);
VERBOSE
((
_
(
"message %s of digest %s becomes message %s"
),
mu_umaxtostr
(
1
,
j
+
1
),
mu_umaxtostr
(
2
,
burst_map
[
i
].
msgno
),
to
));
msg_copy
(
burst_map
[
i
].
first
+
j
,
to
);
}
}
...
...
@@ -606,10 +602,9 @@ main (int argc, char **argv)
mu_mailbox_uidnext
(
mbox
,
&
next_uid
);
for
(
i
=
0
,
last_uid
=
next_uid
-
1
;
i
<
burst_count
;
i
++
)
last_uid
+=
burst_map
[
i
].
count
;
VERBOSE
((
_
(
"Estimated last UID: %
lu"
),
(
unsigned
long
)
last_uid
));
VERBOSE
((
_
(
"Estimated last UID: %
s"
),
mu_umaxtostr
(
0
,
last_uid
)
));
asprintf
(
&
xargv
[
0
],
"%lu-last"
,
(
unsigned
long
)
burst_map
[
0
].
msgno
);
asprintf
(
&
xargv
[
0
],
"%s-last"
,
mu_umaxtostr
(
0
,
burst_map
[
0
].
msgno
));
xargv
[
1
]
=
NULL
;
mh_msgset_parse
(
mbox
,
&
ms
,
1
,
xargv
,
NULL
);
free
(
xargv
[
0
]);
...
...
mh/compcommon.c
View file @
d44a6c7
...
...
@@ -91,8 +91,10 @@ check_draft_disposition (struct mh_whatnow_env *wh, int use_draft)
disp
=
DISP_USE
;
else
{
printf
(
_
(
"Draft
\"
%s
\"
exists (%lu bytes).
\n
"
),
wh
->
draftfile
,
(
unsigned
long
)
st
.
st_size
);
printf
(
ngettext
(
"Draft
\"
%s
\"
exists (%s byte).
\n
"
,
"Draft
\"
%s
\"
exists (%su bytes).
\n
"
,
(
unsigned
long
)
st
.
st_size
),
wh
->
draftfile
,
mu_umaxtostr
(
0
,
st
.
st_size
));
disp
=
mh_disposition
(
wh
->
draftfile
);
}
}
...
...
mh/folder.c
View file @
d44a6c7
...
...
@@ -383,7 +383,7 @@ _scan (const char *name, int depth)
if
(
info
.
cur
)
{
asprintf
(
&
p
,
"%s/%
lu"
,
name
,
(
unsigned
long
)
info
.
cur
);
asprintf
(
&
p
,
"%s/%
s"
,
name
,
mu_umaxtostr
(
0
,
info
.
cur
)
);
if
(
stat
(
p
,
&
st
)
<
0
||
!
S_ISREG
(
st
.
st_mode
))
info
.
cur
=
0
;
free
(
p
);
...
...
@@ -593,12 +593,12 @@ static int
pack_rename
(
struct
pack_tab
*
tab
,
int
reverse
)
{
int
rc
;
c
har
s1
[
64
]
;
c
har
s2
[
64
]
;
char
*
from
,
*
to
;
c
onst
char
*
s1
;
c
onst
char
*
s2
;
c
onst
c
har
*
from
,
*
to
;
s
nprintf
(
s1
,
sizeof
s1
,
"%lu"
,
(
unsigned
long
)
tab
->
orig
);
s
nprintf
(
s2
,
sizeof
s2
,
"%lu"
,
(
unsigned
long
)
tab
->
new
);
s
1
=
mu_umaxtostr
(
0
,
tab
->
orig
);
s
2
=
mu_umaxtostr
(
1
,
tab
->
new
);
if
(
!
reverse
)
{
...
...
@@ -660,10 +660,12 @@ roll_back (const char *folder_name, struct pack_tab *pack_tab, size_t i)
{
mh_error
(
_
(
"CRITICAL ERROR: Folder `%s' left in an inconsistent state, because an error
\n
"
"occurred while trying to roll back the changes.
\n
"
"Message range %
lu-%lu has been renamed to %lu-%lu
."
),
"Message range %
s-%s has been renamed to %s-%s
."
),
folder_name
,
pack_tab
[
0
].
orig
,
pack_tab
[
start
].
orig
,
pack_tab
[
0
].
new
,
pack_tab
[
start
].
new
);
mu_umaxtostr
(
0
,
pack_tab
[
0
].
orig
),
mu_umaxtostr
(
1
,
pack_tab
[
start
].
orig
),
mu_umaxtostr
(
2
,
pack_tab
[
0
].
new
),
mu_umaxtostr
(
3
,
pack_tab
[
start
].
new
));
mh_error
(
_
(
"You will have to fix it manually."
));
exit
(
1
);
}
...
...
@@ -794,10 +796,10 @@ action_pack ()
mh_message_number
(
msg
,
&
pack_tab
[
i
].
orig
);
}
if
(
verbose
)
fprintf
(
stderr
,
ngettext
(
"%
lu
message number collected.
\n
"
,
"%
lu
message numbers collected.
\n
"
,
count
),
(
unsigned
long
)
count
);
fprintf
(
stderr
,
ngettext
(
"%
s
message number collected.
\n
"
,
"%
s
message numbers collected.
\n
"
,
(
unsigned
long
)
count
),
mu_umaxtostr
(
0
,
count
)
);
mu_mailbox_close
(
mbox
);
mu_mailbox_destroy
(
&
mbox
);
...
...
mh/forw.c
View file @
d44a6c7
...
...
@@ -353,7 +353,7 @@ finish_draft ()
{
mu_url_t
url
;
const
char
*
mbox_path
;
char
buf
[
64
]
;
char
*
p
;
size_t
i
;
mu_mailbox_get_url
(
mbox
,
&
url
);
...
...
@@ -373,8 +373,8 @@ finish_draft ()
if
(
annotate
)
mu_list_append
(
wh_env
.
anno_list
,
msg
);
mh_message_number
(
msg
,
&
num
);
snprintf
(
buf
,
sizeof
buf
,
" %lu"
,
(
unsigned
long
)
num
);
rc
=
mu_stream_sequential_write
(
stream
,
buf
,
strlen
(
buf
));
p
=
mu_umaxtostr
(
0
,
num
);
rc
=
mu_stream_sequential_write
(
stream
,
p
,
strlen
(
p
));
}
}
else
...
...
mh/mh_global.c
View file @
d44a6c7
...
...
@@ -183,9 +183,7 @@ mh_global_sequences_iterate (mh_context_iterator fp, void *data)
void
mh_global_save_state
()
{
char
buf
[
64
];
snprintf
(
buf
,
sizeof
buf
,
"%lu"
,
(
unsigned
long
)
current_message
);
mh_context_set_value
(
sequences
,
"cur"
,
buf
);
mh_context_set_value
(
sequences
,
"cur"
,
mu_umaxtostr
(
0
,
current_message
));
mh_context_write
(
sequences
);
mh_context_set_value
(
context
,
"Current-Folder"
,
current_folder
);
...
...
mh/mh_msgset.c
View file @
d44a6c7
...
...
@@ -154,7 +154,6 @@ msgset_preproc_part (mu_mailbox_t mbox, char *arg, char **rest)
{
int
rc
;
size_t
uid
,
num
;
char
*
ret
=
NULL
;
mu_message_t
msg
;
if
(
p
->
handler
(
mbox
,
&
num
))
...
...
@@ -165,10 +164,9 @@ msgset_preproc_part (mu_mailbox_t mbox, char *arg, char **rest)
mh_error
(
_
(
"Cannot get message %d: %s"
),
num
,
mu_strerror
(
rc
));
exit
(
1
);
}
mu_message_get_uid
(
msg
,
&
uid
);
asprintf
(
&
ret
,
"%lu"
,
(
unsigned
long
)
uid
);
*
rest
=
arg
+
strlen
(
p
->
name
);
return
ret
;
mu_message_get_uid
(
msg
,
&
uid
);
return
xstrdup
(
mu_umaxtostr
(
0
,
uid
));
}
cp
=
strchr
(
arg
,
'-'
);
if
(
cp
)
...
...
mh/mh_sequence.c
View file @
d44a6c7
...
...
@@ -68,7 +68,7 @@ mh_seq_add (char *name, mh_msgset_t *mset, int flags)
{
char
*
value
=
mh_seq_read
(
name
,
flags
);
char
*
new_value
,
*
p
;
c
har
buf
[
64
]
;
c
onst
char
*
buf
;
size_t
i
,
len
;
delete_sequence
(
name
,
!
(
flags
&
SEQ_PRIVATE
));
...
...
@@ -83,7 +83,7 @@ mh_seq_add (char *name, mh_msgset_t *mset, int flags)
len
++
;
for
(
i
=
0
;
i
<
mset
->
count
;
i
++
)
{
snprintf
(
buf
,
sizeof
buf
,
"%lu"
,
(
unsigned
long
)
mset
->
list
[
i
]);
buf
=
mu_umaxtostr
(
0
,
mset
->
list
[
i
]);
len
+=
strlen
(
buf
)
+
1
;
}
...
...
@@ -96,7 +96,7 @@ mh_seq_add (char *name, mh_msgset_t *mset, int flags)
*
p
++
=
' '
;
for
(
i
=
0
;
i
<
mset
->
count
;
i
++
)
{
p
+=
sprintf
(
p
,
"%
lu"
,
(
unsigned
long
)
mset
->
list
[
i
]
);
p
+=
sprintf
(
p
,
"%
s"
,
mu_umaxtostr
(
0
,
mset
->
list
[
i
])
);
*
p
++
=
' '
;
}
*
p
=
0
;
...
...
mh/mhn.c
View file @
d44a6c7
...
...
@@ -480,7 +480,7 @@ msg_part_print (msg_part_t p, int max_width)
printf
(
"."
);
width
++
;
}
width
+=
printf
(
"%
lu"
,
(
unsigned
long
)
p
->
part
[
i
]
);
width
+=
printf
(
"%
s"
,
mu_umaxtostr
(
0
,
p
->
part
[
i
])
);
}
for
(;
width
<
max_width
;
width
++
)
putchar
(
' '
);
...
...
@@ -492,13 +492,12 @@ msg_part_format (msg_part_t p)
int
i
;
int
width
=
0
;
char
*
str
,
*
s
;
char
buf
[
64
];
for
(
i
=
1
;
i
<=
p
->
level
;
i
++
)
{
if
(
i
>
1
)
width
++
;
width
+=
s
nprintf
(
buf
,
sizeof
buf
,
"%lu"
,
(
unsigned
long
)
p
->
part
[
i
]
);
width
+=
s
trlen
(
mu_umaxtostr
(
0
,
p
->
part
[
i
])
);
}
str
=
s
=
xmalloc
(
width
+
1
);
...
...
@@ -506,7 +505,7 @@ msg_part_format (msg_part_t p)
{
if
(
i
>
1
)
*
s
++
=
'.'
;
s
+=
sprintf
(
s
,
"%
lu"
,
(
unsigned
long
)
p
->
part
[
i
]
);
s
+=
sprintf
(
s
,
"%
s"
,
mu_umaxtostr
(
0
,
p
->
part
[
i
])
);
}
*
s
=
0
;
return
str
;
...
...
@@ -516,16 +515,17 @@ void
msg_part_format_stk
(
struct
obstack
*
stk
,
msg_part_t
p
)
{
int
i
;
char
buf
[
64
];
for
(
i
=
1
;
i
<=
p
->
level
;
i
++
)
{
int
len
;
char
*
buf
;
if
(
i
>
1
)
obstack_1grow
(
stk
,
'.'
);
len
=
snprintf
(
buf
,
sizeof
buf
,
"%lu"
,
(
unsigned
long
)
p
->
part
[
i
]);
buf
=
mu_umaxtostr
(
0
,
p
->
part
[
i
]);
len
=
strlen
(
buf
);
obstack_grow
(
stk
,
buf
,
len
);
}
}
...
...
@@ -793,7 +793,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, char *name)
char
*
typestr
,
*
type
,
*
subtype
,
*
typeargs
;
struct
obstack
stk
;
mu_header_t
hdr
;
char
buf
[
64
]
;
char
*
buf
;
mu_message_get_header
(
msg
,
&
hdr
);
_get_content_type
(
hdr
,
&
typestr
,
&
typeargs
);
...
...
@@ -823,8 +823,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, char *name)
obstack_grow
(
&
stk
,
name
,
strlen
(
name
));
else
{
snprintf
(
buf
,
sizeof
buf
,
"%lu"
,
(
unsigned
long
)
msg_part_subpart
(
part
,
0
));
buf
=
mu_umaxtostr
(
0
,
msg_part_subpart
(
part
,
0
));
obstack_grow
(
&
stk
,
buf
,
strlen
(
buf
));
}
break
;
...
...
@@ -846,7 +845,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, char *name)
case
'd'
:
/* content description */
if
(
mu_header_aget_value
(
hdr
,
MU_HEADER_CONTENT_DESCRIPTION
,
&
tmp
)
==
0
)
&
tmp
)
==
0
)
{
obstack_grow
(
&
stk
,
tmp
,
strlen
(
tmp
));
free
(
tmp
);
...
...
@@ -1252,8 +1251,8 @@ show_internal (mu_message_t msg, msg_part_t part, char *encoding, mu_stream_t ou
if
((
rc
=
mu_message_get_body
(
msg
,
&
body
)))
{
mh_error
(
_
(
"%
lu
: cannot get message body: %s"
),
(
unsigned
long
)
msg_part_subpart
(
part
,
0
),
mh_error
(
_
(
"%
s
: cannot get message body: %s"
),
mu_umaxtostr
(
0
,
msg_part_subpart
(
part
,
0
)
),
mu_strerror
(
rc
));
return
0
;
}
...
...
@@ -1363,7 +1362,6 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
mu_stream_t
out
=
data
;
char
*
cmd
;
int
flags
=
0
;
char
buf
[
64
];
int
fd
=
1
;
char
*
tempfile
=
NULL
;
int
ismime
;
...
...
@@ -1383,6 +1381,7 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
if
(
flags
&
MHN_LISTING
)
{
char
*
str
;
char
*
p
;
size_t
size
=
0
;
str
=
_
(
"part "
);
...
...
@@ -1393,8 +1392,8 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
mu_stream_sequential_write
(
out
,
" "
,
1
);
mu_stream_sequential_write
(
out
,
type
,
strlen
(
type
));
mhn_message_size
(
msg
,
&
size
);
snprintf
(
buf
,
sizeof
buf
,
" %lu"
,
(
unsigned
long
)
size
);
mu_stream_sequential_write
(
out
,
buf
,
strlen
(
buf
));
p
=
mu_umaxtostr
(
0
,
size
);
mu_stream_sequential_write
(
out
,
p
,
strlen
(
p
));
mu_stream_sequential_write
(
out
,
"
\n
"
,
1
);
mu_stream_flush
(
out
);
}
...
...
@@ -1403,6 +1402,7 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
{
if
(
isatty
(
fd
)
&&
isatty
(
0
))
{
char
buf
[
64
];
printf
(
_
(
"Press <return> to show content..."
));
if
(
!
fgets
(
buf
,
sizeof
buf
,
stdin
)
||
buf
[
0
]
!=
'\n'
)
return
0
;
...
...
@@ -1652,8 +1652,8 @@ store_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
tmp
,
name
);
else
printf
(
_
(
"storing message %
lu
part %s as file %s
\n
"
),
(
unsigned
long
)
msg_part_subpart
(
part
,
0
),
printf
(
_
(
"storing message %
s
part %s as file %s
\n
"
),
mu_umaxtostr
(
0
,
msg_part_subpart
(
part
,
0
)
),
tmp
,
name
);
free
(
tmp
);
...
...
mh/mhpath.c
View file @
d44a6c7
...
...
@@ -66,7 +66,7 @@ mhpath (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data)
size_t
uid
;
mh_message_number
(
msg
,
&
uid
);
printf
(
"%s/%
lu
\n
"
,
(
char
*
)
data
,
(
unsigned
long
)
uid
);
printf
(
"%s/%
s
\n
"
,
(
char
*
)
data
,
mu_umaxtostr
(
0
,
uid
)
);
}
int
...
...
@@ -126,7 +126,7 @@ main (int argc, char **argv)
mu_mailbox_get_message
(
mbox
,
total
,
&
msg
);
mh_message_number
(
msg
,
&
num
);
printf
(
"%s/%
lu
\n
"
,
mhdir
,
(
unsigned
long
)(
num
+
1
));
printf
(
"%s/%
s
\n
"
,
mhdir
,
mu_umaxtostr
(
0
,
num
+
1
));
exit
(
0
);
}
...
...
mh/pick.c
View file @
d44a6c7
...
...
@@ -305,7 +305,7 @@ pick_message (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data)
{
mh_message_number
(
msg
,
&
num
);
if
(
list
)
printf
(
"%
lu
\n
"
,
(
unsigned
long
)
num
);
printf
(
"%
s
\n
"
,
mu_umaxtostr
(
0
,
num
)
);
if
(
seq_list
)
{
obstack_grow
(
&
msgno_stk
,
&
num
,
sizeof
(
num
));
...
...
mh/repl.c
View file @
d44a6c7
...
...
@@ -277,10 +277,10 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
disp
=
DISP_USE
;
else
{
printf
(
ngettext
(
"Draft
\"
%s
\"
exists (%
lu
byte).
\n
"
,
"Draft
\"
%s
\"
exists (%
lu
bytes).
\n
"
,
st
.
st_size
),
wh
->
draftfile
,
(
unsigned
long
)
st
.
st_size
);
printf
(
ngettext
(
"Draft
\"
%s
\"
exists (%
s
byte).
\n
"
,
"Draft
\"
%s
\"
exists (%
s
bytes).
\n
"
,
(
unsigned
long
)
st
.
st_size
),
wh
->
draftfile
,
mu_umaxtostr
(
0
,
st
.
st_size
)
);
disp
=
mh_disposition
(
wh
->
draftfile
);
}
}
...
...
@@ -304,8 +304,8 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
rc
=
mu_mailbox_get_message
(
mbox
,
msgset
.
list
[
0
],
&
msg
);
if
(
rc
)
{
mh_error
(
_
(
"Cannot read message %
lu
: %s"
),
(
unsigned
long
)
msgset
.
list
[
0
]
,
mh_error
(
_
(
"Cannot read message %
s
: %s"
),
mu_umaxtostr
(
0
,
msgset
.
list
[
0
])
,
mu_strerror
(
rc
));
exit
(
1
);
}
...
...
@@ -360,7 +360,7 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
mu_mailbox_get_url
(
mbox
,
&
url
);
mh_message_number
(
msg
,
&
num
);
asprintf
(
&
msgname
,
"%s/%
lu"
,
mu_url_to_string
(
url
),
(
unsigned
long
)
num
);
asprintf
(
&
msgname
,
"%s/%
s"
,
mu_url_to_string
(
url
),
mu_umaxtostr
(
0
,
num
)
);
p
=
strchr
(
msgname
,
':'
);
if
(
!
p
)
wh
->
msg
=
msgname
;
...
...
mh/sortm.c
View file @
d44a6c7
...
...
@@ -377,9 +377,9 @@ comp0 (size_t na, size_t nb)
return
0
;
if
(
verbose
>
1
)
fprintf
(
stderr
,
_
(
"comparing messages %
lu and %lu
: "
),
(
unsigned
long
)
na
,
(
unsigned
long
)
nb
);
_
(
"comparing messages %
s and %s
: "
),
mu_umaxtostr
(
0
,
na
)
,
mu_umaxtostr
(
1
,
nb
)
);
return
compare_messages
(
a
,
b
);
}
...
...
@@ -445,8 +445,8 @@ swap_message (size_t a, size_t b)
char
*
path_a
,
*
path_b
;
char
*
tmp
;
asprintf
(
&
path_a
,
"%s/%
lu"
,
mbox_path
,
(
unsigned
long
)
a
);
asprintf
(
&
path_b
,
"%s/%
lu"
,
mbox_path
,
(
unsigned
long
)
b
);
asprintf
(
&
path_a
,
"%s/%
s"
,
mbox_path
,
mu_umaxtostr
(
0
,
a
)
);
asprintf
(
&
path_b
,
"%s/%
s"
,
mbox_path
,
mu_umaxtostr
(
1
,
b
)
);
tmp
=
mu_tempname
(
mbox_path
);
rename
(
path_a
,
tmp
);
unlink
(
path_a
);
...
...
@@ -526,9 +526,9 @@ sort ()
mh_message_number
(
msg
,
&
new_num
);
transpose
(
i
,
oldlist
[
i
]);
if
(
verbose
)
fprintf
(
stderr
,
"{%
lu, %lu
}
\n
"
,
(
unsigned
long
)
old_num
,
(
unsigned
long
)
new_num
);
fprintf
(
stderr
,
"{%
s, %s
}
\n
"
,
mu_umaxtostr
(
0
,
old_num
)
,
mu_umaxtostr
(
1
,
new_num
)
);
if
(
action
==
ACTION_REORDER
)
swap_message
(
old_num
,
new_num
);
}
...
...
pop3d/apop.c
View file @
d44a6c7
...
...
@@ -211,8 +211,8 @@ pop3d_apop (const char *arg)
/* Reset the uid. */
if
(
auth
->
change_uid
&&
setuid
(
auth
->
uid
)
==
-
1
)
{
syslog
(
LOG_INFO
,
_
(
"Cannot change to uid %
lu
: %m"
),
(
unsigned
long
)
auth
->
uid
);
syslog
(
LOG_INFO
,
_
(
"Cannot change to uid %
s
: %m"
),
mu_umaxtostr
(
0
,
auth
->
uid
)
);
mu_auth_data_free
(
auth
);
return
ERR_BAD_LOGIN
;
}
...
...
pop3d/capa.c
View file @
d44a6c7
...
...
@@ -53,7 +53,7 @@ pop3d_capa (const char *arg)
if
(
expire
<
0
)
pop3d_outf
(
"EXPIRE NEVER
\r\n
"
);
else
pop3d_outf
(
"EXPIRE %
d
\r\n
"
,
expire
);
pop3d_outf
(
"EXPIRE %
s
\r\n
"
,
mu_umaxtostr
(
0
,
expire
)
);
if
(
state
==
INITIAL
)
pop3d_outf
(
"XTLSREQUIRED
\r\n
"
);
...
...
pop3d/dele.c
View file @
d44a6c7
...
...
@@ -40,6 +40,6 @@ pop3d_dele (const char *arg)
mu_message_get_attribute
(
msg
,
&
attr
);
pop3d_mark_deleted
(
attr
);
pop3d_outf
(
"+OK Message %
d marked
\r\n
"
,
num
);
pop3d_outf
(
"+OK Message %
s marked
\r\n
"
,
mu_umaxtostr
(
0
,
num
)
);
return
OK
;
}
...
...
pop3d/list.c
View file @
d44a6c7
...
...
@@ -48,7 +48,9 @@ pop3d_list (const char *arg)
{
mu_message_size
(
msg
,
&
size
);
mu_message_lines
(
msg
,
&
lines
);
pop3d_outf
(
"%d %d
\r\n
"
,
mesgno
,
size
+
lines
);
pop3d_outf
(
"%s %s
\r\n
"
,
mu_umaxtostr
(
0
,
mesgno
),
mu_umaxtostr
(
1
,
size
+
lines
));
}
}
pop3d_outf
(
".
\r\n
"
);
...
...
@@ -63,7 +65,9 @@ pop3d_list (const char *arg)
return
ERR_MESG_DELE
;
mu_message_size
(
msg
,
&
size
);
mu_message_lines
(
msg
,
&
lines
);
pop3d_outf
(
"+OK %d %d
\r\n
"
,
mesgno
,
size
+
lines
);
pop3d_outf
(
"+OK %s %s
\r\n
"
,
mu_umaxtostr
(
0
,
mesgno
),
mu_umaxtostr
(
1
,
size
+
lines
));
}
return
OK
;
...
...
pop3d/logindelay.c
View file @
d44a6c7
...
...
@@ -123,7 +123,7 @@ login_delay_capa ()
if
(
login_delay
&&
open_stat_db
(
&
db
,
MU_STREAM_RDWR
)
==
0
)
{
pop3d_outf
(
"LOGIN-DELAY %
lu
\r\n
"
,
(
unsigned
long
)
login_delay
);
pop3d_outf
(
"LOGIN-DELAY %
s
\r\n
"
,
mu_umaxtostr
(
0
,
login_delay
)
);
mu_dbm_close
(
db
);
}
}
...
...
pop3d/pop3d.c
View file @
d44a6c7
...
...
@@ -528,8 +528,8 @@ pop3d_daemon (unsigned int maxchildren, unsigned int port)
process_cleanup
();
if
(
children
>
maxchildren
)
{
syslog
(
LOG_ERR
,
_
(
"too many children (%
lu
)"
),
(
unsigned
long
)
children
);
syslog
(
LOG_ERR
,
_
(
"too many children (%
s
)"
),
mu_umaxtostr
(
0
,
children
)
);
pause
();
continue
;
}
...
...
pop3d/stat.c
View file @
d44a6c7
...
...
@@ -56,7 +56,7 @@ pop3d_stat (const char *arg)
num
++
;
}
}
pop3d_outf
(
"+OK %
d %d
\r\n
"
,
num
,
tsize
);
pop3d_outf
(
"+OK %
s %s
\r\n
"
,
mu_umaxtostr
(
0
,
num
),
mu_umaxtostr
(
1
,
tsize
)
);
return
OK
;
}
...
...
pop3d/uidl.c
View file @
d44a6c7
...
...
@@ -44,7 +44,7 @@ pop3d_uidl (const char *arg)
if
(
!
pop3d_is_deleted
(
attr
))
{
mu_message_get_uidl
(
msg
,
uidl
,
sizeof
(
uidl
),
NULL
);
pop3d_outf
(
"%
d %s
\r\n
"
,
mesgno
,
uidl
);
pop3d_outf
(
"%
s %s
\r\n
"
,
mu_umaxtostr
(
0
,
mesgno
)
,
uidl
);
}
}
pop3d_outf
(
".
\r\n
"
);
...
...
@@ -58,7 +58,7 @@ pop3d_uidl (const char *arg)
if
(
pop3d_is_deleted
(
attr
))
return
ERR_MESG_DELE
;
mu_message_get_uidl
(
msg
,
uidl
,
sizeof
(
uidl
),
NULL
);
pop3d_outf
(
"+OK %
d %s
\r\n
"
,
mesgno
,
uidl
);
pop3d_outf
(
"+OK %
s %s
\r\n
"
,
mu_umaxtostr
(
0
,
mesgno
)
,
uidl
);
}
return
OK
;
...
...
pop3d/user.c
View file @
d44a6c7
...
...
@@ -166,10 +166,10 @@ pop3d_user (const char *arg)
mu_mailbox_get_url
(
mbox
,
&
url
);
mu_mailbox_messages_count
(
mbox
,
&
total
);
syslog
(
LOG_INFO
,
ngettext
(
"User `%s' logged in with mailbox `%s' (%
d
message)"
,
"User `%s' logged in with mailbox `%s' (%
d
messages)"
,
total
),
username
,
mu_url_to_string
(
url
),
total
);
ngettext
(
"User `%s' logged in with mailbox `%s' (%
s
message)"
,
"User `%s' logged in with mailbox `%s' (%
s
messages)"
,
(
unsigned
long
)
total
),
username
,
mu_url_to_string
(
url
),
mu_umaxtostr
(
0
,
total
)
);
}
return
OK
;
}
...
...
Please
register
or
sign in
to post a comment