cvs: /php3/functions hw.c
| From: | Uwe Steinmann | Date: | Wed, 01 Sep 1999 06:15:43 +0000 |
| Subject: | cvs: /php3/functions hw.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-10402@lists.php.net to get a copy of this message | ||
steinm Wed Sep 1 02:15:43 1999 EDT
Modified files:
/php3/functions hw.c
Log:
- Group-attribute may now appear multiple times in objrec record.
Index: php3/functions/hw.c
diff -u php3/functions/hw.c:1.48 php3/functions/hw.c:1.49
--- php3/functions/hw.c:1.48 Tue Aug 31 09:13:09 1999
+++ php3/functions/hw.c Wed Sep 1 02:15:42 1999
@@ -23,7 +23,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: hw.c,v 1.48 1999/08/31 13:13:09 steinm Exp $ */
+/* $Id: hw.c,v 1.49 1999/09/01 06:15:42 steinm Exp $ */
#if COMPILE_DL
#include "dl/phpdl.h"
@@ -249,13 +249,15 @@
*/
int make_return_array_from_objrec(pval **return_value, char *objrec) {
char *attrname, *str, *temp, language[3], *title;
- int iTitle, iDesc, iKeyword;
+ int iTitle, iDesc, iKeyword, iGroup;
pval title_arr;
pval desc_arr;
pval keyword_arr;
+ pval group_arr;
int hasTitle = 0;
int hasDescription = 0;
int hasKeyword = 0;
+ int hasGroup = 0;
if (array_init(*return_value) == FAILURE) {
(*return_value)->type = IS_STRING;
@@ -293,6 +295,13 @@
hasKeyword = 1;
str += 8;
iKeyword = 1;
+ } else if(0 == strncmp(attrname, "Group=", 6)) {
+ if ((hasGroup == 0) && (array_init(&group_arr) == FAILURE)) {
+ return -1;
+ }
+ hasGroup = 1;
+ str += 6;
+ iGroup = 1;
}
if(iTitle || iDesc || iKeyword) { /* Poor error check if end of string */
if(str[2] == ':') {
@@ -309,7 +318,11 @@
add_assoc_string(&desc_arr, language, title, 1);
else if(iKeyword)
add_assoc_string(&keyword_arr, language, title, 1);
- }
+ } else if(iGroup) {
+ if(iGroup)
+ add_next_index_string(&group_arr, str, 1);
+ }
+
attrname = strtok(NULL, "\n");
}
efree(temp);
@@ -335,6 +348,13 @@
/* The keyword array can now be freed, but I don't know how */
}
+ if(hasGroup) {
+ /* Add the Group array, if we have one */
+ _php3_hash_update((*return_value)->value.ht, "Group", 6, &group_arr,
sizeof(pval), NULL);
+
+ /* The group array can now be freed, but I don't know how */
+ }
+
/* All other attributes. Make a another copy first */
temp = estrdup(objrec);
attrname = strtok(temp, "\n");
@@ -343,6 +363,7 @@
/* We don't want to insert titles, descr., keywords a second time */
if((0 != strncmp(attrname, "Title=", 6)) &&
(0 != strncmp(attrname, "Description=", 12)) &&
+ (0 != strncmp(attrname, "Group=", 6)) &&
(0 != strncmp(attrname, "Keyword=", 8))) {
while((*str != '=') && (*str != '\0'))
str++;