1 /*
2  *  NORMALC.C
3  *
4  *  Extracted from READMAIL.C by Paul Edwards.
5  *  Released to the public domain.
6  */
7 
8 #include <time.h>
9 #include "addr.h"
10 #include "nedit.h"
11 #include "msged.h"
12 #include "misc.h"
13 #include "normal.h"
14 
normalize(char * s)15 int normalize(char *s) /* int: returns new string length */
16 {
17     char *tmp = s;
18     char *org = s;
19 
20     while (*s)
21     {
22         switch ((unsigned char)(*s))
23         {
24           case 0x0a:
25             s++;
26             break;
27           case 0x0d:
28             s++;
29             *tmp++ = '\n';
30             break;
31           case 0x8d:
32             if (stripSoft && !softcrxlat)
33             {
34                 s++;
35                 break;
36             }
37           default:
38             *tmp++ = (char)DOROT13((int)*s);
39             s++;
40         }
41     }
42     *tmp = '\0';
43     return tmp - org;
44 }
45