|
|
@ -253,8 +253,8 @@ s_nodelist *nodelist_open(const char *dir, const char *name, int mode)
|
|
|
|
int lockmode;
|
|
|
|
int lockmode;
|
|
|
|
char *ext; /* extension */
|
|
|
|
char *ext; /* extension */
|
|
|
|
memset(&tmp, '\0', sizeof(s_nodelist));
|
|
|
|
memset(&tmp, '\0', sizeof(s_nodelist));
|
|
|
|
const char *lastname;
|
|
|
|
char *lastname;
|
|
|
|
const char *cutname=name+strlen(name)-3;
|
|
|
|
char *cutname=name+strlen(name)-3;
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Select nodelist index open mode
|
|
|
|
* Select nodelist index open mode
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -278,17 +278,8 @@ s_nodelist *nodelist_open(const char *dir, const char *name, int mode)
|
|
|
|
if( *name == DIRSEPCHR )
|
|
|
|
if( *name == DIRSEPCHR )
|
|
|
|
/* if nodelist name contains full path */
|
|
|
|
/* if nodelist name contains full path */
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* May be i will fix this later. I havent got much
|
|
|
|
|
|
|
|
* time. Sorry :)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
strnxcpy(tmp.name_nodelist, name, sizeof(tmp.name_nodelist));
|
|
|
|
|
|
|
|
strnxcpy(tmp.name_index, name, sizeof(tmp.name_index));
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logerr("nodelist.c: you shold specify only filename, without path");
|
|
|
|
logerr("nodelist.c: you shold specify only filename, without path");
|
|
|
|
exit(255);
|
|
|
|
exit(255);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* if only just a filename */
|
|
|
|
/* if only just a filename */
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -298,10 +289,8 @@ s_nodelist *nodelist_open(const char *dir, const char *name, int mode)
|
|
|
|
if( strcmp(name+strlen(name)-4, ".999") == 0)
|
|
|
|
if( strcmp(name+strlen(name)-4, ".999") == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int count;
|
|
|
|
int count;
|
|
|
|
/* struct dirent *nodelistdir;*/
|
|
|
|
|
|
|
|
struct stat *tmpbuf;
|
|
|
|
struct stat *tmpbuf;
|
|
|
|
/* nodelistdir = opendir(dir);*/
|
|
|
|
char *tmpseek = malloc(255);
|
|
|
|
const char *tmpseek;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 23.00 coming, and i am not at home :(
|
|
|
|
/* 23.00 coming, and i am not at home :(
|
|
|
@ -311,24 +300,19 @@ s_nodelist *nodelist_open(const char *dir, const char *name, int mode)
|
|
|
|
for (count=0; count<365; count++)
|
|
|
|
for (count=0; count<365; count++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
tmpseek = '\0';
|
|
|
|
tmpseek = '\0';
|
|
|
|
strnxcpy(tmpseek, dir, sizeof(&tmpseek));
|
|
|
|
strnxcpy(tmpseek, dir, sizeof(tmpseek));
|
|
|
|
if ((strcmp(&tmpseek[strlen(&tmpseek)-1], DIRSEPCHR)) != 0)
|
|
|
|
if ((strcmp(&tmpseek[strlen(tmpseek)-1], DIRSEPSTR)) != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
strnxcpy(&tmpseek, DIRSEPCHR, sizeof(tmpseek));
|
|
|
|
strnxcpy(tmpseek, DIRSEPSTR, sizeof(tmpseek));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
strnxcpy(&tmpseek, name, sizeof(&tmpseek));
|
|
|
|
strnxcpy(tmpseek, name, sizeof(&tmpseek));
|
|
|
|
sprintf(&tmpseek, "%i", count);
|
|
|
|
sprintf(tmpseek, "%i", count);
|
|
|
|
if( stat(tmpseek, tmpbuf) == 0)
|
|
|
|
if( stat(tmpseek, tmpbuf) == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name = tmpseek;
|
|
|
|
name = tmpseek;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* mydir = readdir(nodelistdir);
|
|
|
|
|
|
|
|
if (stat(nodelistdir.d_name, tmpbuf) == 0)
|
|
|
|
|
|
|
|
lastname = nodelistdir.d_name;
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* closedir(nodelistdir);*/
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
strnxcpy(tmp.name_nodelist, dir, sizeof(tmp.name_nodelist));
|
|
|
|
strnxcpy(tmp.name_nodelist, dir, sizeof(tmp.name_nodelist));
|
|
|
|