annotate lib-src/cvtmail.c @ 69728:fb125d0913e5

* mh-e.el (mh-defcustom, mh-defface, mh-defgroup): Macros to remove new :package-version keyword in older settings. (customize-package-emacs-version-alist): Add MH-E version to Emacs version mappings. (mh-e, mh-alias, mh-folder, mh-folder-selection) (mh-identity, mh-inc, mh-junk, mh-letter, mh-ranges) (mh-scan-line-formats, mh-search, mh-sending-mail) (mh-sequences, mh-show, mh-speedbar, mh-thread, mh-tool-bar) (mh-hooks, mh-faces): Add :package-version keyword to these groups. (mh-alias-completion-ignore-case-flag) (mh-alias-expand-aliases-flag, mh-alias-flash-on-comma) (mh-alias-insert-file, mh-alias-insertion-location) (mh-alias-local-users, mh-alias-local-users-prefix) (mh-alias-passwd-gecos-comma-separator-flag) (mh-new-messages-folders, mh-ticked-messages-folders) (mh-large-folder, mh-recenter-summary-flag) (mh-recursive-folders-flag, mh-sortm-args) (mh-default-folder-for-message-function) (mh-default-folder-list, mh-default-folder-must-exist-flag) (mh-default-folder-prefix, mh-identity-list) (mh-auto-fields-list, mh-auto-fields-prompt-flag) (mh-identity-default, mh-identity-handlers, mh-inc-prog) (mh-inc-spool-list, mh-junk-background, mh-junk-disposition) (mh-junk-program, mh-compose-insertion) (mh-compose-skipped-header-fields) (mh-compose-space-does-completion-flag) (mh-delete-yanked-msg-window-flag) (mh-extract-from-attribution-verb, mh-ins-buf-prefix) (mh-letter-complete-function, mh-letter-fill-column) (mh-mml-method-default, mh-signature-file-name) (mh-signature-separator-flag, mh-x-face-file) (mh-yank-behavior, mh-interpret-number-as-range-flag) (mh-adaptive-cmd-note-flag, mh-scan-format-file, mh-scan-prog) (mh-search-program, mh-compose-forward-as-mime-flag) (mh-compose-letter-function, mh-compose-prompt-flag) (mh-forward-subject-format, mh-insert-x-mailer-flag) (mh-redist-full-contents-flag, mh-reply-default-reply-to) (mh-reply-show-message-flag) (mh-refile-preserves-sequences-flag, mh-tick-seq) (mh-update-sequences-after-mh-show-flag) (mh-bury-show-buffer-flag, mh-clean-message-header-flag) (mh-decode-mime-flag) (mh-display-buttons-for-alternatives-flag) (mh-display-buttons-for-inline-parts-flag) (mh-do-not-confirm-flag, mh-fetch-x-image-url) (mh-graphical-smileys-flag, mh-graphical-emphasis-flag) (mh-highlight-citation-style, mh-invisible-header-fields) (mh-invisible-header-fields-default, mh-lpr-command-format) (mh-max-inline-image-height, mh-max-inline-image-width) (mh-mhl-format-file, mh-mime-save-parts-default-directory) (mh-print-background-flag, mh-show-maximum-size) (mh-show-use-xface-flag, mh-store-default-directory) (mh-summary-height, mh-speed-update-interval) (mh-show-threads-flag, mh-tool-bar-search-function): Add :package-version keyword to these options. (mh-after-commands-processed-hook) (mh-alias-reloaded-hook, mh-before-commands-processed-hook) (mh-before-quit-hook, mh-before-send-letter-hook) (mh-delete-msg-hook, mh-find-path-hook, mh-folder-mode-hook) (mh-forward-hook, mh-inc-folder-hook) (mh-insert-signature-hook) (mh-kill-folder-suppress-prompt-hooks, mh-letter-mode-hook) (mh-mh-to-mime-hook, mh-search-mode-hook, mh-quit-hook) (mh-refile-msg-hook, mh-show-hook, mh-show-mode-hook) (mh-unseen-updated-hook): Add :package-version keyword to these hooks. (mh-min-colors-defined-flag) (mh-folder-address, mh-folder-body, mh-folder-cur-msg-number) (mh-folder-date, mh-folder-deleted, mh-folder-followup) (mh-folder-msg-number, mh-folder-refiled) (mh-folder-sent-to-me-hint, mh-folder-sent-to-me-sender) (mh-folder-subject, mh-folder-tick, mh-folder-to) (mh-letter-header-field, mh-search-folder, mh-show-cc) (mh-show-date, mh-show-from, mh-show-header, mh-show-pgg-bad) (mh-show-pgg-good, mh-show-pgg-unknown, mh-show-signature) (mh-show-subject, mh-show-to, mh-show-xface) (mh-speedbar-folder, mh-speedbar-folder-with-unseen-messages) (mh-speedbar-selected-folder) (mh-speedbar-selected-folder-with-unseen-messages): : Add :package-version keyword to these faces. * mh-tool-bar.el (mh-tool-bar-define): Added commented-out :package-version keywords.
author Bill Wohler <wohler@newt.com>
date Thu, 30 Mar 2006 23:39:32 +0000
parents 3661e9b3c48f
children 6d19c76d81c5 c5406394f567
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
64769
6358e3c6075c Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64083
diff changeset
1 /* Copyright (C) 1985, 1994, 2002, 2003, 2004,
68647
3661e9b3c48f Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64769
diff changeset
2 2005, 2006 Free Software Foundation, Inc.
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 11425
diff changeset
3
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 This file is part of GNU Emacs.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 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
8 the Free Software Foundation; either version 2, or (at your option)
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 any later version.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 GNU General Public License for more details.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
64083
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 55442
diff changeset
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 55442
diff changeset
19 Boston, MA 02110-1301, USA. */
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 /* cvtmail:
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 * Program to convert oldstyle goslings emacs mail directories into
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 * gnu-rmail format. Program expects a directory called Messages to
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 * exist in your home directory, containing individual mail messages in
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 * separate files in the standard gosling emacs mail reader format.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 *
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
27 * Program takes one argument: an output file. This file will contain
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 * all the messages in Messages directory, in berkeley mail format.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 * If no output file is mentioned, messages are put in ~/OMAIL.
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 *
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 * 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
32 * 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
33 *
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 * Author: Larry Kolodney, 1985
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 */
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36
42412
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
37 #ifdef HAVE_CONFIG_H
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
38 #include <config.h>
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
39 #endif
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
40
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 #include <stdio.h>
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42
42132
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
43 #ifndef HAVE_STDLIB_H
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
44 char *getenv ();
42132
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
45 #endif
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
46
42132
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
47 char *xmalloc __P ((unsigned));
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
48 char *xrealloc __P ((char *, unsigned));
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
49 void skip_to_lf __P ((FILE *));
398fa38cf321 Include config.h, stdlib.h.
Dave Love <fx@gnu.org>
parents: 40684
diff changeset
50 void sysfail __P ((char *));
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
52 int
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 main (argc, argv)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 int argc;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 char *argv[];
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 char *hd;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 char *md;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 char *mdd;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 char *mfile;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 char *cf;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 int cflen;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 FILE *mddf;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 FILE *mfilef;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 FILE *cff;
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
66 char pre[10];
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 char name[14];
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 int c;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 hd = (char *) getenv ("HOME");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 md = (char *) xmalloc (strlen (hd) + 10);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 strcpy (md, hd);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 strcat (md, "/Messages");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 mdd = (char *) xmalloc (strlen (md) + 11);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 strcpy (mdd, md);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 strcat (mdd, "/Directory");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 cflen = 100;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 cf = (char *) xmalloc (cflen);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 mddf = fopen (mdd, "r");
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
84 if (!mddf)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
85 sysfail (mdd);
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 if (argc > 1)
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
87 mfile = argv[1];
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 else
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 mfile = (char *) xmalloc (strlen (hd) + 7);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 strcpy (mfile, hd);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 strcat (mfile, "/OMAIL");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 }
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
94 mfilef = fopen (mfile, "w");
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
95 if (!mfilef)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
96 sysfail (mfile);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
97
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 skip_to_lf (mddf);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 while (fscanf (mddf, "%4c%14[0123456789]", pre, name) != EOF)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 if (cflen < strlen (md) + strlen (name) + 2)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 cflen = strlen (md) + strlen (name) + 2;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 cf = (char *) xrealloc (cf, cflen);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 strcpy (cf, md);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 strcat (cf,"/");
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 strcat (cf, name);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 cff = fopen (cf, "r");
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
110 if (!cff)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
111 perror (cf);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
112 else
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
113 {
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
114 while ((c = getc(cff)) != EOF)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
115 putc (c, mfilef);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
116 putc ('\n', mfilef);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
117 skip_to_lf (mddf);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
118 fclose (cff);
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
119 }
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 fclose (mddf);
42412
83c1951257f1 Include <config.h>.
Pavel Janík <Pavel@Janik.cz>
parents: 42132
diff changeset
122 fclose (mfilef);
55442
a47704955f8d Throughout, replace 0 destined for `exit' arg with `EXIT_SUCCESS'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
123 return EXIT_SUCCESS;
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
126 void
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 skip_to_lf (stream)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 FILE *stream;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 {
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 register int c;
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
131 while ((c = getc(stream)) != EOF && c != '\n')
37
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 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
135
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
136 void
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
137 error (s1, s2)
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
138 char *s1, *s2;
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
139 {
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
140 fprintf (stderr, "cvtmail: ");
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
141 fprintf (stderr, s1, s2);
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
142 fprintf (stderr, "\n");
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
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
145 /* Print error message and exit. */
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
146
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
147 void
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
148 fatal (s1, s2)
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
149 char *s1, *s2;
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
150 {
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
151 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
152 exit (EXIT_FAILURE);
9491
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
153 }
dd3b83e4ceb0 Eliminate some -Wall warnings.
David J. MacKenzie <djm@gnu.org>
parents: 6107
diff changeset
154
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
155 void
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
156 sysfail (s)
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
157 char *s;
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
158 {
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
159 fprintf (stderr, "cvtmail: ");
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
160 perror (s);
55442
a47704955f8d Throughout, replace 0 destined for `exit' arg with `EXIT_SUCCESS'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
161 exit (EXIT_FAILURE);
11425
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
162 }
bcb88697b70b (main, skip_to_lf): Improve error handling.
Karl Heuer <kwzh@gnu.org>
parents: 9491
diff changeset
163
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
164 char *
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 xmalloc (size)
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
166 unsigned size;
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 {
49803
c6c565402859 Cast result of malloc and realloc.
Richard M. Stallman <rms@gnu.org>
parents: 42412
diff changeset
168 char *result = (char *) malloc (size);
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 if (!result)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 fatal ("virtual memory exhausted", 0);
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 return result;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 }
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
174 char *
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 xrealloc (ptr, size)
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 char *ptr;
6107
8cc2a5d2e728 * cvtmail.c: Declare malloc, realloc, xmalloc, xrealloc.
David J. MacKenzie <djm@gnu.org>
parents: 37
diff changeset
177 unsigned size;
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 {
49803
c6c565402859 Cast result of malloc and realloc.
Richard M. Stallman <rms@gnu.org>
parents: 42412
diff changeset
179 char *result = (char *) realloc (ptr, size);
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 if (!result)
40684
e3eadbc9fda7 (xrealloc): Always pass two args to `fatal'.
Richard M. Stallman <rms@gnu.org>
parents: 15719
diff changeset
181 fatal ("virtual memory exhausted", 0);
37
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 return result;
e48c0f5e6696 entered into RCS
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49803
diff changeset
184
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49803
diff changeset
185 /* arch-tag: b93c25a9-9012-44f1-b78b-9cc7aed44a7a
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49803
diff changeset
186 (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
187
a47704955f8d Throughout, replace 0 destined for `exit' arg with `EXIT_SUCCESS'.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
188 /* cvtmail.c ends here */