Just a little correction at the it.po file.
[midnight-commander.git] / src / mfmt.c
blobf93710666c68c8f372b45b644e4cf7082f9e3682
1 /* mfmt: sets bold and underline for mail files
2 (c) 1995 miguel de icaza
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #include <stdio.h>
21 enum states {
22 header,
23 definition,
24 plain,
25 newline,
26 seen_f,
27 seen_r,
28 seen_o,
29 header_new,
30 seen_m
33 int
34 main (void)
36 int c;
37 int state = newline;
38 int space_seen = 0;
40 while ((c = getchar ()) != EOF){
41 switch (state){
42 case plain:
43 if (c == '\n')
44 state = newline;
45 putchar (c);
46 break;
48 case newline:
49 if (c == 'F')
50 state = seen_f;
51 else if (c == '\n')
52 putchar ('\n');
53 else {
54 state = plain;
55 putchar (c);
57 break;
59 case seen_f:
60 if (c == 'r')
61 state = seen_r;
62 else {
63 printf ("F%c", c);
64 state = plain;
66 break;
68 case seen_r:
69 if (c == 'o')
70 state = seen_o;
71 else {
72 state = plain;
73 printf ("Fr%c", c);
75 break;
77 case seen_o:
78 if (c == 'm'){
79 state = seen_m;
80 } else {
81 state = plain;
82 printf ("Fro%c", c);
84 break;
86 case seen_m:
87 if (c == ' '){
88 state = definition;
89 printf ("_\bF_\br_\bo_\bm ");
90 } else {
91 state = plain;
92 printf ("From%c", c);
94 break;
96 case header_new:
97 space_seen = 0;
98 if (c == ' ' || c == '\t') {
99 state = definition;
100 putchar (c);
101 break;
103 if (c == '\n'){
104 state = plain;
105 putchar (c);
106 break;
109 case header:
110 if (c == '\n'){
111 putchar (c);
112 state = header_new;
113 break;
115 printf ("_\b%c", c);
116 if (c == ' ')
117 space_seen = 1;
118 if (c == ':' && !space_seen)
119 state = definition;
120 break;
122 case definition:
123 if (c == '\n'){
124 putchar (c);
125 state = header_new;
126 break;
128 printf ("%c\b%c", c, c);
129 break;
132 return (0);