Mercurial > masqmail
comparison src/smtp_in.c @ 366:41958685480d
Switched to `type *name' style
Andrew Koenig's ``C Traps and Pitfalls'' (Ch.2.1) convinced
me that it is best to go with the way C had been designed.
The ``declaration reflects use'' concept conflicts with a
``type* name'' notation. Hence I switched.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Thu, 22 Sep 2011 15:07:40 +0200 |
parents | 53cf6be5843a |
children | b27f66555ba8 |
comparison
equal
deleted
inserted
replaced
365:934a223e4ee8 | 366:41958685480d |
---|---|
41 {SMTP_NOOP, "NOOP",}, | 41 {SMTP_NOOP, "NOOP",}, |
42 {SMTP_HELP, "HELP"}, | 42 {SMTP_HELP, "HELP"}, |
43 }; | 43 }; |
44 | 44 |
45 static smtp_cmd_id | 45 static smtp_cmd_id |
46 get_id(const gchar * line) | 46 get_id(const gchar *line) |
47 { | 47 { |
48 gint i; | 48 gint i; |
49 for (i = 0; i < SMTP_NUM_IDS; i++) { | 49 for (i = 0; i < SMTP_NUM_IDS; i++) { |
50 if (strncasecmp(smtp_cmds[i].cmd, line, strlen(smtp_cmds[i].cmd)) == 0) { | 50 if (strncasecmp(smtp_cmds[i].cmd, line, strlen(smtp_cmds[i].cmd)) == 0) { |
51 return (smtp_cmd_id) i; | 51 return (smtp_cmd_id) i; |
78 and containing the mailbox only, though we first check for size in | 78 and containing the mailbox only, though we first check for size in |
79 smtp_in(). | 79 smtp_in(). |
80 Return false if address is too long. | 80 Return false if address is too long. |
81 */ | 81 */ |
82 static gboolean | 82 static gboolean |
83 get_address(gchar * line, gchar * addr) | 83 get_address(gchar *line, gchar *addr) |
84 { | 84 { |
85 gchar *p = line; | 85 gchar *p = line; |
86 gchar *q = addr; | 86 gchar *q = addr; |
87 | 87 |
88 /* skip MAIL FROM: and RCPT TO: */ | 88 /* skip MAIL FROM: and RCPT TO: */ |
108 | 108 |
109 return TRUE; | 109 return TRUE; |
110 } | 110 } |
111 | 111 |
112 static smtp_connection* | 112 static smtp_connection* |
113 create_base(gchar * remote_host) | 113 create_base(gchar *remote_host) |
114 { | 114 { |
115 smtp_connection *base = g_malloc(sizeof(smtp_connection)); | 115 smtp_connection *base = g_malloc(sizeof(smtp_connection)); |
116 if (!base) { | 116 if (!base) { |
117 return NULL; | 117 return NULL; |
118 } | 118 } |
128 | 128 |
129 return base; | 129 return base; |
130 } | 130 } |
131 | 131 |
132 static void | 132 static void |
133 smtp_printf(FILE * out, gchar * fmt, ...) | 133 smtp_printf(FILE *out, gchar *fmt, ...) |
134 { | 134 { |
135 va_list args; | 135 va_list args; |
136 va_start(args, fmt); | 136 va_start(args, fmt); |
137 | 137 |
138 DEBUG(4) { | 138 DEBUG(4) { |
151 | 151 |
152 va_end(args); | 152 va_end(args); |
153 } | 153 } |
154 | 154 |
155 void | 155 void |
156 smtp_in(FILE * in, FILE * out, gchar * remote_host, gchar * ident) | 156 smtp_in(FILE *in, FILE *out, gchar *remote_host, gchar *ident) |
157 { | 157 { |
158 gchar *buffer; | 158 gchar *buffer; |
159 smtp_cmd_id cmd_id; | 159 smtp_cmd_id cmd_id; |
160 message *msg = NULL; | 160 message *msg = NULL; |
161 smtp_connection *psc; | 161 smtp_connection *psc; |