Commit df07ce7d df07ce7dc7115193dac0b1f15a1dfa1d338e540d by Sergey Poznyakoff

mail: use mu_strout; remove util_error in favor of mu_error.

1 parent a52aac19
...@@ -36,9 +36,9 @@ alias_free (void *data) ...@@ -36,9 +36,9 @@ alias_free (void *data)
36 static void 36 static void
37 alias_print_group (const char *name, alias_t al) 37 alias_print_group (const char *name, alias_t al)
38 { 38 {
39 mu_stream_printf (ostream, "%s ", name); 39 mu_printf ("%s ", name);
40 util_slist_print (al->list, 0); 40 util_slist_print (al->list, 0);
41 mu_stream_printf (ostream, "\n"); 41 mu_printf ("\n");
42 } 42 }
43 43
44 static alias_t 44 static alias_t
...@@ -75,7 +75,7 @@ alias_print (char *name) ...@@ -75,7 +75,7 @@ alias_print (char *name)
75 al = alias_lookup (name); 75 al = alias_lookup (name);
76 if (!al) 76 if (!al)
77 { 77 {
78 util_error (_("\"%s\": not a group"), name); 78 mu_error (_("\"%s\": not a group"), name);
79 return; 79 return;
80 } 80 }
81 alias_print_group (name, al); 81 alias_print_group (name, al);
......
...@@ -34,7 +34,7 @@ mail_alt (int argc, char **argv) ...@@ -34,7 +34,7 @@ mail_alt (int argc, char **argv)
34 if (alternate_names) 34 if (alternate_names)
35 { 35 {
36 util_slist_print (alternate_names, 0); 36 util_slist_print (alternate_names, 0);
37 mu_stream_printf (ostream, "\n"); 37 mu_printf ("\n");
38 } 38 }
39 } 39 }
40 else 40 else
...@@ -60,7 +60,7 @@ mail_set_my_name (char *name) ...@@ -60,7 +60,7 @@ mail_set_my_name (char *name)
60 struct passwd *pw = getpwuid (getuid ()); 60 struct passwd *pw = getpwuid (getuid ());
61 if (!pw) 61 if (!pw)
62 { 62 {
63 util_error (_("Cannot determine my username")); 63 mu_error (_("Cannot determine my username"));
64 exit (1); 64 exit (1);
65 } 65 }
66 name = pw->pw_name; 66 name = pw->pw_name;
...@@ -69,7 +69,7 @@ mail_set_my_name (char *name) ...@@ -69,7 +69,7 @@ mail_set_my_name (char *name)
69 my_email = mu_get_user_email (name); 69 my_email = mu_get_user_email (name);
70 if (!my_email) 70 if (!my_email)
71 { 71 {
72 util_error(_("Cannot determine my email address: %s"), 72 mu_error(_("Cannot determine my email address: %s"),
73 mu_strerror (errno)); 73 mu_strerror (errno));
74 exit (1); 74 exit (1);
75 } 75 }
......
...@@ -64,7 +64,7 @@ mail_copy0 (int argc, char **argv, int mark) ...@@ -64,7 +64,7 @@ mail_copy0 (int argc, char **argv, int mark)
64 64
65 if ((status = mu_mailbox_create_default (&mbx, filename)) != 0) 65 if ((status = mu_mailbox_create_default (&mbx, filename)) != 0)
66 { 66 {
67 util_error (_("Cannot create mailbox %s: %s"), filename, 67 mu_error (_("Cannot create mailbox %s: %s"), filename,
68 mu_strerror (status)); 68 mu_strerror (status));
69 free (filename); 69 free (filename);
70 msgset_free (msglist); 70 msgset_free (msglist);
...@@ -72,7 +72,7 @@ mail_copy0 (int argc, char **argv, int mark) ...@@ -72,7 +72,7 @@ mail_copy0 (int argc, char **argv, int mark)
72 } 72 }
73 if ((status = mu_mailbox_open (mbx, MU_STREAM_WRITE | MU_STREAM_CREAT)) != 0) 73 if ((status = mu_mailbox_open (mbx, MU_STREAM_WRITE | MU_STREAM_CREAT)) != 0)
74 { 74 {
75 util_error (_("Cannot open mailbox %s: %s"), filename, 75 mu_error (_("Cannot open mailbox %s: %s"), filename,
76 mu_strerror (status)); 76 mu_strerror (status));
77 free (filename); 77 free (filename);
78 msgset_free (msglist); 78 msgset_free (msglist);
...@@ -88,7 +88,7 @@ mail_copy0 (int argc, char **argv, int mark) ...@@ -88,7 +88,7 @@ mail_copy0 (int argc, char **argv, int mark)
88 status = mu_mailbox_append_message (mbx, msg); 88 status = mu_mailbox_append_message (mbx, msg);
89 if (status) 89 if (status)
90 { 90 {
91 util_error (_("Cannot append message: %s"), mu_strerror (status)); 91 mu_error (_("Cannot append message: %s"), mu_strerror (status));
92 break; 92 break;
93 } 93 }
94 94
...@@ -106,7 +106,7 @@ mail_copy0 (int argc, char **argv, int mark) ...@@ -106,7 +106,7 @@ mail_copy0 (int argc, char **argv, int mark)
106 } 106 }
107 107
108 if (status == 0) 108 if (status == 0)
109 mu_stream_printf (ostream, "\"%s\" %3lu/%-5lu\n", filename, 109 mu_printf ("\"%s\" %3lu/%-5lu\n", filename,
110 (unsigned long) total_lines, (unsigned long) total_size); 110 (unsigned long) total_lines, (unsigned long) total_size);
111 111
112 mu_mailbox_close (mbx); 112 mu_mailbox_close (mbx);
......
...@@ -275,7 +275,7 @@ display_submessage (struct mime_descend_closure *closure, void *data) ...@@ -275,7 +275,7 @@ display_submessage (struct mime_descend_closure *closure, void *data)
275 else 275 else
276 stream = b_stream; 276 stream = b_stream;
277 277
278 display_part_header (ostream, 278 display_part_header (mu_strout,
279 closure->msgset, 279 closure->msgset,
280 closure->type, closure->encoding); 280 closure->type, closure->encoding);
281 281
...@@ -328,7 +328,7 @@ print_stream (mu_stream_t stream, mu_stream_t out) ...@@ -328,7 +328,7 @@ print_stream (mu_stream_t stream, mu_stream_t out)
328 { 328 {
329 if (ml_got_interrupt()) 329 if (ml_got_interrupt())
330 { 330 {
331 util_error(_("\nInterrupt")); 331 mu_error(_("\nInterrupt"));
332 break; 332 break;
333 } 333 }
334 buffer[n] = '\0'; 334 buffer[n] = '\0';
...@@ -368,12 +368,12 @@ run_metamail (const char *mailcap_cmd, mu_message_t mesg) ...@@ -368,12 +368,12 @@ run_metamail (const char *mailcap_cmd, mu_message_t mesg)
368 sigemptyset (&ignore.sa_mask); 368 sigemptyset (&ignore.sa_mask);
369 if (sigaction (SIGINT, &ignore, &saveintr) < 0) 369 if (sigaction (SIGINT, &ignore, &saveintr) < 0)
370 { 370 {
371 util_error ("sigaction: %s", strerror (errno)); 371 mu_error ("sigaction: %s", strerror (errno));
372 return; 372 return;
373 } 373 }
374 if (sigaction (SIGQUIT, &ignore, &savequit) < 0) 374 if (sigaction (SIGQUIT, &ignore, &savequit) < 0)
375 { 375 {
376 util_error ("sigaction: %s", strerror (errno)); 376 mu_error ("sigaction: %s", strerror (errno));
377 sigaction (SIGINT, &saveintr, NULL); 377 sigaction (SIGINT, &saveintr, NULL);
378 return; 378 return;
379 } 379 }
...@@ -391,7 +391,7 @@ run_metamail (const char *mailcap_cmd, mu_message_t mesg) ...@@ -391,7 +391,7 @@ run_metamail (const char *mailcap_cmd, mu_message_t mesg)
391 pid = fork (); 391 pid = fork ();
392 if (pid < 0) 392 if (pid < 0)
393 { 393 {
394 util_error ("fork: %s", strerror (errno)); 394 mu_error ("fork: %s", strerror (errno));
395 } 395 }
396 else if (pid == 0) 396 else if (pid == 0)
397 { 397 {
......
...@@ -50,7 +50,7 @@ echo (char *s) ...@@ -50,7 +50,7 @@ echo (char *s)
50 } 50 }
51 else 51 else
52 { 52 {
53 mu_stream_printf (ostream, "%s", ws.ws_wordv[0]); 53 mu_printf ("%s", ws.ws_wordv[0]);
54 mu_wordsplit_free (&ws); 54 mu_wordsplit_free (&ws);
55 } 55 }
56 return rc; 56 return rc;
...@@ -66,9 +66,9 @@ mail_echo (int argc, char **argv) ...@@ -66,9 +66,9 @@ mail_echo (int argc, char **argv)
66 for (i = 1; i < argc; i++) 66 for (i = 1; i < argc; i++)
67 { 67 {
68 if (echo (argv[i])) 68 if (echo (argv[i]))
69 mu_stream_printf (ostream, " "); 69 mu_printf (" ");
70 } 70 }
71 mu_stream_printf (ostream, "\n"); 71 mu_printf ("\n");
72 } 72 }
73 return 0; 73 return 0;
74 } 74 }
......
...@@ -38,8 +38,8 @@ print_envelope (msgset_t *mspec, mu_message_t msg, void *data) ...@@ -38,8 +38,8 @@ print_envelope (msgset_t *mspec, mu_message_t msg, void *data)
38 mu_envelope_sget_sender (env, &sender); 38 mu_envelope_sget_sender (env, &sender);
39 mu_envelope_sget_date (env, &date); 39 mu_envelope_sget_date (env, &date);
40 if (data) 40 if (data)
41 mu_stream_printf (ostream, "%s ", (char*) data); 41 mu_printf ("%s ", (char*) data);
42 mu_stream_printf (ostream, "%s %s", sender, date); 42 mu_printf ("%s %s", sender, date);
43 } 43 }
44 return 0; 44 return 0;
45 } 45 }
......
...@@ -32,9 +32,9 @@ mail_eq (int argc, char **argv) ...@@ -32,9 +32,9 @@ mail_eq (int argc, char **argv)
32 case 1: 32 case 1:
33 n = get_cursor (); 33 n = get_cursor ();
34 if (n == 0) 34 if (n == 0)
35 util_error (_("No applicable message")); 35 mu_error (_("No applicable message"));
36 else 36 else
37 mu_stream_printf (ostream, "%lu\n", (unsigned long) n); 37 mu_printf ("%lu\n", (unsigned long) n);
38 break; 38 break;
39 39
40 case 2: 40 case 2:
...@@ -43,7 +43,7 @@ mail_eq (int argc, char **argv) ...@@ -43,7 +43,7 @@ mail_eq (int argc, char **argv)
43 if (list->msg_part[0] <= total) 43 if (list->msg_part[0] <= total)
44 { 44 {
45 set_cursor (list->msg_part[0]); 45 set_cursor (list->msg_part[0]);
46 mu_stream_printf (ostream, "%lu\n", 46 mu_printf ("%lu\n",
47 (unsigned long) list->msg_part[0]); 47 (unsigned long) list->msg_part[0]);
48 } 48 }
49 else 49 else
......
...@@ -29,7 +29,7 @@ dump_headers (mu_stream_t out, compose_env_t *env) ...@@ -29,7 +29,7 @@ dump_headers (mu_stream_t out, compose_env_t *env)
29 rc = mu_header_get_streamref (env->header, &stream); 29 rc = mu_header_get_streamref (env->header, &stream);
30 if (rc) 30 if (rc)
31 { 31 {
32 util_error ("mu_header_get_streamref: %s", 32 mu_error ("mu_header_get_streamref: %s",
33 mu_stream_strerror (stream, rc)); 33 mu_stream_strerror (stream, rc));
34 return; 34 return;
35 } 35 }
...@@ -55,7 +55,7 @@ parse_headers (mu_stream_t input, compose_env_t *env) ...@@ -55,7 +55,7 @@ parse_headers (mu_stream_t input, compose_env_t *env)
55 55
56 if ((status = mu_header_create (&header, NULL, 0)) != 0) 56 if ((status = mu_header_create (&header, NULL, 0)) != 0)
57 { 57 {
58 util_error (_("Cannot create header: %s"), mu_strerror (status)); 58 mu_error (_("Cannot create header: %s"), mu_strerror (status));
59 return 1; 59 return 1;
60 } 60 }
61 61
...@@ -91,7 +91,7 @@ parse_headers (mu_stream_t input, compose_env_t *env) ...@@ -91,7 +91,7 @@ parse_headers (mu_stream_t input, compose_env_t *env)
91 } 91 }
92 else 92 else
93 { 93 {
94 util_error (_("%d: not a header line"), line); 94 mu_error (_("%d: not a header line"), line);
95 errcnt++; 95 errcnt++;
96 } 96 }
97 } 97 }
...@@ -117,7 +117,7 @@ parse_headers (mu_stream_t input, compose_env_t *env) ...@@ -117,7 +117,7 @@ parse_headers (mu_stream_t input, compose_env_t *env)
117 } 117 }
118 else 118 else
119 { 119 {
120 util_error (_("%d: not a header line"), line); 120 mu_error (_("%d: not a header line"), line);
121 errcnt++; 121 errcnt++;
122 } 122 }
123 } 123 }
...@@ -153,7 +153,7 @@ parse_headers (mu_stream_t input, compose_env_t *env) ...@@ -153,7 +153,7 @@ parse_headers (mu_stream_t input, compose_env_t *env)
153 static void 153 static void
154 escape_continue (void) 154 escape_continue (void)
155 { 155 {
156 mu_stream_printf (ostream, _("(continue)\n")); 156 mu_printf (_("(continue)\n"));
157 } 157 }
158 158
159 static int 159 static int
...@@ -163,7 +163,7 @@ escape_check_args (int argc, char **argv) ...@@ -163,7 +163,7 @@ escape_check_args (int argc, char **argv)
163 { 163 {
164 char *escape = "~"; 164 char *escape = "~";
165 mailvar_get (&escape, "escape", mailvar_type_string, 0); 165 mailvar_get (&escape, "escape", mailvar_type_string, 0);
166 util_error (_("%c%s requires an argument"), escape[0], argv[0]); 166 mu_error (_("%c%s requires an argument"), escape[0], argv[0]);
167 return 1; 167 return 1;
168 } 168 }
169 return 0; 169 return 0;
...@@ -183,7 +183,6 @@ escape_command (int argc, char **argv, compose_env_t *env) ...@@ -183,7 +183,6 @@ escape_command (int argc, char **argv, compose_env_t *env)
183 { 183 {
184 const struct mail_command_entry *entry; 184 const struct mail_command_entry *entry;
185 int status; 185 int status;
186 mu_stream_t s;
187 186
188 if (escape_check_args (argc, argv)) 187 if (escape_check_args (argc, argv))
189 return 1; 188 return 1;
...@@ -192,20 +191,16 @@ escape_command (int argc, char **argv, compose_env_t *env) ...@@ -192,20 +191,16 @@ escape_command (int argc, char **argv, compose_env_t *env)
192 entry = mail_find_command (argv[1]); 191 entry = mail_find_command (argv[1]);
193 if (!entry) 192 if (!entry)
194 { 193 {
195 util_error (_("Unknown command: %s"), argv[1]); 194 mu_error (_("Unknown command: %s"), argv[1]);
196 return 1; 195 return 1;
197 } 196 }
198 if (entry->flags & (EF_FLOW | EF_SEND)) 197 if (entry->flags & (EF_FLOW | EF_SEND))
199 { 198 {
200 util_error (_("Command not allowed in an escape sequence\n")); 199 mu_error (_("Command not allowed in an escape sequence\n"));
201 return 1; 200 return 1;
202 } 201 }
203 202
204 /* FIXME: Do we need this? */
205 s = ostream;
206 ostream = env->compstr;
207 status = (*entry->func) (argc - 1, argv + 1); 203 status = (*entry->func) (argc - 1, argv + 1);
208 ostream = s;
209 return status; 204 return status;
210 } 205 }
211 206
...@@ -242,10 +237,10 @@ escape_sign (int argc MU_ARG_UNUSED, char **argv, compose_env_t *env) ...@@ -242,10 +237,10 @@ escape_sign (int argc MU_ARG_UNUSED, char **argv, compose_env_t *env)
242 237
243 rc = mu_file_stream_create (&signstr, name, MU_STREAM_READ); 238 rc = mu_file_stream_create (&signstr, name, MU_STREAM_READ);
244 if (rc) 239 if (rc)
245 util_error (_("Cannot open %s: %s"), name, mu_strerror (rc)); 240 mu_error (_("Cannot open %s: %s"), name, mu_strerror (rc));
246 else 241 else
247 { 242 {
248 mu_stream_printf (ostream, _("Reading %s\n"), name); 243 mu_printf (_("Reading %s\n"), name);
249 mu_stream_copy (env->compstr, signstr, 0, NULL); 244 mu_stream_copy (env->compstr, signstr, 0, NULL);
250 mu_stream_destroy (&signstr); 245 mu_stream_destroy (&signstr);
251 } 246 }
...@@ -297,7 +292,7 @@ verbose_copy (mu_stream_t dest, mu_stream_t src, const char *filename, ...@@ -297,7 +292,7 @@ verbose_copy (mu_stream_t dest, mu_stream_t src, const char *filename,
297 } 292 }
298 if (rc) 293 if (rc)
299 mu_error (_("error copying data: %s"), mu_strerror (rc)); 294 mu_error (_("error copying data: %s"), mu_strerror (rc));
300 mu_stream_printf (ostream, "\"%s\" %lu/%lu\n", filename, 295 mu_printf ("\"%s\" %lu/%lu\n", filename,
301 (unsigned long) lines, (unsigned long) total); 296 (unsigned long) lines, (unsigned long) total);
302 if (psize) 297 if (psize)
303 *psize = total; 298 *psize = total;
...@@ -314,7 +309,7 @@ escape_deadletter (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED, ...@@ -314,7 +309,7 @@ escape_deadletter (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED,
314 int rc = mu_file_stream_create (&str, name, MU_STREAM_READ); 309 int rc = mu_file_stream_create (&str, name, MU_STREAM_READ);
315 if (rc) 310 if (rc)
316 { 311 {
317 util_error (_("Cannot open file %s: %s"), name, strerror (rc)); 312 mu_error (_("Cannot open file %s: %s"), name, strerror (rc));
318 return 1; 313 return 1;
319 } 314 }
320 verbose_copy (env->compstr, str, name, NULL); 315 verbose_copy (env->compstr, str, name, NULL);
...@@ -488,7 +483,7 @@ quote0 (msgset_t *mspec, mu_message_t mesg, void *data) ...@@ -488,7 +483,7 @@ quote0 (msgset_t *mspec, mu_message_t mesg, void *data)
488 mu_stream_t flt; 483 mu_stream_t flt;
489 char *argv[3]; 484 char *argv[3];
490 485
491 mu_stream_printf (ostream, _("Interpolating: %lu\n"), 486 mu_printf (_("Interpolating: %lu\n"),
492 (unsigned long) mspec->msg_part[0]); 487 (unsigned long) mspec->msg_part[0]);
493 488
494 mailvar_get (&prefix, "indentprefix", mailvar_type_string, 0); 489 mailvar_get (&prefix, "indentprefix", mailvar_type_string, 0);
...@@ -534,7 +529,7 @@ quote0 (msgset_t *mspec, mu_message_t mesg, void *data) ...@@ -534,7 +529,7 @@ quote0 (msgset_t *mspec, mu_message_t mesg, void *data)
534 529
535 if (rc) 530 if (rc)
536 { 531 {
537 util_error (_("get_streamref error: %s"), mu_strerror (rc)); 532 mu_error (_("get_streamref error: %s"), mu_strerror (rc));
538 return rc; 533 return rc;
539 } 534 }
540 535
...@@ -563,10 +558,10 @@ int ...@@ -563,10 +558,10 @@ int
563 escape_type_input (int argc, char **argv, compose_env_t *env) 558 escape_type_input (int argc, char **argv, compose_env_t *env)
564 { 559 {
565 /* FIXME: Enable paging */ 560 /* FIXME: Enable paging */
566 mu_stream_printf (ostream, _("Message contains:\n")); 561 mu_printf (_("Message contains:\n"));
567 dump_headers (ostream, env); 562 dump_headers (mu_strout, env);
568 mu_stream_seek (env->compstr, 0, MU_SEEK_SET, NULL); 563 mu_stream_seek (env->compstr, 0, MU_SEEK_SET, NULL);
569 mu_stream_copy (ostream, env->compstr, 0, NULL); 564 mu_stream_copy (mu_strout, env->compstr, 0, NULL);
570 escape_continue (); 565 escape_continue ();
571 return 0; 566 return 0;
572 } 567 }
...@@ -586,7 +581,7 @@ escape_read (int argc, char **argv, compose_env_t *env MU_ARG_UNUSED) ...@@ -586,7 +581,7 @@ escape_read (int argc, char **argv, compose_env_t *env MU_ARG_UNUSED)
586 rc = mu_file_stream_create (&instr, filename, MU_STREAM_READ); 581 rc = mu_file_stream_create (&instr, filename, MU_STREAM_READ);
587 if (rc) 582 if (rc)
588 { 583 {
589 util_error (_("Cannot open %s: %s"), filename, mu_strerror (rc)); 584 mu_error (_("Cannot open %s: %s"), filename, mu_strerror (rc));
590 free (filename); 585 free (filename);
591 return 1; 586 return 1;
592 } 587 }
...@@ -636,7 +631,7 @@ escape_write (int argc, char **argv, compose_env_t *env) ...@@ -636,7 +631,7 @@ escape_write (int argc, char **argv, compose_env_t *env)
636 MU_STREAM_WRITE|MU_STREAM_CREAT); 631 MU_STREAM_WRITE|MU_STREAM_CREAT);
637 if (rc) 632 if (rc)
638 { 633 {
639 util_error (_("Cannot open %s for writing: %s"), 634 mu_error (_("Cannot open %s for writing: %s"),
640 filename, mu_strerror (rc)); 635 filename, mu_strerror (rc));
641 free (filename); 636 free (filename);
642 return 1; 637 return 1;
...@@ -663,7 +658,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env) ...@@ -663,7 +658,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
663 658
664 if (pipe (p)) 659 if (pipe (p))
665 { 660 {
666 util_error ("pipe: %s", mu_strerror (errno)); 661 mu_error ("pipe: %s", mu_strerror (errno));
667 return 1; 662 return 1;
668 } 663 }
669 664
...@@ -675,7 +670,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env) ...@@ -675,7 +670,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
675 close (p[0]); 670 close (p[0]);
676 close (p[1]); 671 close (p[1]);
677 close (fd); 672 close (fd);
678 util_error ("fork: %s", mu_strerror (errno)); 673 mu_error ("fork: %s", mu_strerror (errno));
679 return 1; 674 return 1;
680 } 675 }
681 else if (pid == 0) 676 else if (pid == 0)
...@@ -693,7 +688,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env) ...@@ -693,7 +688,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
693 close (fd); 688 close (fd);
694 689
695 execvp (argv[1], argv + 1); 690 execvp (argv[1], argv + 1);
696 util_error (_("Cannot execute `%s': %s"), argv[1], mu_strerror (errno)); 691 mu_error (_("Cannot execute `%s': %s"), argv[1], mu_strerror (errno));
697 _exit (127); 692 _exit (127);
698 } 693 }
699 694
...@@ -714,13 +709,13 @@ escape_pipe (int argc, char **argv, compose_env_t *env) ...@@ -714,13 +709,13 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
714 709
715 waitpid (pid, &status, 0); 710 waitpid (pid, &status, 0);
716 if (!WIFEXITED (status)) 711 if (!WIFEXITED (status))
717 util_error (_("Child terminated abnormally: %d"), 712 mu_error (_("Child terminated abnormally: %d"),
718 WEXITSTATUS (status)); 713 WEXITSTATUS (status));
719 else 714 else
720 { 715 {
721 struct stat st; 716 struct stat st;
722 if (fstat (fd, &st)) 717 if (fstat (fd, &st))
723 util_error (_("Cannot stat output file: %s"), mu_strerror (errno)); 718 mu_error (_("Cannot stat output file: %s"), mu_strerror (errno));
724 else 719 else
725 osize = st.st_size; 720 osize = st.st_size;
726 } 721 }
...@@ -738,7 +733,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env) ...@@ -738,7 +733,7 @@ escape_pipe (int argc, char **argv, compose_env_t *env)
738 MU_STREAM_RDWR | MU_STREAM_SEEK); 733 MU_STREAM_RDWR | MU_STREAM_SEEK);
739 if (rc) 734 if (rc)
740 { 735 {
741 util_error (_("Cannot open composition stream: %s"), 736 mu_error (_("Cannot open composition stream: %s"),
742 mu_strerror (rc)); 737 mu_strerror (rc));
743 close (fd); 738 close (fd);
744 } 739 }
......
...@@ -37,7 +37,7 @@ mail_expand_name (const char *name) ...@@ -37,7 +37,7 @@ mail_expand_name (const char *name)
37 case '#': 37 case '#':
38 if (!prev_name) 38 if (!prev_name)
39 { 39 {
40 util_error (_("No previous file")); 40 mu_error (_("No previous file"));
41 return NULL; 41 return NULL;
42 } 42 }
43 else 43 else
...@@ -47,7 +47,7 @@ mail_expand_name (const char *name) ...@@ -47,7 +47,7 @@ mail_expand_name (const char *name)
47 case '&': 47 case '&':
48 name = getenv ("MBOX"); 48 name = getenv ("MBOX");
49 if (!name) 49 if (!name)
50 util_error (_("MBOX environment variable not set")); 50 mu_error (_("MBOX environment variable not set"));
51 else 51 else
52 name = xstrdup (name); 52 name = xstrdup (name);
53 break; 53 break;
...@@ -91,7 +91,7 @@ mail_file (int argc, char **argv) ...@@ -91,7 +91,7 @@ mail_file (int argc, char **argv)
91 || (status = mu_mailbox_open (newbox, MU_STREAM_RDWR)) != 0) 91 || (status = mu_mailbox_open (newbox, MU_STREAM_RDWR)) != 0)
92 { 92 {
93 mu_mailbox_destroy (&newbox); 93 mu_mailbox_destroy (&newbox);
94 util_error(_("Cannot open mailbox %s: %s"), name, mu_strerror (status)); 94 mu_error(_("Cannot open mailbox %s: %s"), name, mu_strerror (status));
95 free (name); 95 free (name);
96 return 1; 96 return 1;
97 } 97 }
...@@ -126,7 +126,7 @@ mail_file (int argc, char **argv) ...@@ -126,7 +126,7 @@ mail_file (int argc, char **argv)
126 } 126 }
127 else 127 else
128 { 128 {
129 util_error(_("%s takes only one argument"), argv[0]); 129 mu_error (_("%s takes only one argument"), argv[0]);
130 } 130 }
131 return 1; 131 return 1;
132 } 132 }
......
...@@ -34,7 +34,7 @@ mail_folders (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) ...@@ -34,7 +34,7 @@ mail_folders (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
34 char *tmp = alloca (strlen (path) + 3); 34 char *tmp = alloca (strlen (path) + 3);
35 if (!tmp) 35 if (!tmp)
36 { 36 {
37 util_error (_("Not enough memory")); 37 mu_error (_("Not enough memory"));
38 return 1; 38 return 1;
39 } 39 }
40 40
......
...@@ -40,7 +40,7 @@ mail_followup (int argc, char **argv) ...@@ -40,7 +40,7 @@ mail_followup (int argc, char **argv)
40 n = get_cursor (); 40 n = get_cursor ();
41 if (n == 0) 41 if (n == 0)
42 { 42 {
43 util_error (_("No applicable message")); 43 mu_error (_("No applicable message"));
44 return 1; 44 return 1;
45 } 45 }
46 46
...@@ -77,9 +77,9 @@ mail_followup (int argc, char **argv) ...@@ -77,9 +77,9 @@ mail_followup (int argc, char **argv)
77 77
78 msgset_free (msglist); 78 msgset_free (msglist);
79 79
80 mu_stream_printf (ostream, "To: %s\n", 80 mu_printf ("To: %s\n",
81 compose_header_get (&env, MU_HEADER_TO, "")); 81 compose_header_get (&env, MU_HEADER_TO, ""));
82 mu_stream_printf (ostream, "Subject: %s\n\n", 82 mu_printf ("Subject: %s\n\n",
83 compose_header_get (&env, MU_HEADER_SUBJECT, "")); 83 compose_header_get (&env, MU_HEADER_SUBJECT, ""));
84 84
85 status = mail_send0 (&env, mu_isupper (argv[0][0])); 85 status = mail_send0 (&env, mu_isupper (argv[0][0]));
......
...@@ -72,7 +72,7 @@ static void ...@@ -72,7 +72,7 @@ static void
72 format_pad (size_t n) 72 format_pad (size_t n)
73 { 73 {
74 for (; n; n--) 74 for (; n; n--)
75 mu_stream_write (ostream, " ", 1, NULL); 75 mu_stream_write (mu_strout, " ", 1, NULL);
76 } 76 }
77 77
78 static void 78 static void
...@@ -113,17 +113,17 @@ format_headline (struct header_segm *seg, msgset_t *mspec, mu_message_t msg) ...@@ -113,17 +113,17 @@ format_headline (struct header_segm *seg, msgset_t *mspec, mu_message_t msg)
113 if (seg->align == ALIGN_RIGHT) 113 if (seg->align == ALIGN_RIGHT)
114 { 114 {
115 format_pad (width - len); 115 format_pad (width - len);
116 mu_stream_printf (ostream, "%*.*s", (int) len, (int) len, p); 116 mu_printf ("%*.*s", (int) len, (int) len, p);
117 } 117 }
118 else 118 else
119 { 119 {
120 mu_stream_printf (ostream, "%*.*s", (int) len, (int) len, p); 120 mu_printf ("%*.*s", (int) len, (int) len, p);
121 format_pad (width - len); 121 format_pad (width - len);
122 } 122 }
123 out_cols += width; 123 out_cols += width;
124 } 124 }
125 125
126 mu_stream_printf (ostream, "\n"); 126 mu_printf ("\n");
127 free (args.buf); 127 free (args.buf);
128 } 128 }
129 129
......
...@@ -52,7 +52,7 @@ _cond_push(int val) ...@@ -52,7 +52,7 @@ _cond_push(int val)
52 52
53 if (!_cond_stack) 53 if (!_cond_stack)
54 { 54 {
55 util_error(_("Not enough memory")); 55 mu_error(_("Not enough memory"));
56 exit (EXIT_FAILURE); 56 exit (EXIT_FAILURE);
57 } 57 }
58 _cond_stack[_cond_level++] = val; 58 _cond_stack[_cond_level++] = val;
...@@ -63,7 +63,7 @@ _cond_pop() ...@@ -63,7 +63,7 @@ _cond_pop()
63 { 63 {
64 if (_cond_level == 0) 64 if (_cond_level == 0)
65 { 65 {
66 util_error(_("Internal error: condition stack underflow")); 66 mu_error(_("Internal error: condition stack underflow"));
67 abort(); 67 abort();
68 } 68 }
69 return _cond_stack[--_cond_level]; 69 return _cond_stack[--_cond_level];
...@@ -86,13 +86,13 @@ mail_if (int argc, char **argv) ...@@ -86,13 +86,13 @@ mail_if (int argc, char **argv)
86 if (argc != 2) 86 if (argc != 2)
87 { 87 {
88 /* TRANSLATORS: 'if' is the function name. Do not translate it */ 88 /* TRANSLATORS: 'if' is the function name. Do not translate it */
89 util_error(_("if requires an argument: s | r | t")); 89 mu_error(_("if requires an argument: s | r | t"));
90 return 1; 90 return 1;
91 } 91 }
92 92
93 if (argv[1][1] != 0) 93 if (argv[1][1] != 0)
94 { 94 {
95 util_error(_("Valid if arguments are: s | r | t")); 95 mu_error(_("Valid if arguments are: s | r | t"));
96 return 1; 96 return 1;
97 } 97 }
98 98
...@@ -116,7 +116,7 @@ mail_if (int argc, char **argv) ...@@ -116,7 +116,7 @@ mail_if (int argc, char **argv)
116 cond = isatty (fileno (stdout)); 116 cond = isatty (fileno (stdout));
117 break; 117 break;
118 default: 118 default:
119 util_error(_("Valid if arguments are: s | r | t")); 119 mu_error(_("Valid if arguments are: s | r | t"));
120 return 1; 120 return 1;
121 } 121 }
122 } 122 }
...@@ -133,7 +133,7 @@ mail_else (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) ...@@ -133,7 +133,7 @@ mail_else (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
133 if (_cond_level == 0) 133 if (_cond_level == 0)
134 { 134 {
135 /* TRANSLATORS: 'else' and 'if' are function names. Do not translate them */ 135 /* TRANSLATORS: 'else' and 'if' are function names. Do not translate them */
136 util_error(_("else without matching if")); 136 mu_error(_("else without matching if"));
137 return 1; 137 return 1;
138 } 138 }
139 cond = _cond_pop(); 139 cond = _cond_pop();
...@@ -149,7 +149,7 @@ mail_endif (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) ...@@ -149,7 +149,7 @@ mail_endif (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
149 if (_cond_level == 0) 149 if (_cond_level == 0)
150 { 150 {
151 /* TRANSLATORS: 'endif' and 'if' are function names. Do not translate them */ 151 /* TRANSLATORS: 'endif' and 'if' are function names. Do not translate them */
152 util_error(_("endif without matching if")); 152 mu_error (_("endif without matching if"));
153 return 1; 153 return 1;
154 } 154 }
155 _cond_pop(); 155 _cond_pop();
......
...@@ -27,10 +27,10 @@ mail_inc (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) ...@@ -27,10 +27,10 @@ mail_inc (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
27 if (!mu_mailbox_is_updated (mbox)) 27 if (!mu_mailbox_is_updated (mbox))
28 { 28 {
29 mu_mailbox_messages_count (mbox, &total); 29 mu_mailbox_messages_count (mbox, &total);
30 mu_stream_printf (ostream, _("New mail has arrived.\n")); 30 mu_printf (_("New mail has arrived.\n"));
31 } 31 }
32 else 32 else
33 mu_stream_printf (ostream, _("No new mail for %s\n"), mail_whoami ()); 33 mu_printf (_("No new mail for %s\n"), mail_whoami ());
34 34
35 return 0; 35 return 0;
36 } 36 }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
21 /* Global variables and constants*/ 21 /* Global variables and constants*/
22 mu_mailbox_t mbox; /* Mailbox being operated upon */ 22 mu_mailbox_t mbox; /* Mailbox being operated upon */
23 size_t total; /* Total number of messages in the mailbox */ 23 size_t total; /* Total number of messages in the mailbox */
24 mu_stream_t ostream; /* Output stream */
25 int interactive; /* Is the session interactive */ 24 int interactive; /* Is the session interactive */
26 25
27 static mu_list_t command_list; /* List of commands to be executed after parsing 26 static mu_list_t command_list; /* List of commands to be executed after parsing
...@@ -221,20 +220,20 @@ mail_cmdline (void *closure, int cont MU_ARG_UNUSED) ...@@ -221,20 +220,20 @@ mail_cmdline (void *closure, int cont MU_ARG_UNUSED)
221 { 220 {
222 mu_mailbox_messages_count (mbox, &total); 221 mu_mailbox_messages_count (mbox, &total);
223 page_invalidate (0); 222 page_invalidate (0);
224 mu_stream_printf (ostream, _("New mail has arrived.\n")); 223 mu_printf (_("New mail has arrived.\n"));
225 } 224 }
226 225
227 rc = ml_readline (prompt); 226 rc = ml_readline (prompt);
228 227
229 if (ml_got_interrupt ()) 228 if (ml_got_interrupt ())
230 { 229 {
231 util_error (_("Interrupt")); 230 mu_error (_("Interrupt"));
232 continue; 231 continue;
233 } 232 }
234 233
235 if (!rc && mailvar_get (NULL, "ignoreeof", mailvar_type_boolean, 0) == 0) 234 if (!rc && mailvar_get (NULL, "ignoreeof", mailvar_type_boolean, 0) == 0)
236 { 235 {
237 util_error (_("Use \"quit\" to quit.")); 236 mu_error (_("Use \"quit\" to quit."));
238 continue; 237 continue;
239 } 238 }
240 239
...@@ -325,8 +324,6 @@ main (int argc, char **argv) ...@@ -325,8 +324,6 @@ main (int argc, char **argv)
325 int i, rc; 324 int i, rc;
326 325
327 mu_stdstream_setup (); 326 mu_stdstream_setup ();
328 ostream = mu_strout;
329 mu_stream_ref (mu_strout);
330 set_cursor (1); 327 set_cursor (1);
331 328
332 /* Native Language Support */ 329 /* Native Language Support */
...@@ -446,10 +443,10 @@ main (int argc, char **argv) ...@@ -446,10 +443,10 @@ main (int argc, char **argv)
446 if ((rc = mu_mailbox_create_default (&mbox, args.file)) != 0) 443 if ((rc = mu_mailbox_create_default (&mbox, args.file)) != 0)
447 { 444 {
448 if (args.file) 445 if (args.file)
449 util_error (_("Cannot create mailbox %s: %s"), args.file, 446 mu_error (_("Cannot create mailbox %s: %s"), args.file,
450 mu_strerror (rc)); 447 mu_strerror (rc));
451 else 448 else
452 util_error (_("Cannot create mailbox: %s"), 449 mu_error (_("Cannot create mailbox: %s"),
453 mu_strerror (rc)); 450 mu_strerror (rc));
454 exit (EXIT_FAILURE); 451 exit (EXIT_FAILURE);
455 } 452 }
...@@ -458,7 +455,7 @@ main (int argc, char **argv) ...@@ -458,7 +455,7 @@ main (int argc, char **argv)
458 { 455 {
459 mu_url_t url = NULL; 456 mu_url_t url = NULL;
460 mu_mailbox_get_url (mbox, &url); 457 mu_mailbox_get_url (mbox, &url);
461 util_error (_("Cannot open mailbox %s: %s"), 458 mu_error (_("Cannot open mailbox %s: %s"),
462 mu_url_to_string (url), mu_strerror (rc)); 459 mu_url_to_string (url), mu_strerror (rc));
463 mu_mailbox_destroy (&mbox); 460 mu_mailbox_destroy (&mbox);
464 } 461 }
...@@ -471,7 +468,7 @@ main (int argc, char **argv) ...@@ -471,7 +468,7 @@ main (int argc, char **argv)
471 { 468 {
472 mu_url_t url = NULL; 469 mu_url_t url = NULL;
473 mu_mailbox_get_url (mbox, &url); 470 mu_mailbox_get_url (mbox, &url);
474 util_error (_("Cannot read mailbox %s: %s"), 471 mu_error (_("Cannot read mailbox %s: %s"),
475 mu_url_to_string (url), mu_strerror (rc)); 472 mu_url_to_string (url), mu_strerror (rc));
476 exit (EXIT_FAILURE); 473 exit (EXIT_FAILURE);
477 } 474 }
...@@ -487,7 +484,7 @@ main (int argc, char **argv) ...@@ -487,7 +484,7 @@ main (int argc, char **argv)
487 do_and_quit ("from *"); 484 do_and_quit ("from *");
488 else if (strcmp (mode, "read")) 485 else if (strcmp (mode, "read"))
489 { 486 {
490 util_error (_("Unknown mode `%s'"), mode); 487 mu_error (_("Unknown mode `%s'"), mode);
491 util_do_command ("quit"); 488 util_do_command ("quit");
492 return 1; 489 return 1;
493 } 490 }
...@@ -498,9 +495,9 @@ main (int argc, char **argv) ...@@ -498,9 +495,9 @@ main (int argc, char **argv)
498 || mailvar_get (NULL, "emptystart", mailvar_type_boolean, 0))) 495 || mailvar_get (NULL, "emptystart", mailvar_type_boolean, 0)))
499 { 496 {
500 if (args.file) 497 if (args.file)
501 mu_stream_printf (ostream, _("%s: 0 messages\n"), args.file); 498 mu_printf (_("%s: 0 messages\n"), args.file);
502 else 499 else
503 mu_stream_printf (ostream, _("No mail for %s\n"), 500 mu_printf (_("No mail for %s\n"),
504 args.user ? args.user : mail_whoami ()); 501 args.user ? args.user : mail_whoami ());
505 return 1; 502 return 1;
506 } 503 }
...@@ -514,7 +511,7 @@ main (int argc, char **argv) ...@@ -514,7 +511,7 @@ main (int argc, char **argv)
514 511
515 mailvar_get (&prompt, "prompt", mailvar_type_string, 0); 512 mailvar_get (&prompt, "prompt", mailvar_type_string, 0);
516 mail_mainloop (mail_cmdline, (void*) prompt, 1); 513 mail_mainloop (mail_cmdline, (void*) prompt, 1);
517 mu_stream_printf (ostream, "\n"); 514 mu_printf ("\n");
518 util_do_command ("quit"); 515 util_do_command ("quit");
519 return 0; 516 return 0;
520 } 517 }
...@@ -564,11 +561,11 @@ mail_mainloop (char *(*input) (void *, int), ...@@ -564,11 +561,11 @@ mail_mainloop (char *(*input) (void *, int),
564 int 561 int
565 mail_warranty (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) 562 mail_warranty (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
566 { 563 {
567 mu_stream_printf (ostream, 564 mu_printf (
568 _("GNU Mailutils -- a suite of utilities for electronic mail\n" 565 _("GNU Mailutils -- a suite of utilities for electronic mail\n"
569 "Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,\n" 566 "Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,\n"
570 "2007, 2009 Free Software Foundation, Inc.\n\n")); 567 "2007, 2009, 2010 Free Software Foundation, Inc.\n\n"));
571 mu_stream_printf (ostream, 568 mu_printf (
572 _(" GNU Mailutils is free software; you can redistribute it and/or modify\n" 569 _(" GNU Mailutils is free software; you can redistribute it and/or modify\n"
573 " it under the terms of the GNU General Public License as published by\n" 570 " it under the terms of the GNU General Public License as published by\n"
574 " the Free Software Foundation; either version 3 of the License, or\n" 571 " the Free Software Foundation; either version 3 of the License, or\n"
......
...@@ -172,7 +172,6 @@ typedef int (*msg_handler_t) (msgset_t *mp, mu_message_t mesg, void *data); ...@@ -172,7 +172,6 @@ typedef int (*msg_handler_t) (msgset_t *mp, mu_message_t mesg, void *data);
172 /* Global variables and constants*/ 172 /* Global variables and constants*/
173 extern mu_mailbox_t mbox; 173 extern mu_mailbox_t mbox;
174 extern size_t total; 174 extern size_t total;
175 extern mu_stream_t ostream;
176 extern int interactive; 175 extern int interactive;
177 extern const char *program_version; 176 extern const char *program_version;
178 177
...@@ -380,7 +379,6 @@ extern char *util_slist_to_string (mu_list_t list, const char *delim); ...@@ -380,7 +379,6 @@ extern char *util_slist_to_string (mu_list_t list, const char *delim);
380 extern void util_strcat (char **dest, const char *str); 379 extern void util_strcat (char **dest, const char *str);
381 extern char *util_outfolder_name (char *str); 380 extern char *util_outfolder_name (char *str);
382 extern void util_save_outgoing (mu_message_t msg, char *savefile); 381 extern void util_save_outgoing (mu_message_t msg, char *savefile);
383 extern void util_error (const char *format, ...) MU_PRINTFLIKE(1,2);
384 extern int util_error_range (size_t msgno); 382 extern int util_error_range (size_t msgno);
385 extern void util_noapp (void); 383 extern void util_noapp (void);
386 extern int util_tempfile (char **namep); 384 extern int util_tempfile (char **namep);
......
...@@ -151,7 +151,7 @@ ml_readline_with_intr (const char *prompt) ...@@ -151,7 +151,7 @@ ml_readline_with_intr (const char *prompt)
151 { 151 {
152 char *str = ml_readline (prompt); 152 char *str = ml_readline (prompt);
153 if (_interrupted) 153 if (_interrupted)
154 mu_stream_printf (ostream, "\n"); 154 mu_printf ("\n");
155 return str; 155 return str;
156 } 156 }
157 157
...@@ -782,7 +782,7 @@ ml_reread (const char *prompt, char **text) ...@@ -782,7 +782,7 @@ ml_reread (const char *prompt, char **text)
782 782
783 if (!line) 783 if (!line)
784 { 784 {
785 util_error (_("Not enough memory to edit the line")); 785 mu_error (_("Not enough memory to edit the line"));
786 return -1; 786 return -1;
787 } 787 }
788 788
...@@ -810,7 +810,7 @@ ml_reread (const char *prompt, char **text) ...@@ -810,7 +810,7 @@ ml_reread (const char *prompt, char **text)
810 if ((p = realloc (line, line_size + LINE_INC)) == NULL) 810 if ((p = realloc (line, line_size + LINE_INC)) == NULL)
811 { 811 {
812 fputs ("\n", stdout); 812 fputs ("\n", stdout);
813 util_error (_("Not enough memory to edit the line")); 813 mu_error (_("Not enough memory to edit the line"));
814 break; 814 break;
815 } 815 }
816 else 816 else
...@@ -857,7 +857,7 @@ ml_reread (const char *prompt, char **text) ...@@ -857,7 +857,7 @@ ml_reread (const char *prompt, char **text)
857 if ((p = realloc (line, line_size + LINE_INC)) == NULL) 857 if ((p = realloc (line, line_size + LINE_INC)) == NULL)
858 { 858 {
859 fputs ("\n", stdout); 859 fputs ("\n", stdout);
860 util_error (_("Not enough memory to edit the line")); 860 mu_error (_("Not enough memory to edit the line"));
861 break; 861 break;
862 } 862 }
863 else 863 else
...@@ -893,7 +893,7 @@ ml_reread (const char *prompt, char **text) ...@@ -893,7 +893,7 @@ ml_reread (const char *prompt, char **text)
893 if ((p = realloc (line, line_size + LINE_INC)) == NULL) 893 if ((p = realloc (line, line_size + LINE_INC)) == NULL)
894 { 894 {
895 fputs ("\n", stdout); 895 fputs ("\n", stdout);
896 util_error (_("Not enough memory to edit the line")); 896 mu_error (_("Not enough memory to edit the line"));
897 break; 897 break;
898 } 898 }
899 else 899 else
...@@ -925,8 +925,8 @@ readline (char *prompt) ...@@ -925,8 +925,8 @@ readline (char *prompt)
925 { 925 {
926 if (prompt) 926 if (prompt)
927 { 927 {
928 mu_stream_printf (ostream, "%s", prompt); 928 mu_printf ("%s", prompt);
929 mu_stream_flush (ostream); 929 mu_stream_flush (mu_strout);
930 } 930 }
931 931
932 return ml_readline_internal (); 932 return ml_readline_internal ();
......
...@@ -416,7 +416,7 @@ mailvar_get (void *ptr, const char *variable, enum mailvar_type type, int warn) ...@@ -416,7 +416,7 @@ mailvar_get (void *ptr, const char *variable, enum mailvar_type type, int warn)
416 if (!var->set || var->type != type) 416 if (!var->set || var->type != type)
417 { 417 {
418 if (warn) 418 if (warn)
419 util_error (_("No value set for \"%s\""), variable); 419 mu_error (_("No value set for \"%s\""), variable);
420 return 1; 420 return 1;
421 } 421 }
422 if (ptr) 422 if (ptr)
......
...@@ -727,7 +727,7 @@ check_set (msgset_t **pset) ...@@ -727,7 +727,7 @@ check_set (msgset_t **pset)
727 } 727 }
728 else 728 else
729 { 729 {
730 util_error (_("%lu: Inappropriate message (has been deleted)"), 730 mu_error (_("%lu: Inappropriate message (has been deleted)"),
731 (unsigned long) p->msg_part[0]); 731 (unsigned long) p->msg_part[0]);
732 /* Delete entire set */ 732 /* Delete entire set */
733 delset = *pset; 733 delset = *pset;
......
...@@ -36,7 +36,7 @@ mail_next (int argc, char **argv) ...@@ -36,7 +36,7 @@ mail_next (int argc, char **argv)
36 n = get_cursor (); 36 n = get_cursor ();
37 if (n == 0 || util_get_message (mbox, n, &msg)) 37 if (n == 0 || util_get_message (mbox, n, &msg))
38 { 38 {
39 util_error (_("No applicable message")); 39 mu_error (_("No applicable message"));
40 return 1; 40 return 1;
41 } 41 }
42 42
...@@ -59,7 +59,7 @@ mail_next (int argc, char **argv) ...@@ -59,7 +59,7 @@ mail_next (int argc, char **argv)
59 59
60 if (rc) 60 if (rc)
61 { 61 {
62 util_error (_("No applicable message")); 62 mu_error (_("No applicable message"));
63 return 1; 63 return 1;
64 } 64 }
65 } 65 }
...@@ -76,7 +76,7 @@ mail_next (int argc, char **argv) ...@@ -76,7 +76,7 @@ mail_next (int argc, char **argv)
76 } 76 }
77 else 77 else
78 { 78 {
79 util_error (_("No applicable message")); 79 mu_error (_("No applicable message"));
80 return 1; 80 return 1;
81 } 81 }
82 } 82 }
......
...@@ -45,7 +45,7 @@ mail_previous (int argc, char **argv) ...@@ -45,7 +45,7 @@ mail_previous (int argc, char **argv)
45 45
46 if (rc) 46 if (rc)
47 { 47 {
48 util_error (_("No applicable message")); 48 mu_error (_("No applicable message"));
49 return 1; 49 return 1;
50 } 50 }
51 } 51 }
...@@ -62,7 +62,7 @@ mail_previous (int argc, char **argv) ...@@ -62,7 +62,7 @@ mail_previous (int argc, char **argv)
62 } 62 }
63 else 63 else
64 { 64 {
65 util_error (_("No applicable message")); 65 mu_error (_("No applicable message"));
66 return 1; 66 return 1;
67 } 67 }
68 } 68 }
......
...@@ -102,7 +102,7 @@ mail_print_msg (msgset_t *mspec, mu_message_t mesg, void *data) ...@@ -102,7 +102,7 @@ mail_print_msg (msgset_t *mspec, mu_message_t mesg, void *data)
102 /* FIXME: 102 /* FIXME:
103 if (ml_got_interrupt()) 103 if (ml_got_interrupt())
104 { 104 {
105 util_error (_("\nInterrupt")); 105 mu_error (_("\nInterrupt"));
106 break; 106 break;
107 } 107 }
108 */ 108 */
......
...@@ -49,7 +49,7 @@ mail_mbox_close () ...@@ -49,7 +49,7 @@ mail_mbox_close ()
49 49
50 mu_mailbox_get_url (mbox, &url); 50 mu_mailbox_get_url (mbox, &url);
51 mu_mailbox_messages_count (mbox, &held_count); 51 mu_mailbox_messages_count (mbox, &held_count);
52 mu_stream_printf (ostream, 52 mu_printf (
53 ngettext ("Held %d message in %s\n", 53 ngettext ("Held %d message in %s\n",
54 "Held %d messages in %s\n", 54 "Held %d messages in %s\n",
55 held_count), 55 held_count),
...@@ -116,14 +116,14 @@ mail_mbox_commit () ...@@ -116,14 +116,14 @@ mail_mbox_commit ()
116 116
117 if ((status = mu_mailbox_create_default (&dest_mbox, name)) != 0) 117 if ((status = mu_mailbox_create_default (&dest_mbox, name)) != 0)
118 { 118 {
119 util_error (_("Cannot create mailbox %s: %s"), name, 119 mu_error (_("Cannot create mailbox %s: %s"), name,
120 mu_strerror (status)); 120 mu_strerror (status));
121 return 1; 121 return 1;
122 } 122 }
123 if ((status = mu_mailbox_open (dest_mbox, 123 if ((status = mu_mailbox_open (dest_mbox,
124 MU_STREAM_WRITE | MU_STREAM_CREAT))!=0) 124 MU_STREAM_WRITE | MU_STREAM_CREAT))!=0)
125 { 125 {
126 util_error (_("Cannot open mailbox %s: %s"), name, 126 mu_error (_("Cannot open mailbox %s: %s"), name,
127 mu_strerror (status)); 127 mu_strerror (status));
128 return 1; 128 return 1;
129 } 129 }
...@@ -131,7 +131,7 @@ mail_mbox_commit () ...@@ -131,7 +131,7 @@ mail_mbox_commit ()
131 131
132 status = mu_mailbox_append_message (dest_mbox, msg); 132 status = mu_mailbox_append_message (dest_mbox, msg);
133 if (status) 133 if (status)
134 util_error (_("Cannot append message: %s"), mu_strerror (status)); 134 mu_error (_("Cannot append message: %s"), mu_strerror (status));
135 else 135 else
136 { 136 {
137 mu_attribute_set_deleted (attr); 137 mu_attribute_set_deleted (attr);
...@@ -153,7 +153,7 @@ mail_mbox_commit () ...@@ -153,7 +153,7 @@ mail_mbox_commit ()
153 mu_url_t u = NULL; 153 mu_url_t u = NULL;
154 154
155 mu_mailbox_get_url (dest_mbox, &u); 155 mu_mailbox_get_url (dest_mbox, &u);
156 mu_stream_printf (ostream, 156 mu_printf (
157 ngettext ("Saved %d message in %s\n", 157 ngettext ("Saved %d message in %s\n",
158 "Saved %d messages in %s\n", 158 "Saved %d messages in %s\n",
159 saved_count), 159 saved_count),
......
...@@ -111,12 +111,12 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data) ...@@ -111,12 +111,12 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data)
111 else 111 else
112 compose_header_set (&env, MU_HEADER_SUBJECT, "", COMPOSE_REPLACE); 112 compose_header_set (&env, MU_HEADER_SUBJECT, "", COMPOSE_REPLACE);
113 113
114 mu_stream_printf (ostream, "To: %s\n", 114 mu_printf ("To: %s\n",
115 compose_header_get (&env, MU_HEADER_TO, "")); 115 compose_header_get (&env, MU_HEADER_TO, ""));
116 str = compose_header_get (&env, MU_HEADER_CC, NULL); 116 str = compose_header_get (&env, MU_HEADER_CC, NULL);
117 if (str) 117 if (str)
118 mu_stream_printf (ostream, "Cc: %s\n", str); 118 mu_printf ("Cc: %s\n", str);
119 mu_stream_printf (ostream, "Subject: %s\n\n", 119 mu_printf ("Subject: %s\n\n",
120 compose_header_get (&env, MU_HEADER_SUBJECT, "")); 120 compose_header_get (&env, MU_HEADER_SUBJECT, ""));
121 121
122 make_in_reply_to (&env, msg); 122 make_in_reply_to (&env, msg);
......
...@@ -31,7 +31,7 @@ process_list (int argc, char **argv, ...@@ -31,7 +31,7 @@ process_list (int argc, char **argv,
31 if (argc == 1) 31 if (argc == 1)
32 { 32 {
33 if (mu_list_is_empty (*list)) 33 if (mu_list_is_empty (*list))
34 mu_stream_printf (ostream, "%s", _(msg)); 34 mu_printf ("%s", _(msg));
35 else 35 else
36 util_slist_print (*list, 1); 36 util_slist_print (*list, 1);
37 return 0; 37 return 0;
...@@ -125,7 +125,7 @@ mail_nosender (int argc, char **argv) ...@@ -125,7 +125,7 @@ mail_nosender (int argc, char **argv)
125 if (argc == 1) 125 if (argc == 1)
126 { 126 {
127 util_slist_destroy (&sender_headers); 127 util_slist_destroy (&sender_headers);
128 mu_stream_printf (ostream, 128 mu_printf (
129 _("Sender address is obtained from the envelope\n")); 129 _("Sender address is obtained from the envelope\n"));
130 } 130 }
131 else 131 else
......
...@@ -52,7 +52,7 @@ list_headers (void *item, void *data) ...@@ -52,7 +52,7 @@ list_headers (void *item, void *data)
52 52
53 if (!name || strcmp (name, hp->name) == 0) 53 if (!name || strcmp (name, hp->name) == 0)
54 { 54 {
55 mu_stream_printf (ostream, "%s: %s\n", hp->name, hp->value); 55 mu_printf ("%s: %s\n", hp->name, hp->value);
56 } 56 }
57 return 0; 57 return 0;
58 } 58 }
...@@ -67,7 +67,7 @@ add_header (char *name, char *value, int mode) ...@@ -67,7 +67,7 @@ add_header (char *name, char *value, int mode)
67 int rc = mu_list_create (&add_header_list); 67 int rc = mu_list_create (&add_header_list);
68 if (rc) 68 if (rc)
69 { 69 {
70 util_error (_("Cannot create header list: %s"), mu_strerror (rc)); 70 mu_error (_("Cannot create header list: %s"), mu_strerror (rc));
71 exit (1); 71 exit (1);
72 } 72 }
73 } 73 }
...@@ -89,7 +89,7 @@ send_append_header (char *text) ...@@ -89,7 +89,7 @@ send_append_header (char *text)
89 p = strchr (text, ':'); 89 p = strchr (text, ':');
90 if (!p) 90 if (!p)
91 { 91 {
92 util_error (_("Invalid header: %s"), text); 92 mu_error (_("Invalid header: %s"), text);
93 return; 93 return;
94 } 94 }
95 len = p - text; 95 len = p - text;
...@@ -223,7 +223,7 @@ compose_header_set (compose_env_t * env, const char *name, ...@@ -223,7 +223,7 @@ compose_header_set (compose_env_t * env, const char *name,
223 if (!env->header 223 if (!env->header
224 && (status = mu_header_create (&env->header, NULL, 0)) != 0) 224 && (status = mu_header_create (&env->header, NULL, 0)) != 0)
225 { 225 {
226 util_error (_("Cannot create header: %s"), mu_strerror (status)); 226 mu_error (_("Cannot create header: %s"), mu_strerror (status));
227 return status; 227 return status;
228 } 228 }
229 229
...@@ -333,7 +333,7 @@ fill_body (mu_message_t msg, mu_stream_t instr) ...@@ -333,7 +333,7 @@ fill_body (mu_message_t msg, mu_stream_t instr)
333 { 333 {
334 char *str; 334 char *str;
335 if (mailvar_get (&str, "nullbodymsg", mailvar_type_string, 0) == 0) 335 if (mailvar_get (&str, "nullbodymsg", mailvar_type_string, 0) == 0)
336 util_error ("%s\n", _(str)); 336 mu_error ("%s\n", _(str));
337 } 337 }
338 else 338 else
339 return 1; 339 return 1;
...@@ -356,7 +356,7 @@ save_dead_message (compose_env_t *env) ...@@ -356,7 +356,7 @@ save_dead_message (compose_env_t *env)
356 rc = mu_file_stream_create (&dead_letter, name, MU_STREAM_WRITE); 356 rc = mu_file_stream_create (&dead_letter, name, MU_STREAM_WRITE);
357 if (rc) 357 if (rc)
358 { 358 {
359 util_error (_("Cannot open file %s: %s"), name, strerror (rc)); 359 mu_error (_("Cannot open file %s: %s"), name, strerror (rc));
360 return 1; 360 return 1;
361 } 361 }
362 if (mailvar_get (NULL, "appenddeadletter", 362 if (mailvar_get (NULL, "appenddeadletter",
...@@ -401,17 +401,17 @@ send_message (mu_message_t msg) ...@@ -401,17 +401,17 @@ send_message (mu_message_t msg)
401 mu_mailer_close (mailer); 401 mu_mailer_close (mailer);
402 } 402 }
403 else 403 else
404 util_error (_("Cannot open mailer: %s"), mu_strerror (status)); 404 mu_error (_("Cannot open mailer: %s"), mu_strerror (status));
405 mu_mailer_destroy (&mailer); 405 mu_mailer_destroy (&mailer);
406 } 406 }
407 else 407 else
408 util_error (_("Cannot create mailer: %s"), 408 mu_error (_("Cannot create mailer: %s"),
409 mu_strerror (status)); 409 mu_strerror (status));
410 } 410 }
411 } 411 }
412 else 412 else
413 { 413 {
414 util_error (_("Variable sendmail not set: no mailer")); 414 mu_error (_("Variable sendmail not set: no mailer"));
415 status = ENOSYS; 415 status = ENOSYS;
416 } 416 }
417 return status; 417 return status;
...@@ -445,7 +445,7 @@ mail_send0 (compose_env_t *env, int save_to) ...@@ -445,7 +445,7 @@ mail_send0 (compose_env_t *env, int save_to)
445 rc = mu_temp_file_stream_create (&env->compstr, NULL, 0); 445 rc = mu_temp_file_stream_create (&env->compstr, NULL, 0);
446 if (rc) 446 if (rc)
447 { 447 {
448 util_error (_("Cannot open temporary file: %s"), mu_strerror (rc)); 448 mu_error (_("Cannot open temporary file: %s"), mu_strerror (rc));
449 return 1; 449 return 1;
450 } 450 }
451 451
...@@ -460,7 +460,7 @@ mail_send0 (compose_env_t *env, int save_to) ...@@ -460,7 +460,7 @@ mail_send0 (compose_env_t *env, int save_to)
460 { 460 {
461 if (mailvar_get (NULL, "ignore", mailvar_type_boolean, 0) == 0) 461 if (mailvar_get (NULL, "ignore", mailvar_type_boolean, 0) == 0)
462 { 462 {
463 mu_stream_printf (ostream, "@\n"); 463 mu_printf ("@\n");
464 } 464 }
465 else 465 else
466 { 466 {
...@@ -468,7 +468,7 @@ mail_send0 (compose_env_t *env, int save_to) ...@@ -468,7 +468,7 @@ mail_send0 (compose_env_t *env, int save_to)
468 free (buf); 468 free (buf);
469 if (++int_cnt == 2) 469 if (++int_cnt == 2)
470 break; 470 break;
471 util_error (_("\n(Interrupt -- one more to kill letter)")); 471 mu_error (_("\n(Interrupt -- one more to kill letter)"));
472 } 472 }
473 continue; 473 continue;
474 } 474 }
...@@ -478,7 +478,7 @@ mail_send0 (compose_env_t *env, int save_to) ...@@ -478,7 +478,7 @@ mail_send0 (compose_env_t *env, int save_to)
478 if (interactive 478 if (interactive
479 && mailvar_get (NULL, "ignoreeof", mailvar_type_boolean, 0) == 0) 479 && mailvar_get (NULL, "ignoreeof", mailvar_type_boolean, 0) == 0)
480 { 480 {
481 util_error (mailvar_get (NULL, "dot", mailvar_type_boolean, 0) == 0 ? 481 mu_error (mailvar_get (NULL, "dot", mailvar_type_boolean, 0) == 0 ?
482 _("Use \".\" to terminate letter.") : 482 _("Use \".\" to terminate letter.") :
483 _("Use \"~.\" to terminate letter.")); 483 _("Use \"~.\" to terminate letter."));
484 continue; 484 continue;
...@@ -520,15 +520,15 @@ mail_send0 (compose_env_t *env, int save_to) ...@@ -520,15 +520,15 @@ mail_send0 (compose_env_t *env, int save_to)
520 status = (*entry->escfunc) (ws.ws_wordc, ws.ws_wordv, 520 status = (*entry->escfunc) (ws.ws_wordc, ws.ws_wordv,
521 env); 521 env);
522 else 522 else
523 util_error (_("Unknown escape %s"), ws.ws_wordv[0]); 523 mu_error (_("Unknown escape %s"), ws.ws_wordv[0]);
524 } 524 }
525 else 525 else
526 util_error (_("Unfinished escape")); 526 mu_error (_("Unfinished escape"));
527 mu_wordsplit_free (&ws); 527 mu_wordsplit_free (&ws);
528 } 528 }
529 else 529 else
530 { 530 {
531 util_error (_("Cannot parse escape sequence: %s"), 531 mu_error (_("Cannot parse escape sequence: %s"),
532 mu_wordsplit_strerror (&ws)); 532 mu_wordsplit_strerror (&ws));
533 } 533 }
534 } 534 }
...@@ -614,14 +614,14 @@ mail_send0 (compose_env_t *env, int save_to) ...@@ -614,14 +614,14 @@ mail_send0 (compose_env_t *env, int save_to)
614 { 614 {
615 status = mu_mailbox_append_message (mbx, msg); 615 status = mu_mailbox_append_message (mbx, msg);
616 if (status) 616 if (status)
617 util_error (_("Cannot append message: %s"), 617 mu_error (_("Cannot append message: %s"),
618 mu_strerror (status)); 618 mu_strerror (status));
619 mu_mailbox_close (mbx); 619 mu_mailbox_close (mbx);
620 } 620 }
621 mu_mailbox_destroy (&mbx); 621 mu_mailbox_destroy (&mbx);
622 } 622 }
623 if (status) 623 if (status)
624 util_error (_("Cannot create mailbox %s: %s"), 624 mu_error (_("Cannot create mailbox %s: %s"),
625 env->outfiles[i], 625 env->outfiles[i],
626 mu_strerror (status)); 626 mu_strerror (status));
627 } 627 }
...@@ -678,7 +678,7 @@ msg_to_pipe (const char *cmd, mu_message_t msg) ...@@ -678,7 +678,7 @@ msg_to_pipe (const char *cmd, mu_message_t msg)
678 status = mu_command_stream_create (&progstream, cmd, MU_STREAM_WRITE); 678 status = mu_command_stream_create (&progstream, cmd, MU_STREAM_WRITE);
679 if (status) 679 if (status)
680 { 680 {
681 util_error (_("Cannot pipe to %s: %s"), cmd, mu_strerror (status)); 681 mu_error (_("Cannot pipe to %s: %s"), cmd, mu_strerror (status));
682 return status; 682 return status;
683 } 683 }
684 684
...@@ -694,7 +694,7 @@ msg_to_pipe (const char *cmd, mu_message_t msg) ...@@ -694,7 +694,7 @@ msg_to_pipe (const char *cmd, mu_message_t msg)
694 694
695 if (status) 695 if (status)
696 { 696 {
697 util_error (_("Sending data to %s failed: %s"), cmd, 697 mu_error (_("Sending data to %s failed: %s"), cmd,
698 mu_strerror (status)); 698 mu_strerror (status));
699 } 699 }
700 return status; 700 return status;
......
...@@ -29,7 +29,7 @@ mail_setenv (int argc, char **argv) ...@@ -29,7 +29,7 @@ mail_setenv (int argc, char **argv)
29 char **p; 29 char **p;
30 30
31 for (p = environ; *p; p++) 31 for (p = environ; *p; p++)
32 mu_stream_printf (ostream, "%s\n", *p); 32 mu_printf ("%s\n", *p);
33 } 33 }
34 else 34 else
35 { 35 {
......
...@@ -35,7 +35,7 @@ expand_bang (char **pbuf) ...@@ -35,7 +35,7 @@ expand_bang (char **pbuf)
35 35
36 if (!last) 36 if (!last)
37 { 37 {
38 util_error (_("No previous command")); 38 mu_error (_("No previous command"));
39 return; 39 return;
40 } 40 }
41 41
......
...@@ -29,7 +29,7 @@ size0 (msgset_t *mspec, mu_message_t msg, void *data) ...@@ -29,7 +29,7 @@ size0 (msgset_t *mspec, mu_message_t msg, void *data)
29 mu_message_size (msg, &size); 29 mu_message_size (msg, &size);
30 mu_message_lines (msg, &lines); 30 mu_message_lines (msg, &lines);
31 31
32 mu_stream_printf (ostream, "%c%2lu %3lu/%-5lu\n", 32 mu_printf ("%c%2lu %3lu/%-5lu\n",
33 is_current_message (mspec->msg_part[0]) ? '>' : ' ', 33 is_current_message (mspec->msg_part[0]) ? '>' : ' ',
34 (unsigned long) mspec->msg_part[0], 34 (unsigned long) mspec->msg_part[0],
35 (unsigned long) lines, 35 (unsigned long) lines,
......
...@@ -55,7 +55,7 @@ mail_source (int argc, char **argv) ...@@ -55,7 +55,7 @@ mail_source (int argc, char **argv)
55 if (argc != 2) 55 if (argc != 2)
56 { 56 {
57 /* TRANSLATORS: 'source' is a command name. Do not translate it! */ 57 /* TRANSLATORS: 'source' is a command name. Do not translate it! */
58 util_error (_("source requires a single argument")); 58 mu_error (_("source requires a single argument"));
59 return 1; 59 return 1;
60 } 60 }
61 61
...@@ -63,7 +63,7 @@ mail_source (int argc, char **argv) ...@@ -63,7 +63,7 @@ mail_source (int argc, char **argv)
63 if (rc) 63 if (rc)
64 { 64 {
65 if (rc != ENOENT) 65 if (rc != ENOENT)
66 util_error(_("Cannot open `%s': %s"), argv[1], strerror (rc)); 66 mu_error(_("Cannot open `%s': %s"), argv[1], strerror (rc));
67 return 1; 67 return 1;
68 } 68 }
69 69
......
...@@ -24,20 +24,20 @@ show_part (struct mime_descend_closure *closure, void *data) ...@@ -24,20 +24,20 @@ show_part (struct mime_descend_closure *closure, void *data)
24 size_t width; 24 size_t width;
25 size_t size = 0; 25 size_t size = 0;
26 26
27 format_msgset (ostream, closure->msgset, &width); 27 format_msgset (mu_strout, closure->msgset, &width);
28 for (; width < 5; width++) 28 for (; width < 5; width++)
29 mu_stream_write (ostream, " ", 1, NULL); 29 mu_stream_write (mu_strout, " ", 1, NULL);
30 30
31 mu_stream_printf (ostream, " %-25s", closure->type); 31 mu_printf (" %-25s", closure->type);
32 32
33 mu_message_size (closure->message, &size); 33 mu_message_size (closure->message, &size);
34 if (size < 1024) 34 if (size < 1024)
35 mu_stream_printf (ostream, " %4lu", (unsigned long) size); 35 mu_printf (" %4lu", (unsigned long) size);
36 else if (size < 1024*1024) 36 else if (size < 1024*1024)
37 mu_stream_printf (ostream, "%4luK", (unsigned long) size / 1024); 37 mu_printf ("%4luK", (unsigned long) size / 1024);
38 else 38 else
39 mu_stream_printf (ostream, "%4luM", (unsigned long) size / 1024 / 1024); 39 mu_printf ("%4luM", (unsigned long) size / 1024 / 1024);
40 mu_stream_printf (ostream, "\n"); 40 mu_printf ("\n");
41 return 0; 41 return 0;
42 } 42 }
43 43
......
...@@ -60,20 +60,20 @@ mail_summary (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) ...@@ -60,20 +60,20 @@ mail_summary (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
60 { 60 {
61 mu_url_t url = NULL; 61 mu_url_t url = NULL;
62 mu_mailbox_get_url (mbox, &url); 62 mu_mailbox_get_url (mbox, &url);
63 mu_stream_printf (ostream, "\"%s\": ", util_url_to_string (url)); 63 mu_printf ("\"%s\": ", util_url_to_string (url));
64 } 64 }
65 mu_stream_printf (ostream, 65 mu_printf (
66 ngettext ("%d message", "%d messages", count), count); 66 ngettext ("%d message", "%d messages", count), count);
67 if (mnew > 0) 67 if (mnew > 0)
68 mu_stream_printf (ostream, ngettext (" %d new", " %d new", mnew), mnew); 68 mu_printf (ngettext (" %d new", " %d new", mnew), mnew);
69 if (mseen > 0) 69 if (mseen > 0)
70 mu_stream_printf (ostream, ngettext (" %d unread", " %d unread", mseen), 70 mu_printf (ngettext (" %d unread", " %d unread", mseen),
71 mseen); 71 mseen);
72 if (mdelete > 0) 72 if (mdelete > 0)
73 mu_stream_printf (ostream, 73 mu_printf (
74 ngettext (" %d deleted", " %d deleted", mdelete), 74 ngettext (" %d deleted", " %d deleted", mdelete),
75 mdelete); 75 mdelete);
76 mu_stream_printf (ostream, "\n"); 76 mu_printf ("\n");
77 77
78 /* Set the cursor. */ 78 /* Set the cursor. */
79 set_cursor ((first_new == 0) ? ((first_unread == 0) ? 79 set_cursor ((first_new == 0) ? ((first_unread == 0) ?
......
...@@ -39,7 +39,7 @@ top0 (msgset_t *mspec, mu_message_t msg, void *data) ...@@ -39,7 +39,7 @@ top0 (msgset_t *mspec, mu_message_t msg, void *data)
39 int status = mu_stream_getline (stream, &buf, &size, &n); 39 int status = mu_stream_getline (stream, &buf, &size, &n);
40 if (status != 0 || n == 0) 40 if (status != 0 || n == 0)
41 break; 41 break;
42 mu_stream_printf (ostream, "%s", buf); 42 mu_printf ("%s", buf);
43 } 43 }
44 free (buf); 44 free (buf);
45 mu_stream_destroy (&stream); 45 mu_stream_destroy (&stream);
......
...@@ -27,7 +27,7 @@ mail_unalias (int argc, char **argv) ...@@ -27,7 +27,7 @@ mail_unalias (int argc, char **argv)
27 if (argc == 1) 27 if (argc == 1)
28 { 28 {
29 /* TRANSLATORS: 'unalias' is a command name. Do not translate it! */ 29 /* TRANSLATORS: 'unalias' is a command name. Do not translate it! */
30 util_error (_("unalias requires at least one argument")); 30 mu_error (_("unalias requires at least one argument"));
31 return 1; 31 return 1;
32 } 32 }
33 while (--argc) 33 while (--argc)
......
...@@ -149,9 +149,9 @@ util_do_command (const char *fmt, ...) ...@@ -149,9 +149,9 @@ util_do_command (const char *fmt, ...)
149 else 149 else
150 { 150 {
151 if (argc) 151 if (argc)
152 util_error (_("Unknown command: %s"), argv[0]); 152 mu_error (_("Unknown command: %s"), argv[0]);
153 else 153 else
154 util_error (_("Invalid command")); 154 mu_error (_("Invalid command"));
155 status = 1; 155 status = 1;
156 } 156 }
157 157
...@@ -218,7 +218,7 @@ util_range_msg (size_t low, size_t high, int flags, ...@@ -218,7 +218,7 @@ util_range_msg (size_t low, size_t high, int flags,
218 if ((flags & MSG_NODELETED) && util_isdeleted (low)) 218 if ((flags & MSG_NODELETED) && util_isdeleted (low))
219 { 219 {
220 if (!(flags & MSG_SILENT)) 220 if (!(flags & MSG_SILENT))
221 util_error (_("%lu: Inappropriate message (has been deleted)"), 221 mu_error (_("%lu: Inappropriate message (has been deleted)"),
222 (unsigned long) low); 222 (unsigned long) low);
223 continue; 223 continue;
224 } 224 }
...@@ -300,11 +300,11 @@ util_help (void *table, size_t nmemb, size_t size, const char *word) ...@@ -300,11 +300,11 @@ util_help (void *table, size_t nmemb, size_t size, const char *word)
300 int status = 0; 300 int status = 0;
301 struct mail_command *cp = util_find_entry (table, nmemb, size, word); 301 struct mail_command *cp = util_find_entry (table, nmemb, size, word);
302 if (cp && cp->synopsis) 302 if (cp && cp->synopsis)
303 mu_stream_printf (ostream, "%s\n", cp->synopsis); 303 mu_printf ("%s\n", cp->synopsis);
304 else 304 else
305 { 305 {
306 status = 1; 306 status = 1;
307 mu_stream_printf (ostream, _("Unknown command: %s\n"), word); 307 mu_printf (_("Unknown command: %s\n"), word);
308 } 308 }
309 return status; 309 return status;
310 } 310 }
...@@ -337,12 +337,12 @@ util_command_list (void *table, size_t nmemb, size_t size) ...@@ -337,12 +337,12 @@ util_command_list (void *table, size_t nmemb, size_t size)
337 if (pos >= cols) 337 if (pos >= cols)
338 { 338 {
339 pos = len + 1; 339 pos = len + 1;
340 mu_stream_printf (ostream, "\n%s ", cmd); 340 mu_printf ("\n%s ", cmd);
341 } 341 }
342 else 342 else
343 mu_stream_printf (ostream, "%s ", cmd); 343 mu_printf ("%s ", cmd);
344 } 344 }
345 mu_stream_printf (ostream, "\n"); 345 mu_printf ("\n");
346 return 0; 346 return 0;
347 } 347 }
348 348
...@@ -471,7 +471,7 @@ util_get_homedir () ...@@ -471,7 +471,7 @@ util_get_homedir ()
471 if (!homedir) 471 if (!homedir)
472 { 472 {
473 /* Shouldn't happen, but one never knows */ 473 /* Shouldn't happen, but one never knows */
474 util_error (_("Cannot get homedir")); 474 mu_error (_("Cannot get homedir"));
475 exit (EXIT_FAILURE); 475 exit (EXIT_FAILURE);
476 } 476 }
477 return homedir; 477 return homedir;
...@@ -535,14 +535,14 @@ util_get_sender (int msgno, int strip) ...@@ -535,14 +535,14 @@ util_get_sender (int msgno, int strip)
535 if (mu_envelope_sget_sender (env, &buffer) 535 if (mu_envelope_sget_sender (env, &buffer)
536 || mu_address_create (&addr, buffer)) 536 || mu_address_create (&addr, buffer))
537 { 537 {
538 util_error (_("Cannot determine sender name (msg %d)"), msgno); 538 mu_error (_("Cannot determine sender name (msg %d)"), msgno);
539 return NULL; 539 return NULL;
540 } 540 }
541 } 541 }
542 542
543 if (mu_address_aget_email (addr, 1, &buf)) 543 if (mu_address_aget_email (addr, 1, &buf))
544 { 544 {
545 util_error (_("Cannot determine sender name (msg %d)"), msgno); 545 mu_error (_("Cannot determine sender name (msg %d)"), msgno);
546 mu_address_destroy (&addr); 546 mu_address_destroy (&addr);
547 return NULL; 547 return NULL;
548 } 548 }
...@@ -570,7 +570,7 @@ util_slist_print (mu_list_t list, int nl) ...@@ -570,7 +570,7 @@ util_slist_print (mu_list_t list, int nl)
570 for (mu_iterator_first (itr); !mu_iterator_is_done (itr); mu_iterator_next (itr)) 570 for (mu_iterator_first (itr); !mu_iterator_is_done (itr); mu_iterator_next (itr))
571 { 571 {
572 mu_iterator_current (itr, (void **)&name); 572 mu_iterator_current (itr, (void **)&name);
573 mu_stream_printf (ostream, "%s%c", name, nl ? '\n' : ' '); 573 mu_printf ("%s%c", name, nl ? '\n' : ' ');
574 } 574 }
575 mu_iterator_destroy (&itr); 575 mu_iterator_destroy (&itr);
576 } 576 }
...@@ -725,7 +725,7 @@ util_save_outgoing (mu_message_t msg, char *savefile) ...@@ -725,7 +725,7 @@ util_save_outgoing (mu_message_t msg, char *savefile)
725 rc = mu_mailbox_create_default (&outbox, filename); 725 rc = mu_mailbox_create_default (&outbox, filename);
726 if (rc) 726 if (rc)
727 { 727 {
728 util_error (_("Cannot create output mailbox `%s': %s"), 728 mu_error (_("Cannot create output mailbox `%s': %s"),
729 filename, strerror (rc)); 729 filename, strerror (rc));
730 free (filename); 730 free (filename);
731 return; 731 return;
...@@ -733,13 +733,13 @@ util_save_outgoing (mu_message_t msg, char *savefile) ...@@ -733,13 +733,13 @@ util_save_outgoing (mu_message_t msg, char *savefile)
733 733
734 rc = mu_mailbox_open (outbox, MU_STREAM_WRITE | MU_STREAM_CREAT); 734 rc = mu_mailbox_open (outbox, MU_STREAM_WRITE | MU_STREAM_CREAT);
735 if (rc) 735 if (rc)
736 util_error (_("Cannot open output mailbox `%s': %s"), 736 mu_error (_("Cannot open output mailbox `%s': %s"),
737 filename, strerror (rc)); 737 filename, strerror (rc));
738 else 738 else
739 { 739 {
740 rc = mu_mailbox_append_message (outbox, msg); 740 rc = mu_mailbox_append_message (outbox, msg);
741 if (rc) 741 if (rc)
742 util_error (_("Cannot append message to `%s': %s"), 742 mu_error (_("Cannot append message to `%s': %s"),
743 filename, strerror (rc)); 743 filename, strerror (rc));
744 } 744 }
745 745
...@@ -750,19 +750,6 @@ util_save_outgoing (mu_message_t msg, char *savefile) ...@@ -750,19 +750,6 @@ util_save_outgoing (mu_message_t msg, char *savefile)
750 } 750 }
751 } 751 }
752 752
753 void
754 util_error (const char *format, ...)
755 {
756 va_list ap;
757
758 va_start (ap, format);
759
760 mu_stream_vprintf (mu_strerr, format, ap);
761 mu_stream_printf (mu_strerr, "\n");
762
763 va_end(ap);
764 }
765
766 static int 753 static int
767 util_descend_subparts (mu_message_t mesg, msgset_t *msgset, mu_message_t *part) 754 util_descend_subparts (mu_message_t mesg, msgset_t *msgset, mu_message_t *part)
768 { 755 {
...@@ -781,7 +768,7 @@ util_descend_subparts (mu_message_t mesg, msgset_t *msgset, mu_message_t *part) ...@@ -781,7 +768,7 @@ util_descend_subparts (mu_message_t mesg, msgset_t *msgset, mu_message_t *part)
781 { 768 {
782 if (mu_message_unencapsulate (mesg, &submsg, NULL)) 769 if (mu_message_unencapsulate (mesg, &submsg, NULL))
783 { 770 {
784 util_error (_("Cannot unencapsulate message/part")); 771 mu_error (_("Cannot unencapsulate message/part"));
785 return 1; 772 return 1;
786 } 773 }
787 mesg = submsg; 774 mesg = submsg;
...@@ -790,14 +777,14 @@ util_descend_subparts (mu_message_t mesg, msgset_t *msgset, mu_message_t *part) ...@@ -790,14 +777,14 @@ util_descend_subparts (mu_message_t mesg, msgset_t *msgset, mu_message_t *part)
790 mu_message_get_num_parts (mesg, &nparts); 777 mu_message_get_num_parts (mesg, &nparts);
791 if (nparts < msgset->msg_part[i]) 778 if (nparts < msgset->msg_part[i])
792 { 779 {
793 util_error (_("No such (sub)part in the message: %lu"), 780 mu_error (_("No such (sub)part in the message: %lu"),
794 (unsigned long) msgset->msg_part[i]); 781 (unsigned long) msgset->msg_part[i]);
795 return 1; 782 return 1;
796 } 783 }
797 784
798 if (mu_message_get_part (mesg, msgset->msg_part[i], &submsg)) 785 if (mu_message_get_part (mesg, msgset->msg_part[i], &submsg))
799 { 786 {
800 util_error (_("Cannot get (sub)part from the message: %lu"), 787 mu_error (_("Cannot get (sub)part from the message: %lu"),
801 (unsigned long) msgset->msg_part[i]); 788 (unsigned long) msgset->msg_part[i]);
802 return 1; 789 return 1;
803 } 790 }
...@@ -925,7 +912,7 @@ util_header_expand (mu_header_t *phdr) ...@@ -925,7 +912,7 @@ util_header_expand (mu_header_t *phdr)
925 rc = mu_header_create (&hdr, "", 0); 912 rc = mu_header_create (&hdr, "", 0);
926 if (rc) 913 if (rc)
927 { 914 {
928 util_error (_("Cannot create temporary header: %s"), mu_strerror (rc)); 915 mu_error (_("Cannot create temporary header: %s"), mu_strerror (rc));
929 return 1; 916 return 1;
930 } 917 }
931 918
...@@ -977,10 +964,10 @@ util_header_expand (mu_header_t *phdr) ...@@ -977,10 +964,10 @@ util_header_expand (mu_header_t *phdr)
977 { 964 {
978 errcnt++; 965 errcnt++;
979 if (exp) 966 if (exp)
980 util_error (_("Cannot parse address `%s' (while expanding `%s'): %s"), 967 mu_error (_("Cannot parse address `%s' (while expanding `%s'): %s"),
981 exp, p, mu_strerror (rc)); 968 exp, p, mu_strerror (rc));
982 else 969 else
983 util_error (_("Cannot parse address `%s': %s"), 970 mu_error (_("Cannot parse address `%s': %s"),
984 p, mu_strerror (rc)); 971 p, mu_strerror (rc));
985 } 972 }
986 973
...@@ -1030,7 +1017,7 @@ util_get_message (mu_mailbox_t mbox, size_t msgno, mu_message_t *msg) ...@@ -1030,7 +1017,7 @@ util_get_message (mu_mailbox_t mbox, size_t msgno, mu_message_t *msg)
1030 status = mu_mailbox_get_message (mbox, msgno, msg); 1017 status = mu_mailbox_get_message (mbox, msgno, msg);
1031 if (status) 1018 if (status)
1032 { 1019 {
1033 util_error (_("Cannot get message %lu: %s"), 1020 mu_error (_("Cannot get message %lu: %s"),
1034 (unsigned long) msgno, mu_strerror (status)); 1021 (unsigned long) msgno, mu_strerror (status));
1035 return status; 1022 return status;
1036 } 1023 }
...@@ -1041,14 +1028,14 @@ util_get_message (mu_mailbox_t mbox, size_t msgno, mu_message_t *msg) ...@@ -1041,14 +1028,14 @@ util_get_message (mu_mailbox_t mbox, size_t msgno, mu_message_t *msg)
1041 int 1028 int
1042 util_error_range (size_t msgno) 1029 util_error_range (size_t msgno)
1043 { 1030 {
1044 util_error (_("%lu: invalid message number"), (unsigned long) msgno); 1031 mu_error (_("%lu: invalid message number"), (unsigned long) msgno);
1045 return 1; 1032 return 1;
1046 } 1033 }
1047 1034
1048 void 1035 void
1049 util_noapp () 1036 util_noapp ()
1050 { 1037 {
1051 util_error (_("No applicable messages")); 1038 mu_error (_("No applicable messages"));
1052 } 1039 }
1053 1040
1054 void 1041 void
...@@ -1162,13 +1149,13 @@ open_pager (size_t lines) ...@@ -1162,13 +1149,13 @@ open_pager (size_t lines)
1162 { 1149 {
1163 mu_diag_funcall (MU_DIAG_ERROR, "mu_prog_stream_create", 1150 mu_diag_funcall (MU_DIAG_ERROR, "mu_prog_stream_create",
1164 pager, rc); 1151 pager, rc);
1165 str = ostream; 1152 str = mu_strout;
1166 mu_stream_ref (str); 1153 mu_stream_ref (str);
1167 } 1154 }
1168 } 1155 }
1169 else 1156 else
1170 { 1157 {
1171 str = ostream; 1158 str = mu_strout;
1172 mu_stream_ref (str); 1159 mu_stream_ref (str);
1173 } 1160 }
1174 return str; 1161 return str;
......
...@@ -39,16 +39,16 @@ static const char *with_defs[] = ...@@ -39,16 +39,16 @@ static const char *with_defs[] =
39 int 39 int
40 mail_version (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) 40 mail_version (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
41 { 41 {
42 mu_stream_printf (ostream, "%s", program_version); 42 mu_printf ("%s", program_version);
43 if (with_defs[0] != NULL) 43 if (with_defs[0] != NULL)
44 { 44 {
45 int i; 45 int i;
46 mu_stream_printf (ostream, " ("); 46 mu_printf (" (");
47 for (i = 0; with_defs[i]; i++) 47 for (i = 0; with_defs[i]; i++)
48 mu_stream_printf (ostream, " %s", with_defs[i]); 48 mu_printf (" %s", with_defs[i]);
49 mu_stream_printf (ostream, " )"); 49 mu_printf (" )");
50 } 50 }
51 mu_stream_printf (ostream, "\n"); 51 mu_printf ("\n");
52 52
53 return 0; 53 return 0;
54 } 54 }
......
...@@ -43,7 +43,7 @@ mail_write (int argc, char **argv) ...@@ -43,7 +43,7 @@ mail_write (int argc, char **argv)
43 char *p = NULL; 43 char *p = NULL;
44 if (n == 0) 44 if (n == 0)
45 { 45 {
46 util_error (_("No applicable message")); 46 mu_error (_("No applicable message"));
47 return 1; 47 return 1;
48 } 48 }
49 mu_asprintf (&p, "%lu", (unsigned long) n); 49 mu_asprintf (&p, "%lu", (unsigned long) n);
...@@ -72,7 +72,7 @@ mail_write (int argc, char **argv) ...@@ -72,7 +72,7 @@ mail_write (int argc, char **argv)
72 MU_STREAM_APPEND|MU_STREAM_CREAT); 72 MU_STREAM_APPEND|MU_STREAM_CREAT);
73 if (rc) 73 if (rc)
74 { 74 {
75 util_error (_("can't open %s: %s"), filename, mu_strerror (rc)); 75 mu_error (_("can't open %s: %s"), filename, mu_strerror (rc));
76 free (filename); 76 free (filename);
77 msgset_free (msglist); 77 msgset_free (msglist);
78 return 1; 78 return 1;
...@@ -114,7 +114,7 @@ mail_write (int argc, char **argv) ...@@ -114,7 +114,7 @@ mail_write (int argc, char **argv)
114 mu_stream_close (output); 114 mu_stream_close (output);
115 mu_stream_destroy (&output); 115 mu_stream_destroy (&output);
116 116
117 mu_stream_printf (ostream, "\"%s\" %3lu/%-5lu\n", filename, 117 mu_printf ("\"%s\" %3lu/%-5lu\n", filename,
118 (unsigned long) total_lines, (unsigned long) total_size); 118 (unsigned long) total_lines, (unsigned long) total_size);
119 119
120 free (filename); 120 free (filename);
......
...@@ -61,7 +61,7 @@ z_parse_args(int argc, char **argv, ...@@ -61,7 +61,7 @@ z_parse_args(int argc, char **argv,
61 dir = D_NONE; 61 dir = D_NONE;
62 break; 62 break;
63 default: 63 default:
64 util_error (_("Bad arguments for the scrolling command")); 64 mu_error (_("Bad arguments for the scrolling command"));
65 return 1; 65 return 1;
66 } 66 }
67 67
...@@ -76,7 +76,7 @@ z_parse_args(int argc, char **argv, ...@@ -76,7 +76,7 @@ z_parse_args(int argc, char **argv,
76 76
77 if (argc > 1) 77 if (argc > 1)
78 { 78 {
79 util_error (_("Too many arguments for the scrolling command")); 79 mu_error (_("Too many arguments for the scrolling command"));
80 return 1; 80 return 1;
81 } 81 }
82 82
...@@ -84,13 +84,13 @@ z_parse_args(int argc, char **argv, ...@@ -84,13 +84,13 @@ z_parse_args(int argc, char **argv,
84 { 84 {
85 if (dir == D_NONE) 85 if (dir == D_NONE)
86 { 86 {
87 util_error (_("Argument not applicable for z")); 87 mu_error (_("Argument not applicable for z"));
88 return 1; 88 return 1;
89 } 89 }
90 90
91 if ((mul = strtoul (argp, NULL, 10)) == 0) 91 if ((mul = strtoul (argp, NULL, 10)) == 0)
92 { 92 {
93 util_error (_("Bad number of pages")); 93 mu_error (_("Bad number of pages"));
94 return 1; 94 return 1;
95 } 95 }
96 } 96 }
...@@ -120,7 +120,7 @@ mail_z (int argc, char **argv) ...@@ -120,7 +120,7 @@ mail_z (int argc, char **argv)
120 case D_BWD: 120 case D_BWD:
121 if (page_move (-count) == 0) 121 if (page_move (-count) == 0)
122 { 122 {
123 mu_stream_printf (ostream, _("On first screenful of messages\n")); 123 mu_printf (_("On first screenful of messages\n"));
124 return 0; 124 return 0;
125 } 125 }
126 break; 126 break;
...@@ -128,7 +128,7 @@ mail_z (int argc, char **argv) ...@@ -128,7 +128,7 @@ mail_z (int argc, char **argv)
128 case D_FWD: 128 case D_FWD:
129 if (page_move (count) == 0) 129 if (page_move (count) == 0)
130 { 130 {
131 mu_stream_printf (ostream, _("On last screenful of messages\n")); 131 mu_printf (_("On last screenful of messages\n"));
132 return 0; 132 return 0;
133 } 133 }
134 break; 134 break;
......