annotate lib-src/cvtmail.c @ 55603:706a50524d5f

(compilation-warning-face, compilation-info-face): Use min-colors.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 15 May 2004 12:16:13 +0000
parents a47704955f8d
children 23a17af379b1 4c90ffeb71c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
1 /* Copyright (C) 1985, 1994 Free Software Foundation
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 11425
diff changeset
2
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3 This file is part of GNU Emacs.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 GNU Emacs is free software; you can redistribute it and/or modify
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 any later version.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 GNU Emacs is distributed in the hope that it will be useful,
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 GNU General Public License for more details.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 11425
diff changeset
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 11425
diff changeset
18 Boston, MA 02111-1307, USA. */
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 /* cvtmail:
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 * Program to convert oldstyle goslings emacs mail directories into
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 * gnu-rmail format. Program expects a directory called Messages to
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 * exist in your home directory, containing individual mail messages in
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 * separate files in the standard gosling emacs mail reader format.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 *
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
26 * Program takes one argument: an output file. This file will contain
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 * all the messages in Messages directory, in berkeley mail format.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 * If no output file is mentioned, messages are put in ~/OMAIL.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 *
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 * In order to get rmail to read the messages, the resulting file must
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 * be mv'ed to ~/mbox, and then have rmail invoked on them.
42412
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
32 *
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 * Author: Larry Kolodney, 1985
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 */
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35
42412
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
36 #ifdef HAVE_CONFIG_H
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
37 #include <config.h>
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
38 #endif
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
39
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 #include <stdio.h>
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41
42132
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
42 #ifndef HAVE_STDLIB_H
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
43 char *getenv ();
42132
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
44 #endif
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
45
42132
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
46 char *xmalloc __P ((unsigned));
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
47 char *xrealloc __P ((char *, unsigned));
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
48 void skip_to_lf __P ((FILE *));
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
49 void sysfail __P ((char *));
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
51 int
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 main (argc, argv)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 int argc;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 char *argv[];
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 char *hd;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 char *md;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 char *mdd;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 char *mfile;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 char *cf;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 int cflen;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 FILE *mddf;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 FILE *mfilef;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 FILE *cff;
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
65 char pre[10];
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 char name[14];
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 int c;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 hd = (char *) getenv ("HOME");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 md = (char *) xmalloc (strlen (hd) + 10);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 strcpy (md, hd);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 strcat (md, "/Messages");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 mdd = (char *) xmalloc (strlen (md) + 11);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 strcpy (mdd, md);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 strcat (mdd, "/Directory");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 cflen = 100;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 cf = (char *) xmalloc (cflen);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 mddf = fopen (mdd, "r");
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
83 if (!mddf)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
84 sysfail (mdd);
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 if (argc > 1)
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
86 mfile = argv[1];
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 else
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 mfile = (char *) xmalloc (strlen (hd) + 7);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 strcpy (mfile, hd);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 strcat (mfile, "/OMAIL");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 }
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
93 mfilef = fopen (mfile, "w");
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
94 if (!mfilef)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
95 sysfail (mfile);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
96
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 skip_to_lf (mddf);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 while (fscanf (mddf, "%4c%14[0123456789]", pre, name) != EOF)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 if (cflen < strlen (md) + strlen (name) + 2)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 cflen = strlen (md) + strlen (name) + 2;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 cf = (char *) xrealloc (cf, cflen);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 strcpy (cf, md);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 strcat (cf,"/");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 strcat (cf, name);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 cff = fopen (cf, "r");
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
109 if (!cff)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
110 perror (cf);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
111 else
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
112 {
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
113 while ((c = getc(cff)) != EOF)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
114 putc (c, mfilef);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
115 putc ('\n', mfilef);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
116 skip_to_lf (mddf);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
117 fclose (cff);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
118 }
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 fclose (mddf);
42412
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
121 fclose (mfilef);
55442
a47704955f8d Throughout, replace 0 destined for `exit' arg with `EXIT_SUCCESS'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
122 return EXIT_SUCCESS;
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
125 void
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 skip_to_lf (stream)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 FILE *stream;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 register int c;
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
130 while ((c = getc(stream)) != EOF && c != '\n')
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 ;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
134
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
135 void
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
136 error (s1, s2)
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
137 char *s1, *s2;
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
138 {
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
139 fprintf (stderr, "cvtmail: ");
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
140 fprintf (stderr, s1, s2);
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
141 fprintf (stderr, "\n");
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
142 }
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
143
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
144 /* Print error message and exit. */
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
145
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
146 void
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
147 fatal (s1, s2)
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
148 char *s1, *s2;
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
149 {
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
150 error (s1, s2);
55442
a47704955f8d Throughout, replace 0 destined for `exit' arg with `EXIT_SUCCESS'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
151 exit (EXIT_FAILURE);
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
152 }
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
153
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
154 void
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
155 sysfail (s)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
156 char *s;
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
157 {
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
158 fprintf (stderr, "cvtmail: ");
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
159 perror (s);
55442
a47704955f8d Throughout, replace 0 destined for `exit' arg with `EXIT_SUCCESS'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
160 exit (EXIT_FAILURE);
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
161 }
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
162
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
163 char *
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 xmalloc (size)
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
165 unsigned size;
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 {
49803
c6c565402859 Cast result of malloc and realloc.
Richard M. Stallman <rms@gnu.org>
parents: 42412
diff changeset
167 char *result = (char *) malloc (size);
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 if (!result)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 fatal ("virtual memory exhausted", 0);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 return result;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
173 char *
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 xrealloc (ptr, size)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 char *ptr;
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
176 unsigned size;
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 {
49803
c6c565402859 Cast result of malloc and realloc.
Richard M. Stallman <rms@gnu.org>
parents: 42412
diff changeset
178 char *result = (char *) realloc (ptr, size);
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 if (!result)
40684
e3eadbc9fda7 (xrealloc): Always pass two args to `fatal'.
Richard M. Stallman <rms@gnu.org>
parents: 15719
diff changeset
180 fatal ("virtual memory exhausted", 0);
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 return result;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49803
diff changeset
183
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49803
diff changeset
184 /* arch-tag: b93c25a9-9012-44f1-b78b-9cc7aed44a7a
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49803
diff changeset
185 (do not change this comment) */
55442
a47704955f8d Throughout, replace 0 destined for `exit' arg with `EXIT_SUCCESS'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
186
a47704955f8d Throughout, replace 0 destined for `exit' arg with `EXIT_SUCCESS'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
187 /* cvtmail.c ends here */