208 |
|
* output - NULL if not found or pointer to module |
209 |
|
* side effects - NONE |
210 |
|
*/ |
211 |
< |
dlink_node * |
211 |
> |
struct module * |
212 |
|
findmodule_byname(const char *name) |
213 |
|
{ |
214 |
< |
dlink_node *ptr; |
215 |
< |
struct module *modp; |
214 |
> |
dlink_node *ptr = NULL; |
215 |
|
|
216 |
|
DLINK_FOREACH(ptr, mod_list.head) |
217 |
|
{ |
218 |
< |
modp = ptr->data; |
218 |
> |
struct module *modp = ptr->data; |
219 |
|
|
220 |
|
if (strcmp(modp->name, name) == 0) |
221 |
< |
return ptr; |
221 |
> |
return modp; |
222 |
|
} |
223 |
|
|
224 |
|
return NULL; |
381 |
|
int parc, char *parv[]) |
382 |
|
{ |
383 |
|
const char *m_bn = NULL; |
384 |
< |
dlink_node *ptr; |
386 |
< |
struct module *modp; |
384 |
> |
struct module *modp = NULL; |
385 |
|
|
386 |
|
if (!HasOFlag(source_p, OPER_FLAG_MODULE)) |
387 |
|
{ |
392 |
|
|
393 |
|
m_bn = libio_basename(parv[1]); |
394 |
|
|
395 |
< |
if ((ptr = findmodule_byname(m_bn)) == NULL) |
395 |
> |
if ((modp = findmodule_byname(m_bn)) == NULL) |
396 |
|
{ |
397 |
|
sendto_one(source_p, ":%s NOTICE %s :Module %s is not loaded", |
398 |
|
me.name, source_p->name, m_bn); |
399 |
|
return; |
400 |
|
} |
401 |
|
|
402 |
< |
modp = ptr->data; |
405 |
< |
|
406 |
< |
if (modp->core == 1) |
402 |
> |
if (modp->flags & MODULE_FLAG_CORE) |
403 |
|
{ |
404 |
|
sendto_one(source_p, |
405 |
|
":%s NOTICE %s :Module %s is a core module and may not be unloaded", |
407 |
|
return; |
408 |
|
} |
409 |
|
|
414 |
– |
/* XXX might want to simply un dlink it here */ |
415 |
– |
|
410 |
|
if (unload_one_module(m_bn, 1) == -1) |
411 |
|
{ |
412 |
|
sendto_one(source_p, ":%s NOTICE %s :Module %s is not loaded", |
420 |
|
int parc, char *parv[]) |
421 |
|
{ |
422 |
|
const char *m_bn = NULL; |
423 |
< |
dlink_node *ptr; |
430 |
< |
struct module *modp; |
423 |
> |
struct module *modp = NULL; |
424 |
|
int check_core; |
425 |
|
|
426 |
|
if (!HasOFlag(source_p, OPER_FLAG_MODULE)) |
432 |
|
|
433 |
|
m_bn = libio_basename(parv[1]); |
434 |
|
|
435 |
< |
if ((ptr = findmodule_byname(m_bn)) == NULL) |
435 |
> |
if ((modp = findmodule_byname(m_bn)) == NULL) |
436 |
|
{ |
437 |
|
sendto_one(source_p, ":%s NOTICE %s :Module %s is not loaded", |
438 |
|
me.name, source_p->name, m_bn); |
439 |
|
return; |
440 |
|
} |
441 |
|
|
442 |
< |
modp = ptr->data; |
450 |
< |
check_core = modp->core; |
442 |
> |
check_core = (modp->flags & MODULE_FLAG_CORE) != 0; |
443 |
|
|
444 |
|
if (unload_one_module(m_bn, 1) == -1) |
445 |
|
{ |
480 |
|
|
481 |
|
sendto_one(source_p, form_str(RPL_MODLIST), me.name, parv[0], |
482 |
|
modp->name, modp->handle, |
483 |
< |
modp->version, modp->core?"(core)":""); |
483 |
> |
modp->version, (modp->flags & MODULE_FLAG_CORE) ?"(core)":""); |
484 |
|
} |
485 |
|
|
486 |
|
sendto_one(source_p, form_str(RPL_ENDOFMODLIST), |