Back to index

courier  0.68.2
lcrwstatic.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 1998 - 2007 Double Precision, Inc.
00003 ** See COPYING for distribution information.
00004 */
00005 
00006 #include      "courier.h"
00007 #include      "rw.h"
00008 #include      "lcrwstaticlist.h"
00009 #include      <string.h>
00010 
00011 
00012 extern struct rw_static_info rw_static[];
00013 
00014 /*
00015        This module is compiled when transport modules are configured as
00016        static libraries, and are linked with during the link phase.
00017 
00018        The Makefile automatically generates lcrwstatic.h which contains
00019        pointers to all the rw_install and rw_init functions we link with.
00020        We simply go through the list, and feed each module to rw_install.
00021 */
00022 
00023 int rw_init_courier(const char *name)
00024 {
00025 unsigned      i;
00026 int    err=0;
00027 
00028        if (rw_init_verbose_flag)
00029        {
00030               clog_msg_start_info();
00031               clog_msg_str("Loading STATIC transport module libraries.");
00032               clog_msg_send();
00033        }
00034        if (rw_install_start())     return (-1);
00035        for (i=0; rw_static[i].name; i++)
00036               /* name != 0 really meaningless for static libs, but,
00037               ** what the heck...
00038               */
00039               if ((name == 0 || strcmp(name,
00040                      rw_static[i].name) == 0) &&
00041                      rw_install(rw_static[i].name,
00042                             rw_static[i].rw_install,
00043                             rw_static[i].rw_init))
00044                      err=1;
00045 
00046        if (err || rw_install_init())
00047        {
00048               clog_msg_start_err();
00049               clog_msg_str("Transport module installation has FAILED.");
00050               clog_msg_send();
00051               return (-1);
00052        }
00053        return (0);
00054 }