masqmail

view src/libident/support.c @ 304:d5ce2ba71e7b

manual formating of Received: hdrs; changed hdr for local receival Now the Received: headers are much friendlier to read. About folding: We must fold any line at 998 chars before transfer. We should fold the lines we produce at 78 chars. That is what RFC 2821 requests. We should think about it, somewhen. The header for locally (i.e. non-SMTP) received mail is changed to the format postfix uses. This matches RFC 2821 better. The `from' clause should contain a domain or IP, not a user name. Also, the `with' clause should contain a registered standard protocol name, which ``local'' is not.
author markus schnalke <meillo@marmaro.de>
date Thu, 09 Dec 2010 18:28:11 -0300
parents 08114f7dcc23
children
line source
1 /*
2 ** support.c
3 **
4 ** Author: Pr Emanuelsson <pell@lysator.liu.se>
5 ** Hacked by: Peter Eriksson <pen@lysator.liu.se>
6 */
7 #include <stdio.h>
8 #include <ctype.h>
10 #ifdef HAVE_ANSIHEADERS
11 # include <stdlib.h>
12 # include <string.h>
13 #else
14 # define strchr(str, c) index(str, c)
15 #endif
17 #define IN_LIBIDENT_SRC
18 #include "ident.h"
21 char*
22 id_strdup __P1(char *, str)
23 {
24 char *cp;
26 cp = (char *) malloc(strlen(str) + 1);
27 if (cp == NULL) {
28 #ifdef DEBUG
29 perror("libident: malloc");
30 #endif
31 return NULL;
32 }
34 strcpy(cp, str);
36 return cp;
37 }
40 char*
41 id_strtok __P3(char *, cp, char *, cs, char *, dc)
42 {
43 static char *bp = 0;
45 if (cp)
46 bp = cp;
48 /*
49 ** No delimitor cs - return whole buffer and point at end
50 */
51 if (!cs) {
52 while (*bp)
53 bp++;
54 return cs;
55 }
57 /*
58 ** Skip leading spaces
59 */
60 while (isspace(*bp))
61 bp++;
63 /*
64 ** No token found?
65 */
66 if (!*bp)
67 return 0;
69 cp = bp;
70 while (*bp && !strchr(cs, *bp))
71 bp++;
73 /*
74 ** Remove trailing spaces
75 */
76 *dc = *bp;
77 for (dc = bp - 1; dc > cp && isspace(*dc); dc--);
78 *++dc = '\0';
80 bp++;
82 return cp;
83 }