Remove unused __imlib_FileField functions.
SVN revision: 47773
This commit is contained in:
parent
3eb65fa228
commit
d3bdadd623
106
src/lib/file.c
106
src/lib/file.c
|
@ -13,8 +13,6 @@
|
|||
#include <pwd.h>
|
||||
#include "file.h"
|
||||
|
||||
static void __imlib_FileFieldWord(char *s, int num, char *wd);
|
||||
|
||||
char *
|
||||
__imlib_FileKey(const char *file)
|
||||
{
|
||||
|
@ -400,107 +398,3 @@ __imlib_FileHomeDir(int uid)
|
|||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* gets word number [num] in the string [s] and copies it into [wd] */
|
||||
/* wd is NULL terminated. If word [num] does not exist wd = "" */
|
||||
/* NB: this function now handles quotes so for a line: */
|
||||
/* Hello to "Welcome sir - may I Help" Shub Foo */
|
||||
/* Word 1 = Hello */
|
||||
/* Word 2 = to */
|
||||
/* Word 3 = Welcome sir - may I Help */
|
||||
/* Word 4 = Shub */
|
||||
/* word 5 = Foo */
|
||||
|
||||
char *
|
||||
__imlib_FileField(char *s, int field)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
buf[0] = 0;
|
||||
__imlib_FileFieldWord(s, field + 1, buf);
|
||||
if (buf[0])
|
||||
{
|
||||
if ((!strcmp(buf, "NULL")) || (!strcmp(buf, "(null)")))
|
||||
return (NULL);
|
||||
return (strdup(buf));
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
__imlib_FileFieldWord(char *s, int num, char *wd)
|
||||
{
|
||||
char *cur, *start, *end;
|
||||
int count, inword, inquote, len;
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
if (!wd)
|
||||
return;
|
||||
*wd = 0;
|
||||
if (num <= 0)
|
||||
return;
|
||||
cur = s;
|
||||
count = 0;
|
||||
inword = 0;
|
||||
inquote = 0;
|
||||
start = NULL;
|
||||
end = NULL;
|
||||
while ((*cur) && (count < num))
|
||||
{
|
||||
if (inword)
|
||||
{
|
||||
if (inquote)
|
||||
{
|
||||
if (*cur == '"')
|
||||
{
|
||||
inquote = 0;
|
||||
inword = 0;
|
||||
end = cur;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isspace(*cur))
|
||||
{
|
||||
end = cur;
|
||||
inword = 0;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isspace(*cur))
|
||||
{
|
||||
if (*cur == '"')
|
||||
{
|
||||
inquote = 1;
|
||||
start = cur + 1;
|
||||
}
|
||||
else
|
||||
start = cur;
|
||||
inword = 1;
|
||||
}
|
||||
}
|
||||
if (count == num)
|
||||
break;
|
||||
cur++;
|
||||
}
|
||||
if (!start)
|
||||
return;
|
||||
if (!end)
|
||||
end = cur;
|
||||
if (end <= start)
|
||||
return;
|
||||
len = (int)(end - start);
|
||||
if (len > 4000)
|
||||
len = 4000;
|
||||
if (len > 0)
|
||||
{
|
||||
strncpy(wd, start, len);
|
||||
wd[len] = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ __hidden void __imlib_FileFreeDirList(char **l, int num);
|
|||
__hidden void __imlib_FileDel(char *s);
|
||||
__hidden time_t __imlib_FileModDate(const char *s);
|
||||
__hidden char *__imlib_FileHomeDir(int uid);
|
||||
__hidden char *__imlib_FileField(char *s, int field);
|
||||
__hidden int __imlib_FilePermissions(const char *s);
|
||||
__hidden int __imlib_FileCanRead(const char *s);
|
||||
__hidden int __imlib_IsRealFile(const char *s);
|
||||
|
|
Loading…
Reference in New Issue