Commit 594e5f5c 594e5f5cccebdde93f349605998486280aca311c by Sergey Poznyakoff

Use mu_error instead of fprintf

1 parent 2fce3d14
...@@ -72,7 +72,7 @@ N_("GNU mail.remote -- pseudo-sendmail interface for mail delivery\n" ...@@ -72,7 +72,7 @@ N_("GNU mail.remote -- pseudo-sendmail interface for mail delivery\n"
72 "the data part of the protocol transaction will also be printed to stdout.\n"); 72 "the data part of the protocol transaction will also be printed to stdout.\n");
73 73
74 static struct argp_option options[] = { 74 static struct argp_option options[] = {
75 {"from", 'f', N_("ADDR"), 0, N_("Override the default from address\n")}, 75 {"from", 'f', N_("ADDR"), 0, N_("Override the default from address")},
76 {"debug", 'd', NULL, 0, N_("Enable debugging output")}, 76 {"debug", 'd', NULL, 0, N_("Enable debugging output")},
77 { 0, 'o', "OPT", OPTION_HIDDEN, N_("Ignored for sendmail compatibility")}, 77 { 0, 'o', "OPT", OPTION_HIDDEN, N_("Ignored for sendmail compatibility")},
78 {0} 78 {0}
...@@ -148,7 +148,7 @@ main (int argc, char **argv) ...@@ -148,7 +148,7 @@ main (int argc, char **argv)
148 { 148 {
149 if ((status = address_create (&from, optfrom))) 149 if ((status = address_create (&from, optfrom)))
150 { 150 {
151 fprintf (stderr, _("Parsing from addresses failed: %s\n"), 151 mu_error (_("Parsing from addresses failed: %s"),
152 mu_strerror (status)); 152 mu_strerror (status));
153 goto end; 153 goto end;
154 } 154 }
...@@ -160,7 +160,7 @@ main (int argc, char **argv) ...@@ -160,7 +160,7 @@ main (int argc, char **argv)
160 160
161 if ((status = address_createv (&to, (const char **) av, -1))) 161 if ((status = address_createv (&to, (const char **) av, -1)))
162 { 162 {
163 fprintf (stderr, _("Parsing to addresses failed: %s\n"), 163 mu_error (_("Parsing to addresses failed: %s"),
164 mu_strerror (status)); 164 mu_strerror (status));
165 goto end; 165 goto end;
166 } 166 }
...@@ -168,26 +168,25 @@ main (int argc, char **argv) ...@@ -168,26 +168,25 @@ main (int argc, char **argv)
168 168
169 if ((status = stdio_stream_create (&in, stdin, MU_STREAM_SEEKABLE))) 169 if ((status = stdio_stream_create (&in, stdin, MU_STREAM_SEEKABLE)))
170 { 170 {
171 fprintf (stderr, _("Failed: %s\n"), mu_strerror (status)); 171 mu_error (_("Failed: %s"), mu_strerror (status));
172 goto end; 172 goto end;
173 } 173 }
174 174
175 if ((status = stream_open (in))) 175 if ((status = stream_open (in)))
176 { 176 {
177 fprintf (stderr, _("Opening stdin failed: %s\n"), mu_strerror (status)); 177 mu_error (_("Opening stdin failed: %s"), mu_strerror (status));
178 goto end; 178 goto end;
179 } 179 }
180 180
181 if ((status = message_create (&msg, NULL))) 181 if ((status = message_create (&msg, NULL)))
182 { 182 {
183 fprintf (stderr, _("Failed: %s\n"), mu_strerror (status)); 183 mu_error (_("Failed: %s"), mu_strerror (status));
184 goto end; 184 goto end;
185 } 185 }
186 186
187 if ((status = message_set_stream (msg, in, NULL))) 187 if ((status = message_set_stream (msg, in, NULL)))
188 { 188 {
189 fprintf (stderr, _("Failed: %s\n"), 189 mu_error (_("Failed: %s"), mu_strerror (status));
190 mu_strerror (status));
191 goto end; 190 goto end;
192 } 191 }
193 192
...@@ -195,7 +194,7 @@ main (int argc, char **argv) ...@@ -195,7 +194,7 @@ main (int argc, char **argv)
195 { 194 {
196 const char *url = NULL; 195 const char *url = NULL;
197 mailer_get_url_default (&url); 196 mailer_get_url_default (&url);
198 fprintf (stderr, _("Creating mailer '%s' failed: %s\n"), 197 mu_error (_("Creating mailer '%s' failed: %s"),
199 url, mu_strerror (status)); 198 url, mu_strerror (status));
200 goto end; 199 goto end;
201 } 200 }
...@@ -214,20 +213,20 @@ main (int argc, char **argv) ...@@ -214,20 +213,20 @@ main (int argc, char **argv)
214 { 213 {
215 const char *url = NULL; 214 const char *url = NULL;
216 mailer_get_url_default (&url); 215 mailer_get_url_default (&url);
217 fprintf (stderr, _("Opening mailer '%s' failed: %s\n"), 216 mu_error (_("Opening mailer '%s' failed: %s"),
218 url, mu_strerror (status)); 217 url, mu_strerror (status));
219 goto end; 218 goto end;
220 } 219 }
221 220
222 if ((status = mailer_send_message (mailer, msg, from, to))) 221 if ((status = mailer_send_message (mailer, msg, from, to)))
223 { 222 {
224 fprintf (stderr, _("Sending message failed: %s\n"), mu_strerror (status)); 223 mu_error (_("Sending message failed: %s"), mu_strerror (status));
225 goto end; 224 goto end;
226 } 225 }
227 226
228 if ((status = mailer_close (mailer))) 227 if ((status = mailer_close (mailer)))
229 { 228 {
230 fprintf (stderr, _("Closing mailer failed: %s\n"), mu_strerror (status)); 229 mu_error (_("Closing mailer failed: %s"), mu_strerror (status));
231 goto end; 230 goto end;
232 } 231 }
233 232
......
...@@ -243,7 +243,8 @@ main (int argc, char **argv) ...@@ -243,7 +243,8 @@ main (int argc, char **argv)
243 status = mailbox_create_default (&mbox, mailbox_name); 243 status = mailbox_create_default (&mbox, mailbox_name);
244 if (status != 0) 244 if (status != 0)
245 { 245 {
246 fprintf (stderr, _("could not create - %s\n"), mu_strerror(status)); 246 mu_error (_("could not create mailbox: %s"),
247 mu_strerror(status));
247 exit (2); 248 exit (2);
248 } 249 }
249 250
...@@ -261,7 +262,7 @@ main (int argc, char **argv) ...@@ -261,7 +262,7 @@ main (int argc, char **argv)
261 url_t url = NULL; 262 url_t url = NULL;
262 263
263 mailbox_get_url (mbox, &url); 264 mailbox_get_url (mbox, &url);
264 fprintf (stderr, _("can't open mailbox %s: %s\n"), 265 mu_error (_("can't open mailbox %s: %s"),
265 url_to_string (url), 266 url_to_string (url),
266 mu_strerror(status)); 267 mu_strerror(status));
267 exit (2); 268 exit (2);
...@@ -282,7 +283,7 @@ main (int argc, char **argv) ...@@ -282,7 +283,7 @@ main (int argc, char **argv)
282 status = mailbox_get_message (mbox, set[i], &msg); 283 status = mailbox_get_message (mbox, set[i], &msg);
283 if (status != 0) 284 if (status != 0)
284 { 285 {
285 fprintf (stderr, "mailbox_get_message - %s\n", 286 mu_error ("mailbox_get_message: %s",
286 mu_strerror (status)); 287 mu_strerror (status));
287 exit (2); 288 exit (2);
288 } 289 }
......