/[mailutils]/mailutils/mh/inc.c
ViewVC logotype

Diff of /mailutils/mh/inc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by gray, Thu Dec 12 14:35:44 2002 UTC revision 1.14 by polak, Thu Dec 26 20:51:06 2002 UTC
# Line 1  Line 1 
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  /* MH inc command */  /* MH inc command */
# Line 21  Line 21 
21    
22  const char *argp_program_version = "inc (" PACKAGE_STRING ")";  const char *argp_program_version = "inc (" PACKAGE_STRING ")";
23  static char doc[] = "GNU MH inc";  static char doc[] = "GNU MH inc";
24  static char args_doc[] = "[+folder]";  static char args_doc[] = N_("[+folder]");
25    
26  /* GNU options */  /* GNU options */
27  static struct argp_option options[] = {  static struct argp_option options[] = {
28    {"file",    'i', "FILE",   0, "Inorporate mail from named file"},    {"file",    'i', "FILE",   0, N_("Inorporate mail from named file")},
29    {"folder",  'f', "FOLDER", 0, "Specify folder to incorporate mail to"},    {"folder",  'f', "FOLDER", 0, N_("Specify folder to incorporate mail to")},
30    {"audit",   'a', "FILE", 0, "Enable audit"},    {"audit",   'a', "FILE", 0, N_("Enable audit")},
31    {"noaudit", 'n', 0, 0, "Disable audit"},    {"noaudit", 'n', 0, 0, N_("Disable audit")},
32    {"changecur", 'c', "BOOL", OPTION_ARG_OPTIONAL, "Mark first incorporated message as current (default)"},    {"changecur", 'c', "BOOL", OPTION_ARG_OPTIONAL,
33    {"form",    'F', "FILE",   0, "Read format from given file"},     N_("Mark first incorporated message as current (default)")},
34    {"format",  't', "FORMAT", 0, "Use this format string"},    {"form",    'F', "FILE",   0, N_("Read format from given file")},
35    {"truncate", 'T', "BOOL", OPTION_ARG_OPTIONAL, "Truncate source mailbox after incorporating (default)"},    {"format",  't', "FORMAT", 0, N_("Use this format string")},
36      {"truncate", 'T', "BOOL", OPTION_ARG_OPTIONAL,
37       N_("Truncate source mailbox after incorporating (default)")},
38      {"width",   'w', "NUMBER", 0, N_("Set output width")},
39      {"quiet",   'q', 0,        0, N_("Be quiet")},
40      {"license", 'l', 0,        0, N_("Display software license"), -1},
41    
42    {"width",   'w', "NUMBER", 0, "Set output width"},    { N_("\nUse -help switch to obtain the list of traditional MH options. "), 0, 0, OPTION_DOC, "" },
   
   {"quiet",   'q', 0,        0, "Be quiet"},  
   {"license", 'l', 0,        0, "Display software license", -1},  
   
   { "\nUse -help switch to obtain the list of traditional MH options. ", 0, 0, OPTION_DOC, "" },  
43        
44    { 0 }    { 0 }
45  };  };
# Line 106  opt_handler (int key, char *arg, void *u Line 106  opt_handler (int key, char *arg, void *u
106      case 'T':      case 'T':
107        truncate_source = is_true(arg);        truncate_source = is_true(arg);
108        break;        break;
109          
110      case 'w':      case 'w':
111        width = strtoul (arg, NULL, 0);        width = strtoul (arg, NULL, 0);
112        if (!width)        if (!width)
113          {          {
114            mh_error ("Invalid width");            mh_error (_("Invalid width"));
115            exit (1);            exit (1);
116          }          }
117        break;        break;
# Line 119  opt_handler (int key, char *arg, void *u Line 119  opt_handler (int key, char *arg, void *u
119      case 'q':      case 'q':
120        quiet = 1;        quiet = 1;
121        break;        break;
122          
123        case 'l':
124          mh_license (argp_program_version);
125          break;
126    
127      default:      default:
128        return 1;        return 1;
129      }      }
# Line 152  main (int argc, char **argv) Line 156  main (int argc, char **argv)
156    char *buffer;    char *buffer;
157    mh_format_t format;    mh_format_t format;
158    int rc;    int rc;
159      
160      /* Native Language Support */
161      mu_init_nls ();
162    
163    mh_argp_parse (argc, argv, options, mh_option, args_doc, doc,    mh_argp_parse (argc, argv, options, mh_option, args_doc, doc,
164                   opt_handler, NULL, NULL);                   opt_handler, NULL, NULL);
165    
166    if (!quiet && mh_format_parse (format_str, &format))    if (!quiet && mh_format_parse (format_str, &format))
167      {      {
168        mh_error ("Bad format string");        mh_error (_("Bad format string"));
169        exit (1);        exit (1);
170      }      }
171    
# Line 167  main (int argc, char **argv) Line 174  main (int argc, char **argv)
174      {      {
175        if ((rc = mailbox_create_default (&input, NULL)) != 0)        if ((rc = mailbox_create_default (&input, NULL)) != 0)
176          {          {
177            mh_error ("Can not create default mailbox",            mh_error (_("Can not create default mailbox"),
178                      mu_errstring (rc));                      mu_errstring (rc));
179            exit (1);            exit (1);
180          }          }
# Line 176  main (int argc, char **argv) Line 183  main (int argc, char **argv)
183      }      }
184    else if ((rc = mailbox_create_default (&input, input_file)) != 0)    else if ((rc = mailbox_create_default (&input, input_file)) != 0)
185      {      {
186        mh_error ("Can not create mailbox %s: %s",        mh_error (_("Can not create mailbox %s: %s"),
187                  input_file, mu_errstring (rc));                  input_file, mu_errstring (rc));
188        exit (1);        exit (1);
189      }      }
# Line 185  main (int argc, char **argv) Line 192  main (int argc, char **argv)
192      {      {
193        url_t url;        url_t url;
194        mailbox_get_url (input, &url);        mailbox_get_url (input, &url);
195        mh_error ("Can not open mailbox %s: %s",        mh_error (_("Can not open mailbox %s: %s"),
196                  url_to_string (url),                  url_to_string (url),
197                  mu_errstring (errno));                  mu_errstring (errno));
198        exit (1);        exit (1);
# Line 193  main (int argc, char **argv) Line 200  main (int argc, char **argv)
200    
201    if ((rc = mailbox_messages_count (input, &total)) != 0)    if ((rc = mailbox_messages_count (input, &total)) != 0)
202      {      {
203        mh_error ("Can not read input mailbox: %s", mu_errstring (errno));        mh_error (_("Can not read input mailbox: %s"), mu_errstring (errno));
204        exit (1);        exit (1);
205      }      }
206    
207    output = mh_open_folder (append_folder, 1);    output = mh_open_folder (append_folder, 1);
208    if ((rc = mailbox_messages_count (output, &lastmsg)) != 0)    if ((rc = mailbox_messages_count (output, &lastmsg)) != 0)
209      {      {
210        mh_error ("Can not read output mailbox: %s",        mh_error (_("Can not read output mailbox: %s"),
211                  mu_errstring (errno));                  mu_errstring (errno));
212        exit (1);        exit (1);
213      }      }
# Line 223  main (int argc, char **argv) Line 230  main (int argc, char **argv)
230                
231        if ((rc = mailbox_get_message (input, n, &imsg)) != 0)        if ((rc = mailbox_get_message (input, n, &imsg)) != 0)
232          {          {
233            mh_error ("%d: can't get message: %s",            mh_error (_("%d: can't get message: %s"),
234                      n, mu_errstring (errno));                      n, mu_errstring (errno));
235            continue;            continue;
236          }          }
237    
238        if ((rc = mailbox_append_message (output, imsg)) != 0)        if ((rc = mailbox_append_message (output, imsg)) != 0)
239          {          {
240            mh_error ("%d: error appending message: %s",            mh_error (_("%d: error appending message: %s"),
241                      n, mu_errstring (errno));                      n, mu_errstring (errno));
242            continue;            continue;
243          }          }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26