mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Added attribute lists with commas
SVN revision: 161
This commit is contained in:
parent
71b642f5c6
commit
faefbaf1b0
43
elogd.c
43
elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 2.37 2002/07/02 07:33:48 midas
|
||||||
|
Added attribute lists with commas
|
||||||
|
|
||||||
Revision 2.36 2002/07/01 09:32:32 midas
|
Revision 2.36 2002/07/01 09:32:32 midas
|
||||||
Fixed problem with submitting '------' as only text
|
Fixed problem with submitting '------' as only text
|
||||||
|
|
||||||
@ -2898,23 +2901,47 @@ int i;
|
|||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
memset(list, 0, size*NAME_LENGTH);
|
memset(list, 0, size*NAME_LENGTH);
|
||||||
p = strtok(str, ",");
|
p = str;
|
||||||
if (!p)
|
if (!p || !*p)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while (*p == ' ')
|
while (*p == ' ')
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
for (i=0 ; p && i<size ; i++)
|
for (i=0 ; *p && i<size ; i++)
|
||||||
{
|
{
|
||||||
strcpy(list[i], p);
|
if (*p == '"')
|
||||||
|
{
|
||||||
|
p++;
|
||||||
|
|
||||||
|
strncpy(list[i], p, NAME_LENGTH-1);
|
||||||
|
list[i][NAME_LENGTH-1] = 0;
|
||||||
|
|
||||||
|
if (strchr(list[i], '"'))
|
||||||
|
*strchr(list[i], '"') = 0;
|
||||||
|
|
||||||
|
p += strlen(list[i]) + 1;
|
||||||
|
while (*p == ' ' || *p == ',')
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strncpy(list[i], p, NAME_LENGTH-1);
|
||||||
|
list[i][NAME_LENGTH-1] = 0;
|
||||||
|
|
||||||
|
if (strchr(list[i], ','))
|
||||||
|
*strchr(list[i], ',') = 0;
|
||||||
|
|
||||||
|
p += strlen(list[i]);
|
||||||
|
while (*p == ' ' || *p == ',')
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
while (list[i][strlen(list[i])-1] == ' ')
|
while (list[i][strlen(list[i])-1] == ' ')
|
||||||
list[i][strlen(list[i])-1] = 0;
|
list[i][strlen(list[i])-1] = 0;
|
||||||
|
|
||||||
p = strtok(NULL, ",");
|
if (!*p)
|
||||||
if (!p)
|
|
||||||
break;
|
break;
|
||||||
while (*p == ' ')
|
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == size)
|
if (i == size)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user