Mercurial > masqmail
comparison src/masqmail.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 | b45dc53f2829 |
children | b27f66555ba8 |
comparison
equal
deleted
inserted
replaced
365:934a223e4ee8 | 366:41958685480d |
---|---|
74 raise(sig); | 74 raise(sig); |
75 } | 75 } |
76 | 76 |
77 #ifdef ENABLE_IDENT /* so far used for that only */ | 77 #ifdef ENABLE_IDENT /* so far used for that only */ |
78 static gboolean | 78 static gboolean |
79 is_in_netlist(gchar * host, GList * netlist) | 79 is_in_netlist(gchar *host, GList *netlist) |
80 { | 80 { |
81 guint hostip = inet_addr(host); | 81 guint hostip = inet_addr(host); |
82 struct in_addr addr; | 82 struct in_addr addr; |
83 | 83 |
84 addr.s_addr = hostip; | 84 addr.s_addr = hostip; |
100 cp: pointing to the char after the option | 100 cp: pointing to the char after the option |
101 e.g. `-d 6' `-d6' | 101 e.g. `-d 6' `-d6' |
102 ^ ^ | 102 ^ ^ |
103 */ | 103 */ |
104 gchar* | 104 gchar* |
105 get_optarg(char* argv[], gint* argp, char* cp) | 105 get_optarg(char *argv[], gint *argp, char *cp) |
106 { | 106 { |
107 if (*cp) { | 107 if (*cp) { |
108 /* this kind: -xval */ | 108 /* this kind: -xval */ |
109 return cp; | 109 return cp; |
110 } | 110 } |
116 } | 116 } |
117 return NULL; | 117 return NULL; |
118 } | 118 } |
119 | 119 |
120 gboolean | 120 gboolean |
121 write_pidfile(gchar * name) | 121 write_pidfile(gchar *name) |
122 { | 122 { |
123 FILE *fptr; | 123 FILE *fptr; |
124 | 124 |
125 if ((fptr = fopen(name, "wt"))) { | 125 if ((fptr = fopen(name, "wt"))) { |
126 fprintf(fptr, "%d\n", getpid()); | 126 fprintf(fptr, "%d\n", getpid()); |
202 smtp_in(stdin, stderr, peername, NULL); | 202 smtp_in(stdin, stderr, peername, NULL); |
203 } | 203 } |
204 | 204 |
205 /* default mode if address args or -t is specified, or called as rmail */ | 205 /* default mode if address args or -t is specified, or called as rmail */ |
206 static void | 206 static void |
207 mode_accept(address * return_path, gchar * full_sender_name, guint accept_flags, char **addresses, int addr_cnt) | 207 mode_accept(address *return_path, gchar *full_sender_name, guint accept_flags, char **addresses, int addr_cnt) |
208 { | 208 { |
209 /* accept message on stdin */ | 209 /* accept message on stdin */ |
210 accept_error err; | 210 accept_error err; |
211 message *msg = create_message(); | 211 message *msg = create_message(); |
212 gint i; | 212 gint i; |
310 currently only the `rm' command is supported | 310 currently only the `rm' command is supported |
311 until this changes, we don't need any facility for further commands | 311 until this changes, we don't need any facility for further commands |
312 return success if at least one message had been deleted | 312 return success if at least one message had been deleted |
313 */ | 313 */ |
314 static int | 314 static int |
315 manipulate_queue(char* cmd, char* id[]) | 315 manipulate_queue(char *cmd, char *id[]) |
316 { | 316 { |
317 gboolean ok = FALSE; | 317 gboolean ok = FALSE; |
318 | 318 |
319 if (strcmp(cmd, "rm") != 0) { | 319 if (strcmp(cmd, "rm") != 0) { |
320 fprintf(stderr, "unknown command %s\n", cmd); | 320 fprintf(stderr, "unknown command %s\n", cmd); |
370 return ok; | 370 return ok; |
371 } | 371 } |
372 | 372 |
373 /* -qo, -q (without argument), or called as runq */ | 373 /* -qo, -q (without argument), or called as runq */ |
374 static int | 374 static int |
375 run_queue(gboolean do_runq, gboolean do_runq_online, char* route_name) | 375 run_queue(gboolean do_runq, gboolean do_runq_online, char *route_name) |
376 { | 376 { |
377 int ret; | 377 int ret; |
378 | 378 |
379 /* queue runs */ | 379 /* queue runs */ |
380 set_identity(conf.orig_uid, "queue run"); | 380 set_identity(conf.orig_uid, "queue run"); |
429 | 429 |
430 int | 430 int |
431 main(int argc, char *argv[]) | 431 main(int argc, char *argv[]) |
432 { | 432 { |
433 gchar *progname; | 433 gchar *progname; |
434 char* opt; | 434 char *opt; |
435 gint arg; | 435 gint arg; |
436 | 436 |
437 gboolean do_listen = FALSE; | 437 gboolean do_listen = FALSE; |
438 gboolean do_runq = FALSE; | 438 gboolean do_runq = FALSE; |
439 gboolean do_runq_online = FALSE; | 439 gboolean do_runq_online = FALSE; |