version 1.16 | | version 1.17 |
---|
| | |
/* | | /* |
* static char *rcsid_plugins_c = | | * static char *rcsid_plugins_c = |
* "$Id: plugins.c,v 1.16 2002/03/20 06:27:46 mwedel Exp $"; | | * "$Id: plugins.c,v 1.17 2002/09/07 22:08:07 mwedel Exp $"; |
*/ | | */ |
| | |
/*****************************************************************************/ | | /*****************************************************************************/ |
| | |
char buf2[MAX_BUF]; | | char buf2[MAX_BUF]; |
| | |
LOG(llevInfo,"Now initializing plugins\n"); | | LOG(llevInfo,"Now initializing plugins\n"); |
strcpy(buf,DATADIR); | | strcpy(buf,LIBDIR); |
strcat(buf,"/plugins/"); | | strcat(buf,"/plugins/"); |
LOG(llevInfo,"Plugins directory is %s\n",buf); | | LOG(llevInfo,"Plugins directory is %s\n",buf); |
| | |
| | |
void initPlugins(void) | | void initPlugins(void) |
{ | | { |
struct dirent **namelist=NULL; | | struct dirent **namelist=NULL; |
int n; | | int n,l; |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
char buf2[MAX_BUF]; | | char buf2[MAX_BUF]; |
| | |
LOG(llevInfo,"Initializing plugins :\n"); | | LOG(llevInfo,"Initializing plugins :\n"); |
strcpy(buf,DATADIR); | | strcpy(buf,LIBDIR); |
strcat(buf,"/plugins/"); | | strcat(buf,"/plugins/"); |
n = scandir(buf, &namelist, 0, alphasort); | | n = scandir(buf, &namelist, 0, alphasort); |
if (n < 0) | | if (n < 0) |
| | |
else | | else |
while(n--) | | while(n--) |
{ | | { |
if (strcmp(namelist[n]->d_name,"..")) | | l=strlen(namelist[n]->d_name); |
| | if (l>strlen(PLUGIN_SUFFIX)) |
{ | | { |
if (strcmp(namelist[n]->d_name,".")) | | if (!strcmp(namelist[n]->d_name+l-strlen(PLUGIN_SUFFIX),PLUGIN_SUFFIX)) |
{ | | { |
strcpy(buf2,buf); | | strcpy(buf2,buf); |
strcat(buf2,namelist[n]->d_name); | | strcat(buf2,namelist[n]->d_name); |