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 |
38 |
#include <mailutils/registrar.h> |
#include <mailutils/registrar.h> |
39 |
#include <mailutils/stream.h> |
#include <mailutils/stream.h> |
40 |
#include <mailutils/url.h> |
#include <mailutils/url.h> |
41 |
|
#include <mailutils/nls.h> |
42 |
|
|
43 |
static char* show_field; |
static char* show_field; |
44 |
static int show_to; |
static int show_to; |
61 |
static int action (observer_t, size_t); |
static int action (observer_t, size_t); |
62 |
|
|
63 |
const char *argp_program_version = "frm (" PACKAGE_STRING ")"; |
const char *argp_program_version = "frm (" PACKAGE_STRING ")"; |
64 |
static char doc[] = "GNU frm -- display From: lines"; |
static char doc[] = N_("GNU frm -- display From: lines"); |
65 |
|
|
66 |
static struct argp_option options[] = { |
static struct argp_option options[] = { |
67 |
{"debug", 'd', NULL, 0, "Enable debugging output", 0}, |
{"debug", 'd', NULL, 0, N_("Enable debugging output"), 0}, |
68 |
{"field", 'f', "NAME", 0, "Header field to display", 0}, |
{"field", 'f', "NAME", 0, N_("Header field to display"), 0}, |
69 |
{"to", 'l', NULL, 0, "Include the To: information", 0}, |
{"to", 'l', NULL, 0, N_("Include the To: information"), 0}, |
70 |
{"number", 'n', NULL, 0, "Display message numbers", 0}, |
{"number", 'n', NULL, 0, N_("Display message numbers"), 0}, |
71 |
{"Quiet", 'Q', NULL, 0, "Very quiet", 0}, |
{"Quiet", 'Q', NULL, 0, N_("Very quiet"), 0}, |
72 |
{"query", 'q', NULL, 0, "Print a message if unread mail", 0}, |
{"query", 'q', NULL, 0, N_("Print a message if unread mail"), 0}, |
73 |
{"summary",'S', NULL, 0, "Print a summary of messages", 0}, |
{"summary",'S', NULL, 0, N_("Print a summary of messages"), 0}, |
74 |
{"status", 's', "[nor]",0, |
{"status", 's', "[nor]",0, |
75 |
"Select message with the specific attribute: [n]ew, [r]ead, [u]nread.", 0 }, |
N_("Select message with the specific attribute: [n]ew, [r]ead, [u]nread."), 0 }, |
76 |
{"align", 't', NULL, 0, "Try to align", 0}, |
{"align", 't', NULL, 0, N_("Try to align"), 0}, |
77 |
{0, 0, 0, 0} |
{0, 0, 0, 0} |
78 |
}; |
}; |
79 |
|
|
106 |
be_quiet += 2; |
be_quiet += 2; |
107 |
if (freopen("/dev/null", "w", stdout) == NULL) |
if (freopen("/dev/null", "w", stdout) == NULL) |
108 |
{ |
{ |
109 |
perror ("Can not be very quiet"); |
perror (_("Can not be very quiet")); |
110 |
exit (3); |
exit (3); |
111 |
} |
} |
112 |
break; |
break; |
302 |
size_t total = 0; |
size_t total = 0; |
303 |
int c; |
int c; |
304 |
int status = 0; |
int status = 0; |
305 |
|
|
306 |
|
/* Native Language Support */ |
307 |
|
mu_init_nls (); |
308 |
|
|
309 |
mu_argp_parse (&argp, &argc, &argv, 0, frm_argp_capa, &c, NULL); |
mu_argp_parse (&argp, &argc, &argv, 0, frm_argp_capa, &c, NULL); |
310 |
|
|
311 |
/* have an argument */ |
/* have an argument */ |
335 |
|
|
336 |
if (status != 0) |
if (status != 0) |
337 |
{ |
{ |
338 |
fprintf (stderr, "could not create mailbox <%s>: %s\n", |
fprintf (stderr, _("could not create mailbox <%s>: %s\n"), |
339 |
mailbox_name ? mailbox_name : "default", |
mailbox_name ? mailbox_name : _("default"), |
340 |
mu_errstring(status)); |
mu_errstring(status)); |
341 |
exit (3); |
exit (3); |
342 |
} |
} |
359 |
goto cleanup1; |
goto cleanup1; |
360 |
else |
else |
361 |
{ |
{ |
362 |
fprintf (stderr, "could not open mailbox %s: %s\n", |
fprintf (stderr, _("could not open mailbox %s: %s\n"), |
363 |
url_to_string (url), |
url_to_string (url), |
364 |
mu_errstring(status)); |
mu_errstring(status)); |
365 |
|
|
382 |
url_t url = NULL; |
url_t url = NULL; |
383 |
|
|
384 |
mailbox_get_url (mbox, &url); |
mailbox_get_url (mbox, &url); |
385 |
fprintf (stderr, "could not scan mailbox <%s>: %s\n", |
fprintf (stderr, _("could not scan mailbox <%s>: %s\n"), |
386 |
url_to_string (url), |
url_to_string (url), |
387 |
mu_errstring(status)); |
mu_errstring(status)); |
388 |
goto cleanup; |
goto cleanup; |
403 |
|
|
404 |
cleanup1: |
cleanup1: |
405 |
if (show_summary) |
if (show_summary) |
406 |
printf ("You have %d messages\n", total); |
printf (_("You have %d messages\n"), total); |
407 |
if (show_query && have_new_mail) |
if (show_query && have_new_mail) |
408 |
printf ("You have new mail\n"); |
printf (_("You have new mail\n")); |
409 |
|
|
410 |
/* 0 - selected messages discover. |
/* 0 - selected messages discover. |
411 |
1 - have messages. |
1 - have messages. |