ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/src/conf/modules.c
(Generate patch)

Comparing ircd-hybrid/src/conf/modules.c (file contents):
Revision 476 by adx, Sat Feb 18 02:12:40 2006 UTC vs.
Revision 477 by adx, Sat Feb 18 12:34:09 2006 UTC

# Line 73 | Line 73 | static dlink_node *hreset, *hpass;
73   *
74   * [API] Checks whether a module is loaded.
75   *
76 < * inputs: module name (with or without path/suffix)
76 > * inputs:
77 > *   - module name (with or without path/suffix)
78 > *   - 1 if we should match exact fullname, 0 if only the canonical name
79   * output: pointer to struct Module or NULL
80   */
81   struct Module *
82 < find_module(const char *filename)
82 > find_module(const char *filename, int exact)
83   {
84    dlink_node *ptr;
85    char *name = basename(name), *p;
# Line 88 | Line 90 | find_module(const char *filename)
90      struct Module *mod = ptr->data;
91  
92      if (!_NCOMPARE(mod->name, name, cnt) && !mod->name[cnt])
93 +    {
94 +      if (exact && _COMPARE(mod->fullname, filename) != 0)
95 +        continue;
96        return mod;
97 +    }
98    }
99  
100    return NULL;
# Line 112 | Line 118 | init_module(struct Module *mod, const ch
118  
119    if (mod->address != NULL)
120      snprintf(message, sizeof(message), "Shared module %s loaded at %p",
121 <      mod->name, mod->address);
121 >      fullname, mod->address);
122    else
123      snprintf(message, sizeof(message), "Loaded %s module %s",
124 <      mod->name, mod->handle ? "shared" : "built-in");
124 >      fullname, mod->handle ? "shared" : "built-in");
125  
126    ilog(L_NOTICE, "%s", message);
127    sendto_realops_flags(UMODE_ALL, L_ALL, "%s", message);
# Line 156 | Line 162 | load_shared_module(const char *name, con
162      char error[IRCD_BUFSIZE];
163  
164      modunload(handle);
165 <    snprintf(error, sizeof(error), "%s contains no %s export!", path, sym);
165 >    snprintf(error, sizeof(error), "%s contains no %s export!", fname, sym);
166  
167      ilog(L_WARN, "%s", error);
168      sendto_realops_flags(UMODE_ALL, L_ALL, "%s", error);
# Line 186 | Line 192 | load_module(const char *filename)
192   {
193    char name[PATH_MAX], *p;
194  
195 <  if (find_module(filename) != NULL)
195 >  if (find_module(filename, NO) != NULL)
196      return -1;
197  
198    if (strpbrk(filename, "\\/") == NULL)
# Line 289 | Line 295 | boot_modules(char cold)
295            strlcpy(buf, ldirent->d_name, sizeof(buf));
296            if ((p = strchr(buf, '.')) != NULL)
297              *p = 0;
298 <          load_shared_module(buf, AUTOMODPATH, ldirent->d_name);
298 >          if (!find_module(buf, NO))
299 >            load_shared_module(buf, AUTOMODPATH, ldirent->d_name);
300          }
301          closedir(moddir);
302        }
# Line 301 | Line 308 | boot_modules(char cold)
308        struct Module *mptr;
309  
310        for (mptr = builtin_mods; *mptr; mptr++)
311 <        if (!find_module(mptr->name))
311 >        if (!find_module(mptr->name, NO))
312            init_module(mptr);
313      }
314   #endif
315    }
316  
317    DLINK_FOREACH(ptr, mod_extra.head)
318 <    if (!find_module(ptr->data))
318 >    if (!find_module(ptr->data, NO))
319        load_module(ptr->data);
320  
321    for (p = core_modules; *p; p++)
322 <    if (!find_module(*p))
322 >    if (!find_module(*p, NO))
323      {
324        ilog(L_CRIT, "Core module %s is missing", *p);
325        server_die("No core modules", 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines