/[mailutils]/mailutils/mail/var.c
ViewVC logotype

Diff of /mailutils/mail/var.c

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

revision 1.14 by gray, Wed Dec 11 15:18:06 2002 UTC revision 1.15 by polak, Mon Dec 23 22:01:34 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, 2001 Free Software Foundation, Inc.     Copyright (C) 1999, 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  /* Functions for handling escape variables */  /* Functions for handling escape variables */
# Line 55  parse_headers (FILE *fp, compose_env_t * Line 55  parse_headers (FILE *fp, compose_env_t *
55        
56    if ((status = header_create (&header, NULL, 0, NULL)) != 0)    if ((status = header_create (&header, NULL, 0, NULL)) != 0)
57      {      {
58        util_error ("can't create header: %s", mu_errstring (status));        util_error (_("can't create header: %s"), mu_errstring (status));
59        return 1;        return 1;
60      }      }
61    
# Line 91  parse_headers (FILE *fp, compose_env_t * Line 91  parse_headers (FILE *fp, compose_env_t *
91                  }                  }
92                else                else
93                  {                  {
94                    util_error ("%d: not a header line", line);                    util_error (_("%d: not a header line"), line);
95                    errcnt++;                    errcnt++;
96                  }                  }
97              }              }
# Line 117  parse_headers (FILE *fp, compose_env_t * Line 117  parse_headers (FILE *fp, compose_env_t *
117                  }                  }
118                else                else
119                  {                  {
120                    util_error ("%d: not a header line", line);                    util_error (_("%d: not a header line"), line);
121                    errcnt++;                    errcnt++;
122                  }                  }
123              }              }
# Line 138  parse_headers (FILE *fp, compose_env_t * Line 138  parse_headers (FILE *fp, compose_env_t *
138        char *p;        char *p;
139                
140        header_destroy (&header, NULL);        header_destroy (&header, NULL);
141        p = ml_readline ("Edit again?");        p = ml_readline (_("Edit again?"));
142        if (*p == 'y' || *p == 'Y')        if (*p == 'y' || *p == 'Y')
143          return -1;          return -1;
144        else        else
# Line 153  parse_headers (FILE *fp, compose_env_t * Line 153  parse_headers (FILE *fp, compose_env_t *
153  static void  static void
154  var_continue (void)  var_continue (void)
155  {  {
156    fprintf (stdout, "(continue)\n");    fprintf (stdout, _("(continue)\n"));
157  }  }
158    
159  static int  static int
# Line 163  var_check_args (int argc, char **argv) Line 163  var_check_args (int argc, char **argv)
163      {      {
164        char *escape = "~";        char *escape = "~";
165        util_getenv (&escape, "escape", Mail_env_string, 0);        util_getenv (&escape, "escape", Mail_env_string, 0);
166        util_error ("%c%s requires an argument", escape[0], argv[0]);        util_error (_("%c%s requires an argument"), escape[0], argv[0]);
167        return 1;        return 1;
168      }      }
169    return 0;    return 0;
# Line 195  var_command (int argc, char **argv, comp Line 195  var_command (int argc, char **argv, comp
195    entry = util_find_entry (mail_command_table, argv[1]);    entry = util_find_entry (mail_command_table, argv[1]);
196    if (!entry.func)    if (!entry.func)
197      {      {
198        util_error ("Unknown command: %s", argv[1]);        util_error (_("Unknown command: %s"), argv[1]);
199        return 1;        return 1;
200      }      }
201    if (entry.flags & (EF_FLOW | EF_SEND))    if (entry.flags & (EF_FLOW | EF_SEND))
202      {      {
203        util_error ("Command not allowed in an escape sequence\n");        util_error (_("Command not allowed in an escape sequence\n"));
204        return 1;        return 1;
205      }      }
206    
# Line 251  var_sign (int argc, char **argv, compose Line 251  var_sign (int argc, char **argv, compose
251    
252            if (!fp)            if (!fp)
253              {              {
254                util_error ("can't open %s: %s", name, strerror (errno));                util_error (_("can't open %s: %s"), name, strerror (errno));
255                free (name);                free (name);
256              }              }
257    
258            fprintf (stdout, "Reading %s\n", name);            fprintf (stdout, _("Reading %s\n"), name);
259            while (getline (&buf, &n, fp) > 0)            while (getline (&buf, &n, fp) > 0)
260              fprintf (ofile, "%s", buf);              fprintf (ofile, "%s", buf);
261    
# Line 455  var_quote (int argc, char **argv, compos Line 455  var_quote (int argc, char **argv, compos
455        if (util_get_message (mbox, cursor, &mesg, MSG_NODELETED))        if (util_get_message (mbox, cursor, &mesg, MSG_NODELETED))
456          return 1;          return 1;
457    
458        fprintf (stdout, "Interpolating: %d\n", cursor);        fprintf (stdout, _("Interpolating: %d\n"), cursor);
459    
460        util_getenv (&prefix, "indentprefix", Mail_env_string, 0);        util_getenv (&prefix, "indentprefix", Mail_env_string, 0);
461    
# Line 516  var_type_input (int argc, char **argv, c Line 516  var_type_input (int argc, char **argv, c
516  {  {
517    char buffer[512];    char buffer[512];
518    
519    fprintf (env->ofile, "Message contains:\n");    fprintf (env->ofile, _("Message contains:\n"));
520    
521    dump_headers (env->ofile, env);    dump_headers (env->ofile, env);
522    
# Line 546  var_read (int argc, char **argv, compose Line 546  var_read (int argc, char **argv, compose
546    inf = fopen (filename, "r");    inf = fopen (filename, "r");
547    if (!inf)    if (!inf)
548      {      {
549        util_error ("can't open %s: %s\n", filename, strerror (errno));        util_error (_("can't open %s: %s\n"), filename, strerror (errno));
550        free (filename);        free (filename);
551        return 1;        return 1;
552      }      }
# Line 601  var_write (int argc, char **argv, compos Line 601  var_write (int argc, char **argv, compos
601    
602    if (!fp)    if (!fp)
603      {      {
604        util_error ("can't open %s: %s\n", filename, strerror (errno));        util_error (_("can't open %s: %s\n"), filename, strerror (errno));
605        free (filename);        free (filename);
606        return 1;        return 1;
607      }      }
# Line 631  var_pipe (int argc, char **argv, compose Line 631  var_pipe (int argc, char **argv, compose
631    
632    if (argc == 1)    if (argc == 1)
633      {      {
634        util_error ("pipe: no command specified");        util_error (_("pipe: no command specified"));
635        return 1;        return 1;
636      }      }
637    
# Line 675  var_pipe (int argc, char **argv, compose Line 675  var_pipe (int argc, char **argv, compose
675          xargv[i] = argv[i + 1];          xargv[i] = argv[i + 1];
676        xargv[i] = NULL;        xargv[i] = NULL;
677        execvp (xargv[0], xargv);        execvp (xargv[0], xargv);
678        util_error ("cannot exec process `%s': %s", xargv[0], strerror (errno));        util_error (_("cannot exec process `%s': %s"), xargv[0], strerror (errno));
679        exit (1);        exit (1);
680      }      }
681    else    else
# Line 708  var_pipe (int argc, char **argv, compose Line 708  var_pipe (int argc, char **argv, compose
708        waitpid (pid, &status, 0);        waitpid (pid, &status, 0);
709        if (!WIFEXITED (status))        if (!WIFEXITED (status))
710          {          {
711            util_error ("child terminated abnormally: %d", WEXITSTATUS (status));            util_error (_("child terminated abnormally: %d"), WEXITSTATUS (status));
712          }          }
713        else        else
714          {          {
715            struct stat st;            struct stat st;
716            if (fstat (fd, &st))            if (fstat (fd, &st))
717              {              {
718                util_error ("can't stat output file: %s", strerror (errno));                util_error (_("can't stat output file: %s"), strerror (errno));
719              }              }
720            else if (st.st_size > 0)            else if (st.st_size > 0)
721              rc = 0;              rc = 0;
# Line 725  var_pipe (int argc, char **argv, compose Line 725  var_pipe (int argc, char **argv, compose
725                 (unsigned long) lines, (unsigned long) size);                 (unsigned long) lines, (unsigned long) size);
726        if (rc)        if (rc)
727          {          {
728            fprintf (stdout, "no lines out\n");            fprintf (stdout, _("no lines out\n"));
729          }          }
730        else        else
731          {          {

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

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