aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorGlenn Morris2009-08-19 02:57:08 +0000
committerGlenn Morris2009-08-19 02:57:08 +0000
commitb2d66f55df3ac70e41ffbdcf8c6e3d7d9341998b (patch)
tree24da4c6e08348653a59b9b8cfd88118e1dfbae2f /lib-src
parenta8a8ec612e5569580afa3260df6797873f71e5b4 (diff)
downloademacs-b2d66f55df3ac70e41ffbdcf8c6e3d7d9341998b.tar.gz
emacs-b2d66f55df3ac70e41ffbdcf8c6e3d7d9341998b.zip
Remove file
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/cvtmail.c190
1 files changed, 0 insertions, 190 deletions
diff --git a/lib-src/cvtmail.c b/lib-src/cvtmail.c
deleted file mode 100644
index 1c262c99aef..00000000000
--- a/lib-src/cvtmail.c
+++ /dev/null
@@ -1,190 +0,0 @@
1/* cvtmail.c --- convert Gosling Emacs mail directories into RMAIL format
2
3Copyright (C) 1985, 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009 Free Software Foundation, Inc.
5
6Author: Larry Kolodney
7Created: 1985
8
9This file is part of GNU Emacs.
10
11GNU Emacs is free software: you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation, either version 3 of the License, or
14(at your option) any later version.
15
16GNU Emacs is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23
24
25/* Commentary:
26
27Program to convert oldstyle goslings emacs mail directories into
28gnu-rmail format. Program expects a directory called Messages to
29exist in your home directory, containing individual mail messages in
30separate files in the standard gosling emacs mail reader format.
31
32Program takes one argument: an output file. This file will contain
33all the messages in Messages directory, in berkeley mail format.
34If no output file is mentioned, messages are put in ~/OMAIL.
35
36In order to get rmail to read the messages, the resulting file must
37be mv'ed to ~/mbox, and then have rmail invoked on them. */
38
39#ifdef HAVE_CONFIG_H
40#include <config.h>
41#endif
42
43#include <stdio.h>
44
45#ifndef HAVE_STDLIB_H
46char *getenv ();
47#endif
48
49char *xmalloc __P ((unsigned));
50char *xrealloc __P ((char *, unsigned));
51void skip_to_lf __P ((FILE *));
52void sysfail __P ((char *));
53
54int
55main (argc, argv)
56 int argc;
57 char *argv[];
58{
59 char *hd;
60 char *md;
61 char *mdd;
62 char *mfile;
63 char *cf;
64 int cflen;
65 FILE *mddf;
66 FILE *mfilef;
67 FILE *cff;
68 char pre[10];
69 char name[14];
70 int c;
71
72 hd = (char *) getenv ("HOME");
73
74 md = (char *) xmalloc (strlen (hd) + 10);
75 strcpy (md, hd);
76 strcat (md, "/Messages");
77
78 mdd = (char *) xmalloc (strlen (md) + 11);
79 strcpy (mdd, md);
80 strcat (mdd, "/Directory");
81
82 cflen = 100;
83 cf = (char *) xmalloc (cflen);
84
85 mddf = fopen (mdd, "r");
86 if (!mddf)
87 sysfail (mdd);
88 if (argc > 1)
89 mfile = argv[1];
90 else
91 {
92 mfile = (char *) xmalloc (strlen (hd) + 7);
93 strcpy (mfile, hd);
94 strcat (mfile, "/OMAIL");
95 }
96 mfilef = fopen (mfile, "w");
97 if (!mfilef)
98 sysfail (mfile);
99
100 skip_to_lf (mddf);
101 while (fscanf (mddf, "%4c%14[0123456789]", pre, name) != EOF)
102 {
103 if (cflen < strlen (md) + strlen (name) + 2)
104 {
105 cflen = strlen (md) + strlen (name) + 2;
106 cf = (char *) xrealloc (cf, cflen);
107 }
108 strcpy (cf, md);
109 strcat (cf,"/");
110 strcat (cf, name);
111 cff = fopen (cf, "r");
112 if (!cff)
113 perror (cf);
114 else
115 {
116 while ((c = getc(cff)) != EOF)
117 putc (c, mfilef);
118 putc ('\n', mfilef);
119 skip_to_lf (mddf);
120 fclose (cff);
121 }
122 }
123 fclose (mddf);
124 fclose (mfilef);
125 return EXIT_SUCCESS;
126}
127
128void
129skip_to_lf (stream)
130 FILE *stream;
131{
132 register int c;
133 while ((c = getc(stream)) != EOF && c != '\n')
134 ;
135}
136
137
138void
139error (s1, s2)
140 char *s1, *s2;
141{
142 fprintf (stderr, "cvtmail: ");
143 fprintf (stderr, s1, s2);
144 fprintf (stderr, "\n");
145}
146
147/* Print error message and exit. */
148
149void
150fatal (s1, s2)
151 char *s1, *s2;
152{
153 error (s1, s2);
154 exit (EXIT_FAILURE);
155}
156
157void
158sysfail (s)
159 char *s;
160{
161 fprintf (stderr, "cvtmail: ");
162 perror (s);
163 exit (EXIT_FAILURE);
164}
165
166char *
167xmalloc (size)
168 unsigned size;
169{
170 char *result = (char *) malloc (size);
171 if (!result)
172 fatal ("virtual memory exhausted", 0);
173 return result;
174}
175
176char *
177xrealloc (ptr, size)
178 char *ptr;
179 unsigned size;
180{
181 char *result = (char *) realloc (ptr, size);
182 if (!result)
183 fatal ("virtual memory exhausted", 0);
184 return result;
185}
186
187/* arch-tag: b93c25a9-9012-44f1-b78b-9cc7aed44a7a
188 (do not change this comment) */
189
190/* cvtmail.c ends here */