1 |
/* GNU mailutils - a suite of utilities for electronic mail |
/* GNU Mailutils -- a suite of utilities for electronic mail |
2 |
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. |
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
GNU Mailutils is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
6 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
7 |
any later version. |
any later version. |
8 |
|
|
9 |
This program is distributed in the hope that it will be useful, |
GNU Mailutils is distributed in the hope that it will be useful, |
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
GNU General Public License for more details. |
GNU General Public License for more details. |
13 |
|
|
14 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
15 |
along with this program; if not, write to the Free Software |
along with GNU Mailutils; if not, write to the Free Software |
16 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
17 |
|
|
18 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
29 |
static int string_starts_with __P ((const char * s1, const char *s2)); |
static int string_starts_with __P ((const char * s1, const char *s2)); |
30 |
|
|
31 |
const char *argp_program_version = "readmsg (" PACKAGE_STRING ")"; |
const char *argp_program_version = "readmsg (" PACKAGE_STRING ")"; |
32 |
static char doc[] = "GNU readmsg -- print messages"; |
static char doc[] = N_("GNU readmsg -- print messages"); |
33 |
static error_t readmsg_parse_opt __P((int key, char *arg, |
static error_t readmsg_parse_opt __P((int key, char *arg, |
34 |
struct argp_state *astate)); |
struct argp_state *astate)); |
35 |
|
|
36 |
static struct argp_option options[] = |
static struct argp_option options[] = |
37 |
{ |
{ |
38 |
{ "debug", 'd', 0, 0, "Display debugging information", 1 }, |
{ "debug", 'd', 0, 0, N_("Display debugging information"), 1 }, |
39 |
{ "header", 'h', 0, 0, "Display entire header", 1 }, |
{ "header", 'h', 0, 0, N_("Display entire header"), 1 }, |
40 |
{ "weedlist", 'w', "LIST", 0, "List of header names separated by whitespace or commas", 1 }, |
{ "weedlist", 'w', "LIST", 0, |
41 |
{ "folder", 'f', "FOLDER", 0, "Folder to use", 1 }, |
N_("List of header names separated by whitespace or commas"), 1 }, |
42 |
{ "no-header", 'n', 0, 0, "Exclude all headers", 1 }, |
{ "folder", 'f', "FOLDER", 0, N_("Folder to use"), 1 }, |
43 |
{ "form-feeds", 'p', 0, 0, "Output formfeeds between messages", 1 }, |
{ "no-header", 'n', 0, 0, N_("Exclude all headers"), 1 }, |
44 |
|
{ "form-feeds", 'p', 0, 0, N_("Output formfeeds between messages"), 1 }, |
45 |
{ "show-all-match", 'a', NULL, 0, |
{ "show-all-match", 'a', NULL, 0, |
46 |
"Print all messages matching pattern, not just the first", 1 }, |
N_("Print all messages matching pattern, not just the first"), 1 }, |
47 |
{0, 0, 0, 0} |
{0, 0, 0, 0} |
48 |
}; |
}; |
49 |
|
|
225 |
int index; |
int index; |
226 |
mailbox_t mbox = NULL; |
mailbox_t mbox = NULL; |
227 |
|
|
228 |
|
/* Native Language Support */ |
229 |
|
mu_init_nls (); |
230 |
|
|
231 |
mu_argp_parse (&argp, &argc, &argv, 0, readmsg_argp_capa, &index, NULL); |
mu_argp_parse (&argp, &argc, &argv, 0, readmsg_argp_capa, &index, NULL); |
232 |
|
|
233 |
/* Registration. */ |
/* Registration. */ |
243 |
status = mailbox_create_default (&mbox, mailbox_name); |
status = mailbox_create_default (&mbox, mailbox_name); |
244 |
if (status != 0) |
if (status != 0) |
245 |
{ |
{ |
246 |
fprintf (stderr, "could not create - %s\n", mu_errstring(status)); |
fprintf (stderr, _("could not create - %s\n"), mu_errstring(status)); |
247 |
exit (2); |
exit (2); |
248 |
} |
} |
249 |
|
|
261 |
url_t url = NULL; |
url_t url = NULL; |
262 |
|
|
263 |
mailbox_get_url (mbox, &url); |
mailbox_get_url (mbox, &url); |
264 |
fprintf (stderr, "can't open mailbox %s: %s\n", |
fprintf (stderr, _("can't open mailbox %s: %s\n"), |
265 |
url_to_string (url), |
url_to_string (url), |
266 |
mu_errstring(status)); |
mu_errstring(status)); |
267 |
exit (2); |
exit (2); |