Commit d44a6c72 d44a6c72504c8804e7e3763f9453e0232eb1b472 by Sergey Poznyakoff

Use mu_umaxtostr to format size_t and off_t values

1 parent 3a94393a
...@@ -177,7 +177,7 @@ imap4d_fetch0 (char *arg, int isuid, char *resp, size_t resplen) ...@@ -177,7 +177,7 @@ imap4d_fetch0 (char *arg, int isuid, char *resp, size_t resplen)
177 int space = 0; 177 int space = 0;
178 178
179 fcmd = NULL; 179 fcmd = NULL;
180 util_send ("* %d FETCH (", msgno); 180 util_send ("* %s FETCH (", mu_umaxtostr (0, msgno));
181 item[0] = '\0'; 181 item[0] = '\0';
182 /* Server implementations MUST implicitly 182 /* Server implementations MUST implicitly
183 include the UID message data item as part of any FETCH 183 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) ...@@ -462,7 +462,7 @@ fetch_uid (struct fetch_command *command, char **arg ARG_UNUSED)
462 size_t uid = 0; 462 size_t uid = 0;
463 463
464 mu_message_get_uid (command->msg, &uid); 464 mu_message_get_uid (command->msg, &uid);
465 util_send ("%s %d", command->name, uid); 465 util_send ("%s %s", command->name, mu_umaxtostr (0, uid));
466 return RESP_OK; 466 return RESP_OK;
467 } 467 }
468 468
...@@ -916,14 +916,14 @@ bodystructure (mu_message_t msg, int extension) ...@@ -916,14 +916,14 @@ bodystructure (mu_message_t msg, int extension)
916 mu_message_get_body (msg, &body); 916 mu_message_get_body (msg, &body);
917 mu_body_size (body, &size); 917 mu_body_size (body, &size);
918 mu_body_lines (body, &blines); 918 mu_body_lines (body, &blines);
919 util_send (" %d", size + blines); 919 util_send (" %s", mu_umaxtostr (0, size + blines));
920 } 920 }
921 921
922 /* If the mime type was text. */ 922 /* If the mime type was text. */
923 if (text_plain) 923 if (text_plain)
924 { 924 {
925 /* Add the line number of the body. */ 925 /* Add the line number of the body. */
926 util_send (" %d", blines); 926 util_send (" %s", mu_umaxtostr (0, blines));
927 } 927 }
928 else if (message_rfc822) 928 else if (message_rfc822)
929 { 929 {
...@@ -940,7 +940,7 @@ bodystructure (mu_message_t msg, int extension) ...@@ -940,7 +940,7 @@ bodystructure (mu_message_t msg, int extension)
940 util_send (")"); 940 util_send (")");
941 /* Size in text lines of the encapsulated message. */ 941 /* Size in text lines of the encapsulated message. */
942 mu_message_lines (emsg, &lines); 942 mu_message_lines (emsg, &lines);
943 util_send (" %d", lines); 943 util_send (" %s", mu_umaxtostr (0, lines));
944 mu_message_destroy (&emsg, NULL); 944 mu_message_destroy (&emsg, NULL);
945 } 945 }
946 946
...@@ -1150,7 +1150,7 @@ fetch_io (mu_stream_t stream, unsigned long start, unsigned long end, ...@@ -1150,7 +1150,7 @@ fetch_io (mu_stream_t stream, unsigned long start, unsigned long end,
1150 { 1150 {
1151 mu_stream_t rfc = NULL; 1151 mu_stream_t rfc = NULL;
1152 size_t n = 0; 1152 size_t n = 0;
1153 off_t offset; 1153 mu_off_t offset;
1154 1154
1155 mu_filter_create (&rfc, stream, "rfc822", MU_FILTER_ENCODE, MU_STREAM_READ); 1155 mu_filter_create (&rfc, stream, "rfc822", MU_FILTER_ENCODE, MU_STREAM_READ);
1156 1156
...@@ -1195,7 +1195,7 @@ fetch_io (mu_stream_t stream, unsigned long start, unsigned long end, ...@@ -1195,7 +1195,7 @@ fetch_io (mu_stream_t stream, unsigned long start, unsigned long end,
1195 util_send ("<%lu>", start); 1195 util_send ("<%lu>", start);
1196 if (total) 1196 if (total)
1197 { 1197 {
1198 util_send (" {%u}\r\n", total); 1198 util_send (" {%s}\r\n", mu_umaxtostr (0, total));
1199 util_send ("%s", p); 1199 util_send ("%s", p);
1200 } 1200 }
1201 else 1201 else
......
...@@ -381,8 +381,8 @@ imap4d_daemon (unsigned int maxchildren, unsigned int port) ...@@ -381,8 +381,8 @@ imap4d_daemon (unsigned int maxchildren, unsigned int port)
381 { 381 {
382 if (children > maxchildren) 382 if (children > maxchildren)
383 { 383 {
384 syslog (LOG_ERR, _("Too many children (%lu)"), 384 syslog (LOG_ERR, _("Too many children (%s)"),
385 (unsigned long) children); 385 mu_umaxtostr (0, children));
386 pause (); 386 pause ();
387 continue; 387 continue;
388 } 388 }
......
...@@ -286,10 +286,10 @@ do_search (struct parsebuf *pb) ...@@ -286,10 +286,10 @@ do_search (struct parsebuf *pb)
286 { 286 {
287 size_t uid; 287 size_t uid;
288 mu_message_get_uid (pb->msg, &uid); 288 mu_message_get_uid (pb->msg, &uid);
289 util_send (" %d", uid); 289 util_send (" %s", mu_umaxtostr (0, uid));
290 } 290 }
291 else 291 else
292 util_send (" %d", pb->msgno); 292 util_send (" %s", mu_umaxtostr (0, pb->msgno));
293 } 293 }
294 } 294 }
295 util_send ("\r\n"); 295 util_send ("\r\n");
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
29 #include <string.h> 29 #include <string.h>
30 30
31 #include <mailutils/daemon.h> 31 #include <mailutils/daemon.h>
32 #include <mu_umaxtostr.h>
32 33
33 static char *pidfile; 34 static char *pidfile;
34 static pid_t current_pid; 35 static pid_t current_pid;
...@@ -36,7 +37,7 @@ static pid_t current_pid; ...@@ -36,7 +37,7 @@ static pid_t current_pid;
36 int 37 int
37 mu_daemon_create_pidfile (const char *filename) 38 mu_daemon_create_pidfile (const char *filename)
38 { 39 {
39 char pid_string[10]; /* 32bit PID */ 40 const char *pid_string;
40 int fd; 41 int fd;
41 42
42 if (filename[0] != '/') 43 if (filename[0] != '/')
...@@ -57,8 +58,7 @@ mu_daemon_create_pidfile (const char *filename) ...@@ -57,8 +58,7 @@ mu_daemon_create_pidfile (const char *filename)
57 return 2; /* failure */ 58 return 2; /* failure */
58 } 59 }
59 60
60 snprintf (pid_string, sizeof (pid_string) - 1, "%lu\n", 61 pid_string = mu_umaxtostr (0, current_pid);
61 (unsigned long) current_pid);
62 write (fd, pid_string, strlen (pid_string)); 62 write (fd, pid_string, strlen (pid_string));
63 close (fd); 63 close (fd);
64 64
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
32 #include <assert.h> 32 #include <assert.h>
33 #include <time.h> 33 #include <time.h>
34 34
35 #include <mu_umaxtostr.h>
35 #include <mailutils/address.h> 36 #include <mailutils/address.h>
36 #include <mailutils/attribute.h> 37 #include <mailutils/attribute.h>
37 #include <mailutils/body.h> 38 #include <mailutils/body.h>
...@@ -374,7 +375,7 @@ mailbox_imap_close (mu_mailbox_t mailbox) ...@@ -374,7 +375,7 @@ mailbox_imap_close (mu_mailbox_t mailbox)
374 m_imap_t m_imap = mailbox->data; 375 m_imap_t m_imap = mailbox->data;
375 f_imap_t f_imap = m_imap->f_imap; 376 f_imap_t f_imap = m_imap->f_imap;
376 int status = 0; 377 int status = 0;
377 378
378 /* If we are not the selected mailbox, just close the stream. */ 379 /* If we are not the selected mailbox, just close the stream. */
379 if (m_imap != f_imap->selected) 380 if (m_imap != f_imap->selected)
380 return mu_folder_close (mailbox->folder); 381 return mu_folder_close (mailbox->folder);
...@@ -387,7 +388,8 @@ mailbox_imap_close (mu_mailbox_t mailbox) ...@@ -387,7 +388,8 @@ mailbox_imap_close (mu_mailbox_t mailbox)
387 switch (f_imap->state) 388 switch (f_imap->state)
388 { 389 {
389 case IMAP_NO_STATE: 390 case IMAP_NO_STATE:
390 status = imap_writeline (f_imap, "g%d CLOSE\r\n", f_imap->seq++); 391 status = imap_writeline (f_imap, "g%s CLOSE\r\n",
392 mu_umaxtostr (0, f_imap->seq++));
391 CHECK_ERROR (f_imap, status); 393 CHECK_ERROR (f_imap, status);
392 MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer); 394 MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer);
393 f_imap->state = IMAP_CLOSE; 395 f_imap->state = IMAP_CLOSE;
...@@ -677,8 +679,8 @@ imap_messages_count (mu_mailbox_t mailbox, size_t *pnum) ...@@ -677,8 +679,8 @@ imap_messages_count (mu_mailbox_t mailbox, size_t *pnum)
677 switch (f_imap->state) 679 switch (f_imap->state)
678 { 680 {
679 case IMAP_NO_STATE: 681 case IMAP_NO_STATE:
680 status = imap_writeline (f_imap, "g%d %s %s\r\n", 682 status = imap_writeline (f_imap, "g%s %s %s\r\n",
681 f_imap->seq++, 683 mu_umaxtostr (0, f_imap->seq++),
682 MBX_WRITABLE(mailbox) ? "SELECT" : "EXAMINE", 684 MBX_WRITABLE(mailbox) ? "SELECT" : "EXAMINE",
683 m_imap->name); 685 m_imap->name);
684 CHECK_ERROR (f_imap, status); 686 CHECK_ERROR (f_imap, status);
...@@ -746,8 +748,9 @@ imap_scan0 (mu_mailbox_t mailbox, size_t msgno, size_t *pcount, int notif) ...@@ -746,8 +748,9 @@ imap_scan0 (mu_mailbox_t mailbox, size_t msgno, size_t *pcount, int notif)
746 { 748 {
747 case IMAP_NO_STATE: 749 case IMAP_NO_STATE:
748 status = imap_writeline (f_imap, 750 status = imap_writeline (f_imap,
749 "g%d FETCH 1:* (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])\r\n", 751 "g%s FETCH 1:* (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])\r\n",
750 f_imap->seq++, MU_IMAP_CACHE_HEADERS); 752 mu_umaxtostr (0, f_imap->seq++),
753 MU_IMAP_CACHE_HEADERS);
751 CHECK_ERROR (f_imap, status); 754 CHECK_ERROR (f_imap, status);
752 MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer); 755 MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer);
753 f_imap->state = IMAP_SCAN; 756 f_imap->state = IMAP_SCAN;
...@@ -820,7 +823,8 @@ imap_is_updated (mu_mailbox_t mailbox) ...@@ -820,7 +823,8 @@ imap_is_updated (mu_mailbox_t mailbox)
820 switch (f_imap->state) 823 switch (f_imap->state)
821 { 824 {
822 case IMAP_NO_STATE: 825 case IMAP_NO_STATE:
823 status = imap_writeline (f_imap, "g%d NOOP\r\n", f_imap->seq++); 826 status = imap_writeline (f_imap, "g%s NOOP\r\n",
827 mu_umaxtostr (0, f_imap->seq++));
824 CHECK_ERROR (f_imap, status); 828 CHECK_ERROR (f_imap, status);
825 MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer); 829 MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer);
826 f_imap->state = IMAP_NOOP; 830 f_imap->state = IMAP_NOOP;
...@@ -874,8 +878,9 @@ imap_expunge (mu_mailbox_t mailbox) ...@@ -874,8 +878,9 @@ imap_expunge (mu_mailbox_t mailbox)
874 return 0; 878 return 0;
875 } 879 }
876 status = imap_writeline (f_imap, 880 status = imap_writeline (f_imap,
877 "g%d STORE %s +FLAGS.SILENT (\\Deleted)\r\n", 881 "g%s STORE %s +FLAGS.SILENT (\\Deleted)\r\n",
878 f_imap->seq++, set); 882 mu_umaxtostr (0, f_imap->seq++),
883 set);
879 free (set); 884 free (set);
880 CHECK_ERROR (f_imap, status); 885 CHECK_ERROR (f_imap, status);
881 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 886 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
...@@ -896,7 +901,8 @@ imap_expunge (mu_mailbox_t mailbox) ...@@ -896,7 +901,8 @@ imap_expunge (mu_mailbox_t mailbox)
896 901
897 case IMAP_EXPUNGE: 902 case IMAP_EXPUNGE:
898 case IMAP_EXPUNGE_ACK: 903 case IMAP_EXPUNGE_ACK:
899 status = imap_writeline (f_imap, "g%d EXPUNGE\r\n", f_imap->seq++); 904 status = imap_writeline (f_imap, "g%s EXPUNGE\r\n",
905 mu_umaxtostr (0, f_imap->seq++));
900 CHECK_ERROR (f_imap, status); 906 CHECK_ERROR (f_imap, status);
901 status = imap_send (f_imap); 907 status = imap_send (f_imap);
902 CHECK_EAGAIN (f_imap, status); 908 CHECK_EAGAIN (f_imap, status);
...@@ -1038,8 +1044,11 @@ imap_append_message0 (mu_mailbox_t mailbox, mu_message_t msg) ...@@ -1038,8 +1044,11 @@ imap_append_message0 (mu_mailbox_t mailbox, mu_message_t msg)
1038 mu_message_size (msg, &size); 1044 mu_message_size (msg, &size);
1039 mu_message_lines (msg, &lines); 1045 mu_message_lines (msg, &lines);
1040 total = size + lines; 1046 total = size + lines;
1041 status = imap_writeline (f_imap, "g%d APPEND %s %s {%d}\r\n", 1047 status = imap_writeline (f_imap, "g%s APPEND %s %s {%s}\r\n",
1042 f_imap->seq++, path, abuf, size + lines); 1048 mu_umaxtostr (0, f_imap->seq++),
1049 path,
1050 abuf,
1051 mu_umaxtostr (1, size + lines));
1043 free (abuf); 1052 free (abuf);
1044 free (path); 1053 free (path);
1045 CHECK_ERROR (f_imap, status); 1054 CHECK_ERROR (f_imap, status);
...@@ -1137,8 +1146,10 @@ imap_copy_message (mu_mailbox_t mailbox, mu_message_t msg) ...@@ -1137,8 +1146,10 @@ imap_copy_message (mu_mailbox_t mailbox, mu_message_t msg)
1137 if (path == NULL) 1146 if (path == NULL)
1138 return ENOMEM; 1147 return ENOMEM;
1139 mu_url_get_path (mailbox->url, path, n + 1, NULL); 1148 mu_url_get_path (mailbox->url, path, n + 1, NULL);
1140 status = imap_writeline (f_imap, "g%d COPY %d %s\r\n", f_imap->seq++, 1149 status = imap_writeline (f_imap, "g%s COPY %s %s\r\n",
1141 msg_imap->num, path); 1150 mu_umaxtostr (0, f_imap->seq++),
1151 mu_umaxtostr (1, msg_imap->num),
1152 path);
1142 free (path); 1153 free (path);
1143 CHECK_ERROR (f_imap, status); 1154 CHECK_ERROR (f_imap, status);
1144 MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer); 1155 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, ...@@ -1207,10 +1218,13 @@ imap_message_read (mu_stream_t stream, char *buffer, size_t buflen,
1207 /* We have strip the \r, but the offset on the imap server is with that 1218 /* We have strip the \r, but the offset on the imap server is with that
1208 octet(CFLF) so add it in the offset, it's the number of lines. */ 1219 octet(CFLF) so add it in the offset, it's the number of lines. */
1209 status = imap_writeline (f_imap, 1220 status = imap_writeline (f_imap,
1210 "g%d FETCH %d BODY.PEEK[%s]<%d.%d>\r\n", 1221 "g%s FETCH %s BODY.PEEK[%s]<%s.%s>\r\n",
1211 f_imap->seq++, msg_imap->num, 1222 mu_umaxtostr (0, f_imap->seq++),
1223 mu_umaxtostr (1, msg_imap->num),
1212 (section) ? section : "", 1224 (section) ? section : "",
1213 offset + msg_imap->mu_message_lines, buflen); 1225 mu_umaxtostr (2, offset +
1226 msg_imap->mu_message_lines),
1227 mu_umaxtostr (3, buflen));
1214 if (section) 1228 if (section)
1215 free (section); 1229 free (section);
1216 CHECK_ERROR (f_imap, status); 1230 CHECK_ERROR (f_imap, status);
...@@ -1292,8 +1306,9 @@ imap_message_size (mu_message_t msg, size_t *psize) ...@@ -1292,8 +1306,9 @@ imap_message_size (mu_message_t msg, size_t *psize)
1292 that octet so add it in the offset, since it's the number of 1306 that octet so add it in the offset, since it's the number of
1293 lines. */ 1307 lines. */
1294 status = imap_writeline (f_imap, 1308 status = imap_writeline (f_imap,
1295 "g%d FETCH %d RFC822.SIZE\r\n", 1309 "g%s FETCH %s RFC822.SIZE\r\n",
1296 f_imap->seq++, msg_imap->num); 1310 mu_umaxtostr (0, f_imap->seq++),
1311 mu_umaxtostr (1, msg_imap->num));
1297 CHECK_ERROR (f_imap, status); 1312 CHECK_ERROR (f_imap, status);
1298 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1313 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
1299 f_imap->state = IMAP_FETCH; 1314 f_imap->state = IMAP_FETCH;
...@@ -1332,8 +1347,9 @@ imap_message_uid (mu_message_t msg, size_t *puid) ...@@ -1332,8 +1347,9 @@ imap_message_uid (mu_message_t msg, size_t *puid)
1332 *puid = msg_imap->uid; 1347 *puid = msg_imap->uid;
1333 return 0; 1348 return 0;
1334 } 1349 }
1335 status = imap_writeline (f_imap, "g%d FETCH %d UID\r\n", 1350 status = imap_writeline (f_imap, "g%s FETCH %s UID\r\n",
1336 f_imap->seq++, msg_imap->num); 1351 mu_umaxtostr (0, f_imap->seq++),
1352 mu_umaxtostr (1, msg_imap->num));
1337 CHECK_ERROR (f_imap, status); 1353 CHECK_ERROR (f_imap, status);
1338 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1354 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
1339 f_imap->state = IMAP_FETCH; 1355 f_imap->state = IMAP_FETCH;
...@@ -1376,8 +1392,9 @@ imap_is_multipart (mu_message_t msg, int *ismulti) ...@@ -1376,8 +1392,9 @@ imap_is_multipart (mu_message_t msg, int *ismulti)
1376 return 0; 1392 return 0;
1377 } 1393 }
1378 status = imap_writeline (f_imap, 1394 status = imap_writeline (f_imap,
1379 "g%d FETCH %d BODYSTRUCTURE\r\n", 1395 "g%s FETCH %s BODYSTRUCTURE\r\n",
1380 f_imap->seq++, msg_imap->num); 1396 mu_umaxtostr (0, f_imap->seq++),
1397 mu_umaxtostr (1, msg_imap->num));
1381 CHECK_ERROR (f_imap, status); 1398 CHECK_ERROR (f_imap, status);
1382 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1399 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
1383 f_imap->state = IMAP_FETCH; 1400 f_imap->state = IMAP_FETCH;
...@@ -1515,8 +1532,9 @@ imap_envelope_date (mu_envelope_t envelope, char *buffer, size_t buflen, ...@@ -1515,8 +1532,9 @@ imap_envelope_date (mu_envelope_t envelope, char *buffer, size_t buflen,
1515 if (f_imap->state == IMAP_NO_STATE) 1532 if (f_imap->state == IMAP_NO_STATE)
1516 { 1533 {
1517 status = imap_writeline (f_imap, 1534 status = imap_writeline (f_imap,
1518 "g%d FETCH %d INTERNALDATE\r\n", 1535 "g%s FETCH %s INTERNALDATE\r\n",
1519 f_imap->seq++, msg_imap->num); 1536 mu_umaxtostr (0, f_imap->seq++),
1537 mu_umaxtostr (1, msg_imap->num));
1520 CHECK_ERROR (f_imap, status); 1538 CHECK_ERROR (f_imap, status);
1521 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1539 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
1522 f_imap->state = IMAP_FETCH; 1540 f_imap->state = IMAP_FETCH;
...@@ -1596,8 +1614,9 @@ imap_attr_get_flags (mu_attribute_t attribute, int *pflags) ...@@ -1596,8 +1614,9 @@ imap_attr_get_flags (mu_attribute_t attribute, int *pflags)
1596 1614
1597 if (f_imap->state == IMAP_NO_STATE) 1615 if (f_imap->state == IMAP_NO_STATE)
1598 { 1616 {
1599 status = imap_writeline (f_imap, "g%d FETCH %d FLAGS\r\n", 1617 status = imap_writeline (f_imap, "g%s FETCH %s FLAGS\r\n",
1600 f_imap->seq++, msg_imap->num); 1618 mu_umaxtostr (0, f_imap->seq++),
1619 mu_umaxtostr (1, msg_imap->num));
1601 CHECK_ERROR (f_imap, status); 1620 CHECK_ERROR (f_imap, status);
1602 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1621 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
1603 f_imap->state = IMAP_FETCH; 1622 f_imap->state = IMAP_FETCH;
...@@ -1651,8 +1670,10 @@ imap_attr_set_flags (mu_attribute_t attribute, int flag) ...@@ -1651,8 +1670,10 @@ imap_attr_set_flags (mu_attribute_t attribute, int flag)
1651 free (abuf); 1670 free (abuf);
1652 return 0; 1671 return 0;
1653 } 1672 }
1654 status = imap_writeline (f_imap, "g%d STORE %d +FLAGS.SILENT (%s)\r\n", 1673 status = imap_writeline (f_imap, "g%s STORE %s +FLAGS.SILENT (%s)\r\n",
1655 f_imap->seq++, msg_imap->num, abuf); 1674 mu_umaxtostr (0, f_imap->seq++),
1675 mu_umaxtostr (1, msg_imap->num),
1676 abuf);
1656 free (abuf); 1677 free (abuf);
1657 CHECK_ERROR (f_imap, status); 1678 CHECK_ERROR (f_imap, status);
1658 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1679 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) ...@@ -1698,8 +1719,10 @@ imap_attr_unset_flags (mu_attribute_t attribute, int flag)
1698 free (abuf); 1719 free (abuf);
1699 return 0; 1720 return 0;
1700 } 1721 }
1701 status = imap_writeline (f_imap, "g%d STORE %d -FLAGS.SILENT (%s)\r\n", 1722 status = imap_writeline (f_imap, "g%s STORE %s -FLAGS.SILENT (%s)\r\n",
1702 f_imap->seq++, msg_imap->num, abuf); 1723 mu_umaxtostr (0, f_imap->seq++),
1724 mu_umaxtostr (1, msg_imap->num),
1725 abuf);
1703 free (abuf); 1726 free (abuf);
1704 CHECK_ERROR (f_imap, status); 1727 CHECK_ERROR (f_imap, status);
1705 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1728 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, ...@@ -1742,8 +1765,11 @@ imap_header_get_value (mu_header_t header, const char *field, char * buffer,
1742 if (status != 0) 1765 if (status != 0)
1743 return status; 1766 return status;
1744 status = imap_writeline (f_imap, 1767 status = imap_writeline (f_imap,
1745 "g%d FETCH %d BODY.PEEK[HEADER.FIELDS (%s)]<0.%d>\r\n", 1768 "g%s FETCH %s BODY.PEEK[HEADER.FIELDS (%s)]<0.%s>\r\n",
1746 f_imap->seq++, msg_imap->num, field, len); 1769 mu_umaxtostr (0, f_imap->seq++),
1770 mu_umaxtostr (1, msg_imap->num),
1771 field,
1772 mu_umaxtostr (2, len));
1747 CHECK_ERROR (f_imap, status); 1773 CHECK_ERROR (f_imap, status);
1748 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1774 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
1749 f_imap->state = IMAP_FETCH; 1775 f_imap->state = IMAP_FETCH;
...@@ -1819,8 +1845,9 @@ imap_header_get_fvalue (mu_header_t header, const char *field, char * buffer, ...@@ -1819,8 +1845,9 @@ imap_header_get_fvalue (mu_header_t header, const char *field, char * buffer,
1819 if (status != 0) 1845 if (status != 0)
1820 return status; 1846 return status;
1821 status = imap_writeline (f_imap, 1847 status = imap_writeline (f_imap,
1822 "g%d FETCH %d (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])\r\n", 1848 "g%s FETCH %s (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])\r\n",
1823 f_imap->seq++, msg_imap->num, 1849 mu_umaxtostr (0, f_imap->seq++),
1850 mu_umaxtostr (1, msg_imap->num),
1824 MU_IMAP_CACHE_HEADERS); 1851 MU_IMAP_CACHE_HEADERS);
1825 CHECK_ERROR (f_imap, status); 1852 CHECK_ERROR (f_imap, status);
1826 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1853 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 ...@@ -1885,18 +1912,24 @@ imap_header_read (mu_header_t header, char *buffer, size_t buflen, mu_off_t offs
1885 { 1912 {
1886 char *section = section_name (msg_imap); 1913 char *section = section_name (msg_imap);
1887 status = imap_writeline (f_imap, 1914 status = imap_writeline (f_imap,
1888 "g%d FETCH %d BODY.PEEK[%s.MIME]<%d.%d>\r\n", 1915 "g%s FETCH %s BODY.PEEK[%s.MIME]<%s.%s>\r\n",
1889 f_imap->seq++, msg_imap->num, 1916 mu_umaxtostr (0, f_imap->seq++),
1917 mu_umaxtostr (1, msg_imap->num),
1890 (section) ? section : "", 1918 (section) ? section : "",
1891 offset + msg_imap->header_lines, buflen); 1919 mu_umaxtostr (2, offset +
1920 msg_imap->header_lines),
1921 mu_umaxtostr (3, buflen));
1892 if (section) 1922 if (section)
1893 free (section); 1923 free (section);
1894 } 1924 }
1895 else 1925 else
1896 status = imap_writeline (f_imap, 1926 status = imap_writeline (f_imap,
1897 "g%d FETCH %d BODY.PEEK[HEADER]<%d.%d>\r\n", 1927 "g%s FETCH %s BODY.PEEK[HEADER]<%s.%s>\r\n",
1898 f_imap->seq++, msg_imap->num, 1928 mu_umaxtostr (0, f_imap->seq++),
1899 offset + msg_imap->header_lines, buflen); 1929 mu_umaxtostr (1, msg_imap->num),
1930 mu_umaxtostr (2, offset +
1931 msg_imap->header_lines),
1932 mu_umaxtostr (3, buflen));
1900 CHECK_ERROR (f_imap, status); 1933 CHECK_ERROR (f_imap, status);
1901 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 1934 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
1902 f_imap->state = IMAP_FETCH; 1935 f_imap->state = IMAP_FETCH;
...@@ -1994,18 +2027,24 @@ imap_body_read (mu_stream_t stream, char *buffer, size_t buflen, ...@@ -1994,18 +2027,24 @@ imap_body_read (mu_stream_t stream, char *buffer, size_t buflen,
1994 { 2027 {
1995 char *section = section_name (msg_imap); 2028 char *section = section_name (msg_imap);
1996 status = imap_writeline (f_imap, 2029 status = imap_writeline (f_imap,
1997 "g%d FETCH %d BODY.PEEK[%s]<%d.%d>\r\n", 2030 "g%s FETCH %s BODY.PEEK[%s]<%s.%s>\r\n",
1998 f_imap->seq++, msg_imap->num, 2031 mu_umaxtostr (0, f_imap->seq++),
2032 mu_umaxtostr (1, msg_imap->num),
1999 (section) ? section: "", 2033 (section) ? section: "",
2000 offset + msg_imap->body_lines, buflen); 2034 mu_umaxtostr (2, offset +
2035 msg_imap->body_lines),
2036 mu_umaxtostr (3, buflen));
2001 if (section) 2037 if (section)
2002 free (section); 2038 free (section);
2003 } 2039 }
2004 else 2040 else
2005 status = imap_writeline (f_imap, 2041 status = imap_writeline (f_imap,
2006 "g%d FETCH %d BODY.PEEK[TEXT]<%d.%d>\r\n", 2042 "g%s FETCH %s BODY.PEEK[TEXT]<%s.%s>\r\n",
2007 f_imap->seq++, msg_imap->num, 2043 mu_umaxtostr (0, f_imap->seq++),
2008 offset + msg_imap->body_lines, buflen); 2044 mu_umaxtostr (1, msg_imap->num),
2045 mu_umaxtostr (2, offset +
2046 msg_imap->body_lines),
2047 mu_umaxtostr (3, buflen));
2009 CHECK_ERROR (f_imap, status); 2048 CHECK_ERROR (f_imap, status);
2010 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer); 2049 MAILBOX_DEBUG0 (m_imap->mailbox, MU_DEBUG_PROT, f_imap->buffer);
2011 f_imap->state = IMAP_FETCH; 2050 f_imap->state = IMAP_FETCH;
...@@ -2178,7 +2217,7 @@ flags_to_string (char **pbuf, int flag) ...@@ -2178,7 +2217,7 @@ flags_to_string (char **pbuf, int flag)
2178 static int 2217 static int
2179 add_number (char **pset, size_t start, size_t end) 2218 add_number (char **pset, size_t start, size_t end)
2180 { 2219 {
2181 char buf[128]; 2220 char buf[2*UINTMAX_STRSIZE_BOUND+2];
2182 char *set; 2221 char *set;
2183 char *tmp; 2222 char *tmp;
2184 size_t set_len = 0; 2223 size_t set_len = 0;
...@@ -2195,11 +2234,11 @@ add_number (char **pset, size_t start, size_t end) ...@@ -2195,11 +2234,11 @@ add_number (char **pset, size_t start, size_t end)
2195 if (start == 0) 2234 if (start == 0)
2196 *buf = '\0'; 2235 *buf = '\0';
2197 else if (start != end) 2236 else if (start != end)
2198 snprintf (buf, sizeof buf, "%lu:%lu", 2237 snprintf (buf, sizeof buf, "%s:%s",
2199 (unsigned long) start, 2238 mu_umaxtostr (0, start),
2200 (unsigned long) end); 2239 mu_umaxtostr (1, end));
2201 else 2240 else
2202 snprintf (buf, sizeof buf, "%lu", (unsigned long) start); 2241 snprintf (buf, sizeof buf, "%s", mu_umaxtostr (0, start));
2203 2242
2204 if (set_len) 2243 if (set_len)
2205 tmp = realloc (set, set_len + strlen (buf) + 2 /* null and comma */); 2244 tmp = realloc (set, set_len + strlen (buf) + 2 /* null and comma */);
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
51 #include <mailutils/stream.h> 51 #include <mailutils/stream.h>
52 #include <mailutils/mu_auth.h> 52 #include <mailutils/mu_auth.h>
53 #include <mailutils/nls.h> 53 #include <mailutils/nls.h>
54 #include <mu_umaxtostr.h>
54 55
55 #define MESSAGE_MODIFIED 0x10000; 56 #define MESSAGE_MODIFIED 0x10000;
56 57
...@@ -637,7 +638,8 @@ mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pwri ...@@ -637,7 +638,8 @@ mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pwri
637 sprintf (tmp, "%02x", md5digest[n]); 638 sprintf (tmp, "%02x", md5digest[n]);
638 *tmp = '\0'; 639 *tmp = '\0';
639 /* POP3 rfc says that an UID should not be longer than 70. */ 640 /* POP3 rfc says that an UID should not be longer than 70. */
640 snprintf (buf + 32, 70, ".%lu.%u", (unsigned long)time (NULL), uid); 641 snprintf (buf + 32, 70, ".%lu.%s", (unsigned long)time (NULL),
642 mu_umaxtostr (0, uid));
641 643
642 mu_header_set_value (header, "X-UIDL", buf, 1); 644 mu_header_set_value (header, "X-UIDL", buf, 1);
643 buflen--; /* leave space for the NULL. */ 645 buflen--; /* leave space for the NULL. */
......
...@@ -426,11 +426,11 @@ burst (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data) ...@@ -426,11 +426,11 @@ burst (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data)
426 426
427 if (burst_or_copy (msg, 1, 0) == 0) 427 if (burst_or_copy (msg, 1, 0) == 0)
428 { 428 {
429 VERBOSE((ngettext ("%lu message exploded from digest %lu", 429 VERBOSE((ngettext ("%s message exploded from digest %s",
430 "%lu messages exploded from digest %lu", 430 "%s messages exploded from digest %s",
431 map.count), 431 (unsigned long) map.count),
432 (unsigned long) map.count, 432 mu_umaxtostr (0, map.count),
433 (unsigned long) num)); 433 mu_umaxtostr (1, num)));
434 if (inplace) 434 if (inplace)
435 { 435 {
436 obstack_grow (&stk, &map, sizeof map); 436 obstack_grow (&stk, &map, sizeof map);
...@@ -438,7 +438,7 @@ burst (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data) ...@@ -438,7 +438,7 @@ burst (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data)
438 } 438 }
439 } 439 }
440 else if (!quiet) 440 else if (!quiet)
441 mh_error (_("message %lu not in digest format"), (unsigned long) num); 441 mh_error (_("message %s not in digest format"), mu_umaxtostr (0, num));
442 } 442 }
443 443
444 444
...@@ -453,8 +453,8 @@ burst_rename (mh_msgset_t *ms, size_t lastuid) ...@@ -453,8 +453,8 @@ burst_rename (mh_msgset_t *ms, size_t lastuid)
453 j = burst_count - 1; 453 j = burst_count - 1;
454 for (i = ms->count; i > 0; i--) 454 for (i = ms->count; i > 0; i--)
455 { 455 {
456 char *from; 456 const char *from;
457 char *to; 457 const char *to;
458 458
459 if (ms->list[i-1] == burst_map[j].msgno) 459 if (ms->list[i-1] == burst_map[j].msgno)
460 { 460 {
...@@ -466,8 +466,8 @@ burst_rename (mh_msgset_t *ms, size_t lastuid) ...@@ -466,8 +466,8 @@ burst_rename (mh_msgset_t *ms, size_t lastuid)
466 if (ms->list[i-1] == lastuid) 466 if (ms->list[i-1] == lastuid)
467 continue; 467 continue;
468 468
469 asprintf (&from, "%lu", (unsigned long) ms->list[i-1]); 469 from = mu_umaxtostr (0, ms->list[i-1]);
470 asprintf (&to, "%lu", (unsigned long) lastuid); 470 to = mu_umaxtostr (1, lastuid);
471 --lastuid; 471 --lastuid;
472 472
473 VERBOSE((_("message %s becomes message %s"), from, to)); 473 VERBOSE((_("message %s becomes message %s"), from, to));
...@@ -478,8 +478,6 @@ burst_rename (mh_msgset_t *ms, size_t lastuid) ...@@ -478,8 +478,6 @@ burst_rename (mh_msgset_t *ms, size_t lastuid)
478 from, to, mu_strerror (errno)); 478 from, to, mu_strerror (errno));
479 exit (1); 479 exit (1);
480 } 480 }
481 free (from);
482 free (to);
483 } 481 }
484 } 482 }
485 483
...@@ -534,12 +532,10 @@ finalize_inplace (size_t lastuid) ...@@ -534,12 +532,10 @@ finalize_inplace (size_t lastuid)
534 /* FIXME: toc handling */ 532 /* FIXME: toc handling */
535 for (j = 0; j < burst_map[i].count; j++) 533 for (j = 0; j < burst_map[i].count; j++)
536 { 534 {
537 char *to; 535 const char *to = mu_umaxtostr (0, burst_map[i].msgno + 1 + j);
538 536 VERBOSE((_("message %s of digest %s becomes message %s"),
539 asprintf (&to, "%lu", (unsigned long) (burst_map[i].msgno + 1 + j)); 537 mu_umaxtostr (1, j + 1),
540 VERBOSE((_("message %lu of digest %lu becomes message %s"), 538 mu_umaxtostr (2, burst_map[i].msgno), to));
541 (unsigned long) (j+1),
542 (unsigned long) burst_map[i].msgno, to));
543 msg_copy (burst_map[i].first + j, to); 539 msg_copy (burst_map[i].first + j, to);
544 } 540 }
545 } 541 }
...@@ -606,10 +602,9 @@ main (int argc, char **argv) ...@@ -606,10 +602,9 @@ main (int argc, char **argv)
606 mu_mailbox_uidnext (mbox, &next_uid); 602 mu_mailbox_uidnext (mbox, &next_uid);
607 for (i = 0, last_uid = next_uid-1; i < burst_count; i++) 603 for (i = 0, last_uid = next_uid-1; i < burst_count; i++)
608 last_uid += burst_map[i].count; 604 last_uid += burst_map[i].count;
609 VERBOSE ((_("Estimated last UID: %lu"), (unsigned long) last_uid)); 605 VERBOSE ((_("Estimated last UID: %s"), mu_umaxtostr (0, last_uid)));
610 606
611 asprintf (&xargv[0], "%lu-last", 607 asprintf (&xargv[0], "%s-last", mu_umaxtostr (0, burst_map[0].msgno));
612 (unsigned long) burst_map[0].msgno);
613 xargv[1] = NULL; 608 xargv[1] = NULL;
614 mh_msgset_parse (mbox, &ms, 1, xargv, NULL); 609 mh_msgset_parse (mbox, &ms, 1, xargv, NULL);
615 free (xargv[0]); 610 free (xargv[0]);
......
...@@ -91,8 +91,10 @@ check_draft_disposition (struct mh_whatnow_env *wh, int use_draft) ...@@ -91,8 +91,10 @@ check_draft_disposition (struct mh_whatnow_env *wh, int use_draft)
91 disp = DISP_USE; 91 disp = DISP_USE;
92 else 92 else
93 { 93 {
94 printf (_("Draft \"%s\" exists (%lu bytes).\n"), 94 printf (ngettext ("Draft \"%s\" exists (%s byte).\n",
95 wh->draftfile, (unsigned long) st.st_size); 95 "Draft \"%s\" exists (%su bytes).\n",
96 (unsigned long) st.st_size),
97 wh->draftfile, mu_umaxtostr (0, st.st_size));
96 disp = mh_disposition (wh->draftfile); 98 disp = mh_disposition (wh->draftfile);
97 } 99 }
98 } 100 }
......
...@@ -383,7 +383,7 @@ _scan (const char *name, int depth) ...@@ -383,7 +383,7 @@ _scan (const char *name, int depth)
383 383
384 if (info.cur) 384 if (info.cur)
385 { 385 {
386 asprintf (&p, "%s/%lu", name, (unsigned long) info.cur); 386 asprintf (&p, "%s/%s", name, mu_umaxtostr (0, info.cur));
387 if (stat (p, &st) < 0 || !S_ISREG (st.st_mode)) 387 if (stat (p, &st) < 0 || !S_ISREG (st.st_mode))
388 info.cur = 0; 388 info.cur = 0;
389 free (p); 389 free (p);
...@@ -593,12 +593,12 @@ static int ...@@ -593,12 +593,12 @@ static int
593 pack_rename (struct pack_tab *tab, int reverse) 593 pack_rename (struct pack_tab *tab, int reverse)
594 { 594 {
595 int rc; 595 int rc;
596 char s1[64]; 596 const char *s1;
597 char s2[64]; 597 const char *s2;
598 char *from, *to; 598 const char *from, *to;
599 599
600 snprintf (s1, sizeof s1, "%lu", (unsigned long) tab->orig); 600 s1 = mu_umaxtostr (0, tab->orig);
601 snprintf (s2, sizeof s2, "%lu", (unsigned long) tab->new); 601 s2 = mu_umaxtostr (1, tab->new);
602 602
603 if (!reverse) 603 if (!reverse)
604 { 604 {
...@@ -660,10 +660,12 @@ roll_back (const char *folder_name, struct pack_tab *pack_tab, size_t i) ...@@ -660,10 +660,12 @@ roll_back (const char *folder_name, struct pack_tab *pack_tab, size_t i)
660 { 660 {
661 mh_error (_("CRITICAL ERROR: Folder `%s' left in an inconsistent state, because an error\n" 661 mh_error (_("CRITICAL ERROR: Folder `%s' left in an inconsistent state, because an error\n"
662 "occurred while trying to roll back the changes.\n" 662 "occurred while trying to roll back the changes.\n"
663 "Message range %lu-%lu has been renamed to %lu-%lu."), 663 "Message range %s-%s has been renamed to %s-%s."),
664 folder_name, 664 folder_name,
665 pack_tab[0].orig, pack_tab[start].orig, 665 mu_umaxtostr (0, pack_tab[0].orig),
666 pack_tab[0].new, pack_tab[start].new); 666 mu_umaxtostr (1, pack_tab[start].orig),
667 mu_umaxtostr (2, pack_tab[0].new),
668 mu_umaxtostr (3, pack_tab[start].new));
667 mh_error (_("You will have to fix it manually.")); 669 mh_error (_("You will have to fix it manually."));
668 exit (1); 670 exit (1);
669 } 671 }
...@@ -794,10 +796,10 @@ action_pack () ...@@ -794,10 +796,10 @@ action_pack ()
794 mh_message_number (msg, &pack_tab[i].orig); 796 mh_message_number (msg, &pack_tab[i].orig);
795 } 797 }
796 if (verbose) 798 if (verbose)
797 fprintf (stderr, ngettext ("%lu message number collected.\n", 799 fprintf (stderr, ngettext ("%s message number collected.\n",
798 "%lu message numbers collected.\n", 800 "%s message numbers collected.\n",
799 count), 801 (unsigned long) count),
800 (unsigned long) count); 802 mu_umaxtostr (0, count));
801 803
802 mu_mailbox_close (mbox); 804 mu_mailbox_close (mbox);
803 mu_mailbox_destroy (&mbox); 805 mu_mailbox_destroy (&mbox);
......
...@@ -353,7 +353,7 @@ finish_draft () ...@@ -353,7 +353,7 @@ finish_draft ()
353 { 353 {
354 mu_url_t url; 354 mu_url_t url;
355 const char *mbox_path; 355 const char *mbox_path;
356 char buf[64]; 356 char *p;
357 size_t i; 357 size_t i;
358 358
359 mu_mailbox_get_url (mbox, &url); 359 mu_mailbox_get_url (mbox, &url);
...@@ -373,8 +373,8 @@ finish_draft () ...@@ -373,8 +373,8 @@ finish_draft ()
373 if (annotate) 373 if (annotate)
374 mu_list_append (wh_env.anno_list, msg); 374 mu_list_append (wh_env.anno_list, msg);
375 mh_message_number (msg, &num); 375 mh_message_number (msg, &num);
376 snprintf (buf, sizeof buf, " %lu", (unsigned long) num); 376 p = mu_umaxtostr (0, num);
377 rc = mu_stream_sequential_write (stream, buf, strlen (buf)); 377 rc = mu_stream_sequential_write (stream, p, strlen (p));
378 } 378 }
379 } 379 }
380 else 380 else
......
...@@ -183,9 +183,7 @@ mh_global_sequences_iterate (mh_context_iterator fp, void *data) ...@@ -183,9 +183,7 @@ mh_global_sequences_iterate (mh_context_iterator fp, void *data)
183 void 183 void
184 mh_global_save_state () 184 mh_global_save_state ()
185 { 185 {
186 char buf[64]; 186 mh_context_set_value (sequences, "cur", mu_umaxtostr (0, current_message));
187 snprintf (buf, sizeof buf, "%lu", (unsigned long) current_message);
188 mh_context_set_value (sequences, "cur", buf);
189 mh_context_write (sequences); 187 mh_context_write (sequences);
190 188
191 mh_context_set_value (context, "Current-Folder", current_folder); 189 mh_context_set_value (context, "Current-Folder", current_folder);
......
...@@ -154,7 +154,6 @@ msgset_preproc_part (mu_mailbox_t mbox, char *arg, char **rest) ...@@ -154,7 +154,6 @@ msgset_preproc_part (mu_mailbox_t mbox, char *arg, char **rest)
154 { 154 {
155 int rc; 155 int rc;
156 size_t uid, num; 156 size_t uid, num;
157 char *ret = NULL;
158 mu_message_t msg; 157 mu_message_t msg;
159 158
160 if (p->handler (mbox, &num)) 159 if (p->handler (mbox, &num))
...@@ -165,10 +164,9 @@ msgset_preproc_part (mu_mailbox_t mbox, char *arg, char **rest) ...@@ -165,10 +164,9 @@ msgset_preproc_part (mu_mailbox_t mbox, char *arg, char **rest)
165 mh_error (_("Cannot get message %d: %s"), num, mu_strerror (rc)); 164 mh_error (_("Cannot get message %d: %s"), num, mu_strerror (rc));
166 exit (1); 165 exit (1);
167 } 166 }
168 mu_message_get_uid (msg, &uid);
169 asprintf (&ret, "%lu", (unsigned long) uid);
170 *rest = arg + strlen (p->name); 167 *rest = arg + strlen (p->name);
171 return ret; 168 mu_message_get_uid (msg, &uid);
169 return xstrdup (mu_umaxtostr (0, uid));
172 } 170 }
173 cp = strchr (arg, '-'); 171 cp = strchr (arg, '-');
174 if (cp) 172 if (cp)
......
...@@ -68,7 +68,7 @@ mh_seq_add (char *name, mh_msgset_t *mset, int flags) ...@@ -68,7 +68,7 @@ mh_seq_add (char *name, mh_msgset_t *mset, int flags)
68 { 68 {
69 char *value = mh_seq_read (name, flags); 69 char *value = mh_seq_read (name, flags);
70 char *new_value, *p; 70 char *new_value, *p;
71 char buf[64]; 71 const char *buf;
72 size_t i, len; 72 size_t i, len;
73 73
74 delete_sequence (name, !(flags & SEQ_PRIVATE)); 74 delete_sequence (name, !(flags & SEQ_PRIVATE));
...@@ -83,7 +83,7 @@ mh_seq_add (char *name, mh_msgset_t *mset, int flags) ...@@ -83,7 +83,7 @@ mh_seq_add (char *name, mh_msgset_t *mset, int flags)
83 len++; 83 len++;
84 for (i = 0; i < mset->count; i++) 84 for (i = 0; i < mset->count; i++)
85 { 85 {
86 snprintf (buf, sizeof buf, "%lu", (unsigned long) mset->list[i]); 86 buf = mu_umaxtostr (0, mset->list[i]);
87 len += strlen (buf) + 1; 87 len += strlen (buf) + 1;
88 } 88 }
89 89
...@@ -96,7 +96,7 @@ mh_seq_add (char *name, mh_msgset_t *mset, int flags) ...@@ -96,7 +96,7 @@ mh_seq_add (char *name, mh_msgset_t *mset, int flags)
96 *p++ = ' '; 96 *p++ = ' ';
97 for (i = 0; i < mset->count; i++) 97 for (i = 0; i < mset->count; i++)
98 { 98 {
99 p += sprintf (p, "%lu", (unsigned long) mset->list[i]); 99 p += sprintf (p, "%s", mu_umaxtostr (0, mset->list[i]));
100 *p++ = ' '; 100 *p++ = ' ';
101 } 101 }
102 *p = 0; 102 *p = 0;
......
...@@ -480,7 +480,7 @@ msg_part_print (msg_part_t p, int max_width) ...@@ -480,7 +480,7 @@ msg_part_print (msg_part_t p, int max_width)
480 printf ("."); 480 printf (".");
481 width++; 481 width++;
482 } 482 }
483 width += printf ("%lu", (unsigned long) p->part[i]); 483 width += printf ("%s", mu_umaxtostr (0, p->part[i]));
484 } 484 }
485 for (; width < max_width; width++) 485 for (; width < max_width; width++)
486 putchar (' '); 486 putchar (' ');
...@@ -492,13 +492,12 @@ msg_part_format (msg_part_t p) ...@@ -492,13 +492,12 @@ msg_part_format (msg_part_t p)
492 int i; 492 int i;
493 int width = 0; 493 int width = 0;
494 char *str, *s; 494 char *str, *s;
495 char buf[64];
496 495
497 for (i = 1; i <= p->level; i++) 496 for (i = 1; i <= p->level; i++)
498 { 497 {
499 if (i > 1) 498 if (i > 1)
500 width++; 499 width++;
501 width += snprintf (buf, sizeof buf, "%lu", (unsigned long) p->part[i]); 500 width += strlen (mu_umaxtostr (0, p->part[i]));
502 } 501 }
503 502
504 str = s = xmalloc (width + 1); 503 str = s = xmalloc (width + 1);
...@@ -506,7 +505,7 @@ msg_part_format (msg_part_t p) ...@@ -506,7 +505,7 @@ msg_part_format (msg_part_t p)
506 { 505 {
507 if (i > 1) 506 if (i > 1)
508 *s++ = '.'; 507 *s++ = '.';
509 s += sprintf (s, "%lu", (unsigned long) p->part[i]); 508 s += sprintf (s, "%s", mu_umaxtostr (0, p->part[i]));
510 } 509 }
511 *s = 0; 510 *s = 0;
512 return str; 511 return str;
...@@ -516,16 +515,17 @@ void ...@@ -516,16 +515,17 @@ void
516 msg_part_format_stk (struct obstack *stk, msg_part_t p) 515 msg_part_format_stk (struct obstack *stk, msg_part_t p)
517 { 516 {
518 int i; 517 int i;
519 char buf[64];
520 518
521 for (i = 1; i <= p->level; i++) 519 for (i = 1; i <= p->level; i++)
522 { 520 {
523 int len; 521 int len;
522 char *buf;
524 523
525 if (i > 1) 524 if (i > 1)
526 obstack_1grow (stk, '.'); 525 obstack_1grow (stk, '.');
527 526
528 len = snprintf (buf, sizeof buf, "%lu", (unsigned long) p->part[i]); 527 buf = mu_umaxtostr (0, p->part[i]);
528 len = strlen (buf);
529 obstack_grow (stk, buf, len); 529 obstack_grow (stk, buf, len);
530 } 530 }
531 } 531 }
...@@ -793,7 +793,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, char *name) ...@@ -793,7 +793,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, char *name)
793 char *typestr, *type, *subtype, *typeargs; 793 char *typestr, *type, *subtype, *typeargs;
794 struct obstack stk; 794 struct obstack stk;
795 mu_header_t hdr; 795 mu_header_t hdr;
796 char buf[64]; 796 char *buf;
797 797
798 mu_message_get_header (msg, &hdr); 798 mu_message_get_header (msg, &hdr);
799 _get_content_type (hdr, &typestr, &typeargs); 799 _get_content_type (hdr, &typestr, &typeargs);
...@@ -823,8 +823,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, char *name) ...@@ -823,8 +823,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, char *name)
823 obstack_grow (&stk, name, strlen (name)); 823 obstack_grow (&stk, name, strlen (name));
824 else 824 else
825 { 825 {
826 snprintf (buf, sizeof buf, "%lu", 826 buf = mu_umaxtostr (0, msg_part_subpart (part, 0));
827 (unsigned long) msg_part_subpart (part, 0));
828 obstack_grow (&stk, buf, strlen (buf)); 827 obstack_grow (&stk, buf, strlen (buf));
829 } 828 }
830 break; 829 break;
...@@ -846,7 +845,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, char *name) ...@@ -846,7 +845,7 @@ mhn_store_command (mu_message_t msg, msg_part_t part, char *name)
846 case 'd': 845 case 'd':
847 /* content description */ 846 /* content description */
848 if (mu_header_aget_value (hdr, MU_HEADER_CONTENT_DESCRIPTION, 847 if (mu_header_aget_value (hdr, MU_HEADER_CONTENT_DESCRIPTION,
849 &tmp) == 0) 848 &tmp) == 0)
850 { 849 {
851 obstack_grow (&stk, tmp, strlen (tmp)); 850 obstack_grow (&stk, tmp, strlen (tmp));
852 free (tmp); 851 free (tmp);
...@@ -1252,8 +1251,8 @@ show_internal (mu_message_t msg, msg_part_t part, char *encoding, mu_stream_t ou ...@@ -1252,8 +1251,8 @@ show_internal (mu_message_t msg, msg_part_t part, char *encoding, mu_stream_t ou
1252 1251
1253 if ((rc = mu_message_get_body (msg, &body))) 1252 if ((rc = mu_message_get_body (msg, &body)))
1254 { 1253 {
1255 mh_error (_("%lu: cannot get message body: %s"), 1254 mh_error (_("%s: cannot get message body: %s"),
1256 (unsigned long) msg_part_subpart (part, 0), 1255 mu_umaxtostr (0, msg_part_subpart (part, 0)),
1257 mu_strerror (rc)); 1256 mu_strerror (rc));
1258 return 0; 1257 return 0;
1259 } 1258 }
...@@ -1363,7 +1362,6 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding, ...@@ -1363,7 +1362,6 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
1363 mu_stream_t out = data; 1362 mu_stream_t out = data;
1364 char *cmd; 1363 char *cmd;
1365 int flags = 0; 1364 int flags = 0;
1366 char buf[64];
1367 int fd = 1; 1365 int fd = 1;
1368 char *tempfile = NULL; 1366 char *tempfile = NULL;
1369 int ismime; 1367 int ismime;
...@@ -1383,6 +1381,7 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding, ...@@ -1383,6 +1381,7 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
1383 if (flags & MHN_LISTING) 1381 if (flags & MHN_LISTING)
1384 { 1382 {
1385 char *str; 1383 char *str;
1384 char *p;
1386 size_t size = 0; 1385 size_t size = 0;
1387 1386
1388 str = _("part "); 1387 str = _("part ");
...@@ -1393,8 +1392,8 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding, ...@@ -1393,8 +1392,8 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
1393 mu_stream_sequential_write (out, " ", 1); 1392 mu_stream_sequential_write (out, " ", 1);
1394 mu_stream_sequential_write (out, type, strlen (type)); 1393 mu_stream_sequential_write (out, type, strlen (type));
1395 mhn_message_size (msg, &size); 1394 mhn_message_size (msg, &size);
1396 snprintf (buf, sizeof buf, " %lu", (unsigned long) size); 1395 p = mu_umaxtostr (0, size);
1397 mu_stream_sequential_write (out, buf, strlen (buf)); 1396 mu_stream_sequential_write (out, p, strlen (p));
1398 mu_stream_sequential_write (out, "\n", 1); 1397 mu_stream_sequential_write (out, "\n", 1);
1399 mu_stream_flush (out); 1398 mu_stream_flush (out);
1400 } 1399 }
...@@ -1403,6 +1402,7 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding, ...@@ -1403,6 +1402,7 @@ show_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
1403 { 1402 {
1404 if (isatty (fd) && isatty (0)) 1403 if (isatty (fd) && isatty (0))
1405 { 1404 {
1405 char buf[64];
1406 printf (_("Press <return> to show content...")); 1406 printf (_("Press <return> to show content..."));
1407 if (!fgets (buf, sizeof buf, stdin) || buf[0] != '\n') 1407 if (!fgets (buf, sizeof buf, stdin) || buf[0] != '\n')
1408 return 0; 1408 return 0;
...@@ -1652,8 +1652,8 @@ store_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding, ...@@ -1652,8 +1652,8 @@ store_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
1652 tmp, 1652 tmp,
1653 name); 1653 name);
1654 else 1654 else
1655 printf (_("storing message %lu part %s as file %s\n"), 1655 printf (_("storing message %s part %s as file %s\n"),
1656 (unsigned long) msg_part_subpart (part, 0), 1656 mu_umaxtostr (0, msg_part_subpart (part, 0)),
1657 tmp, 1657 tmp,
1658 name); 1658 name);
1659 free (tmp); 1659 free (tmp);
......
...@@ -66,7 +66,7 @@ mhpath (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data) ...@@ -66,7 +66,7 @@ mhpath (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data)
66 size_t uid; 66 size_t uid;
67 67
68 mh_message_number (msg, &uid); 68 mh_message_number (msg, &uid);
69 printf ("%s/%lu\n", (char*) data, (unsigned long) uid); 69 printf ("%s/%s\n", (char*) data, mu_umaxtostr (0, uid));
70 } 70 }
71 71
72 int 72 int
...@@ -126,7 +126,7 @@ main (int argc, char **argv) ...@@ -126,7 +126,7 @@ main (int argc, char **argv)
126 126
127 mu_mailbox_get_message (mbox, total, &msg); 127 mu_mailbox_get_message (mbox, total, &msg);
128 mh_message_number (msg, &num); 128 mh_message_number (msg, &num);
129 printf ("%s/%lu\n", mhdir, (unsigned long)(num + 1)); 129 printf ("%s/%s\n", mhdir, mu_umaxtostr (0, num + 1));
130 exit (0); 130 exit (0);
131 } 131 }
132 132
......
...@@ -305,7 +305,7 @@ pick_message (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data) ...@@ -305,7 +305,7 @@ pick_message (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data)
305 { 305 {
306 mh_message_number (msg, &num); 306 mh_message_number (msg, &num);
307 if (list) 307 if (list)
308 printf ("%lu\n", (unsigned long) num); 308 printf ("%s\n", mu_umaxtostr (0, num));
309 if (seq_list) 309 if (seq_list)
310 { 310 {
311 obstack_grow (&msgno_stk, &num, sizeof (num)); 311 obstack_grow (&msgno_stk, &num, sizeof (num));
......
...@@ -277,10 +277,10 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh) ...@@ -277,10 +277,10 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
277 disp = DISP_USE; 277 disp = DISP_USE;
278 else 278 else
279 { 279 {
280 printf (ngettext ("Draft \"%s\" exists (%lu byte).\n", 280 printf (ngettext ("Draft \"%s\" exists (%s byte).\n",
281 "Draft \"%s\" exists (%lu bytes).\n", 281 "Draft \"%s\" exists (%s bytes).\n",
282 st.st_size), 282 (unsigned long) st.st_size),
283 wh->draftfile, (unsigned long) st.st_size); 283 wh->draftfile, mu_umaxtostr (0, st.st_size));
284 disp = mh_disposition (wh->draftfile); 284 disp = mh_disposition (wh->draftfile);
285 } 285 }
286 } 286 }
...@@ -304,8 +304,8 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh) ...@@ -304,8 +304,8 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
304 rc = mu_mailbox_get_message (mbox, msgset.list[0], &msg); 304 rc = mu_mailbox_get_message (mbox, msgset.list[0], &msg);
305 if (rc) 305 if (rc)
306 { 306 {
307 mh_error (_("Cannot read message %lu: %s"), 307 mh_error (_("Cannot read message %s: %s"),
308 (unsigned long) msgset.list[0], 308 mu_umaxtostr (0, msgset.list[0]),
309 mu_strerror (rc)); 309 mu_strerror (rc));
310 exit (1); 310 exit (1);
311 } 311 }
...@@ -360,7 +360,7 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh) ...@@ -360,7 +360,7 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
360 360
361 mu_mailbox_get_url (mbox, &url); 361 mu_mailbox_get_url (mbox, &url);
362 mh_message_number (msg, &num); 362 mh_message_number (msg, &num);
363 asprintf (&msgname, "%s/%lu", mu_url_to_string (url), (unsigned long) num); 363 asprintf (&msgname, "%s/%s", mu_url_to_string (url), mu_umaxtostr (0, num));
364 p = strchr (msgname, ':'); 364 p = strchr (msgname, ':');
365 if (!p) 365 if (!p)
366 wh->msg = msgname; 366 wh->msg = msgname;
......
...@@ -377,9 +377,9 @@ comp0 (size_t na, size_t nb) ...@@ -377,9 +377,9 @@ comp0 (size_t na, size_t nb)
377 return 0; 377 return 0;
378 if (verbose > 1) 378 if (verbose > 1)
379 fprintf (stderr, 379 fprintf (stderr,
380 _("comparing messages %lu and %lu: "), 380 _("comparing messages %s and %s: "),
381 (unsigned long) na, 381 mu_umaxtostr (0, na),
382 (unsigned long) nb); 382 mu_umaxtostr (1, nb));
383 return compare_messages (a, b); 383 return compare_messages (a, b);
384 } 384 }
385 385
...@@ -445,8 +445,8 @@ swap_message (size_t a, size_t b) ...@@ -445,8 +445,8 @@ swap_message (size_t a, size_t b)
445 char *path_a, *path_b; 445 char *path_a, *path_b;
446 char *tmp; 446 char *tmp;
447 447
448 asprintf (&path_a, "%s/%lu", mbox_path, (unsigned long) a); 448 asprintf (&path_a, "%s/%s", mbox_path, mu_umaxtostr (0, a));
449 asprintf (&path_b, "%s/%lu", mbox_path, (unsigned long) b); 449 asprintf (&path_b, "%s/%s", mbox_path, mu_umaxtostr (1, b));
450 tmp = mu_tempname (mbox_path); 450 tmp = mu_tempname (mbox_path);
451 rename (path_a, tmp); 451 rename (path_a, tmp);
452 unlink (path_a); 452 unlink (path_a);
...@@ -526,9 +526,9 @@ sort () ...@@ -526,9 +526,9 @@ sort ()
526 mh_message_number (msg, &new_num); 526 mh_message_number (msg, &new_num);
527 transpose (i, oldlist[i]); 527 transpose (i, oldlist[i]);
528 if (verbose) 528 if (verbose)
529 fprintf (stderr, "{%lu, %lu}\n", 529 fprintf (stderr, "{%s, %s}\n",
530 (unsigned long) old_num, 530 mu_umaxtostr (0, old_num),
531 (unsigned long) new_num); 531 mu_umaxtostr (1, new_num));
532 if (action == ACTION_REORDER) 532 if (action == ACTION_REORDER)
533 swap_message (old_num, new_num); 533 swap_message (old_num, new_num);
534 } 534 }
......
...@@ -211,8 +211,8 @@ pop3d_apop (const char *arg) ...@@ -211,8 +211,8 @@ pop3d_apop (const char *arg)
211 /* Reset the uid. */ 211 /* Reset the uid. */
212 if (auth->change_uid && setuid (auth->uid) == -1) 212 if (auth->change_uid && setuid (auth->uid) == -1)
213 { 213 {
214 syslog (LOG_INFO, _("Cannot change to uid %lu: %m"), 214 syslog (LOG_INFO, _("Cannot change to uid %s: %m"),
215 (unsigned long) auth->uid); 215 mu_umaxtostr (0, auth->uid));
216 mu_auth_data_free (auth); 216 mu_auth_data_free (auth);
217 return ERR_BAD_LOGIN; 217 return ERR_BAD_LOGIN;
218 } 218 }
......
...@@ -53,7 +53,7 @@ pop3d_capa (const char *arg) ...@@ -53,7 +53,7 @@ pop3d_capa (const char *arg)
53 if (expire < 0) 53 if (expire < 0)
54 pop3d_outf ("EXPIRE NEVER\r\n"); 54 pop3d_outf ("EXPIRE NEVER\r\n");
55 else 55 else
56 pop3d_outf ("EXPIRE %d\r\n", expire); 56 pop3d_outf ("EXPIRE %s\r\n", mu_umaxtostr (0, expire));
57 57
58 if (state == INITIAL) 58 if (state == INITIAL)
59 pop3d_outf ("XTLSREQUIRED\r\n"); 59 pop3d_outf ("XTLSREQUIRED\r\n");
......
...@@ -40,6 +40,6 @@ pop3d_dele (const char *arg) ...@@ -40,6 +40,6 @@ pop3d_dele (const char *arg)
40 40
41 mu_message_get_attribute (msg, &attr); 41 mu_message_get_attribute (msg, &attr);
42 pop3d_mark_deleted (attr); 42 pop3d_mark_deleted (attr);
43 pop3d_outf ("+OK Message %d marked\r\n", num); 43 pop3d_outf ("+OK Message %s marked\r\n", mu_umaxtostr (0, num));
44 return OK; 44 return OK;
45 } 45 }
......
...@@ -48,7 +48,9 @@ pop3d_list (const char *arg) ...@@ -48,7 +48,9 @@ pop3d_list (const char *arg)
48 { 48 {
49 mu_message_size (msg, &size); 49 mu_message_size (msg, &size);
50 mu_message_lines (msg, &lines); 50 mu_message_lines (msg, &lines);
51 pop3d_outf ("%d %d\r\n", mesgno, size + lines); 51 pop3d_outf ("%s %s\r\n",
52 mu_umaxtostr (0, mesgno),
53 mu_umaxtostr (1, size + lines));
52 } 54 }
53 } 55 }
54 pop3d_outf (".\r\n"); 56 pop3d_outf (".\r\n");
...@@ -63,7 +65,9 @@ pop3d_list (const char *arg) ...@@ -63,7 +65,9 @@ pop3d_list (const char *arg)
63 return ERR_MESG_DELE; 65 return ERR_MESG_DELE;
64 mu_message_size (msg, &size); 66 mu_message_size (msg, &size);
65 mu_message_lines (msg, &lines); 67 mu_message_lines (msg, &lines);
66 pop3d_outf ("+OK %d %d\r\n", mesgno, size + lines); 68 pop3d_outf ("+OK %s %s\r\n",
69 mu_umaxtostr (0, mesgno),
70 mu_umaxtostr (1, size + lines));
67 } 71 }
68 72
69 return OK; 73 return OK;
......
...@@ -123,7 +123,7 @@ login_delay_capa () ...@@ -123,7 +123,7 @@ login_delay_capa ()
123 123
124 if (login_delay && open_stat_db (&db, MU_STREAM_RDWR) == 0) 124 if (login_delay && open_stat_db (&db, MU_STREAM_RDWR) == 0)
125 { 125 {
126 pop3d_outf ("LOGIN-DELAY %lu\r\n", (unsigned long)login_delay); 126 pop3d_outf ("LOGIN-DELAY %s\r\n", mu_umaxtostr (0, login_delay));
127 mu_dbm_close (db); 127 mu_dbm_close (db);
128 } 128 }
129 } 129 }
......
...@@ -528,8 +528,8 @@ pop3d_daemon (unsigned int maxchildren, unsigned int port) ...@@ -528,8 +528,8 @@ pop3d_daemon (unsigned int maxchildren, unsigned int port)
528 process_cleanup (); 528 process_cleanup ();
529 if (children > maxchildren) 529 if (children > maxchildren)
530 { 530 {
531 syslog (LOG_ERR, _("too many children (%lu)"), 531 syslog (LOG_ERR, _("too many children (%s)"),
532 (unsigned long) children); 532 mu_umaxtostr (0, children));
533 pause (); 533 pause ();
534 continue; 534 continue;
535 } 535 }
......
...@@ -56,7 +56,7 @@ pop3d_stat (const char *arg) ...@@ -56,7 +56,7 @@ pop3d_stat (const char *arg)
56 num++; 56 num++;
57 } 57 }
58 } 58 }
59 pop3d_outf ("+OK %d %d\r\n", num, tsize); 59 pop3d_outf ("+OK %s %s\r\n", mu_umaxtostr (0, num), mu_umaxtostr (1, tsize));
60 60
61 return OK; 61 return OK;
62 } 62 }
......
...@@ -44,7 +44,7 @@ pop3d_uidl (const char *arg) ...@@ -44,7 +44,7 @@ pop3d_uidl (const char *arg)
44 if (!pop3d_is_deleted (attr)) 44 if (!pop3d_is_deleted (attr))
45 { 45 {
46 mu_message_get_uidl (msg, uidl, sizeof (uidl), NULL); 46 mu_message_get_uidl (msg, uidl, sizeof (uidl), NULL);
47 pop3d_outf ("%d %s\r\n", mesgno, uidl); 47 pop3d_outf ("%s %s\r\n", mu_umaxtostr (0, mesgno), uidl);
48 } 48 }
49 } 49 }
50 pop3d_outf (".\r\n"); 50 pop3d_outf (".\r\n");
...@@ -58,7 +58,7 @@ pop3d_uidl (const char *arg) ...@@ -58,7 +58,7 @@ pop3d_uidl (const char *arg)
58 if (pop3d_is_deleted (attr)) 58 if (pop3d_is_deleted (attr))
59 return ERR_MESG_DELE; 59 return ERR_MESG_DELE;
60 mu_message_get_uidl (msg, uidl, sizeof (uidl), NULL); 60 mu_message_get_uidl (msg, uidl, sizeof (uidl), NULL);
61 pop3d_outf ("+OK %d %s\r\n", mesgno, uidl); 61 pop3d_outf ("+OK %s %s\r\n", mu_umaxtostr (0, mesgno), uidl);
62 } 62 }
63 63
64 return OK; 64 return OK;
......
...@@ -166,10 +166,10 @@ pop3d_user (const char *arg) ...@@ -166,10 +166,10 @@ pop3d_user (const char *arg)
166 mu_mailbox_get_url (mbox, &url); 166 mu_mailbox_get_url (mbox, &url);
167 mu_mailbox_messages_count (mbox, &total); 167 mu_mailbox_messages_count (mbox, &total);
168 syslog (LOG_INFO, 168 syslog (LOG_INFO,
169 ngettext ("User `%s' logged in with mailbox `%s' (%d message)", 169 ngettext ("User `%s' logged in with mailbox `%s' (%s message)",
170 "User `%s' logged in with mailbox `%s' (%d messages)", 170 "User `%s' logged in with mailbox `%s' (%s messages)",
171 total), 171 (unsigned long) total),
172 username, mu_url_to_string (url), total); 172 username, mu_url_to_string (url), mu_umaxtostr (0, total));
173 } 173 }
174 return OK; 174 return OK;
175 } 175 }
......