From aec58f676420528d25d16bd70419b5a616d9daa6 Mon Sep 17 00:00:00 2001
From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org>
Date: Sat, 4 Apr 1998 03:15:40 +0200
Subject: [PATCH] bugfix (to allow arrays to tokenize).

Rev: src/modules/MIME/mime.c:1.11
---
 src/modules/MIME/mime.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/modules/MIME/mime.c b/src/modules/MIME/mime.c
index da5c9af598..f3e0afcb7a 100644
--- a/src/modules/MIME/mime.c
+++ b/src/modules/MIME/mime.c
@@ -1,5 +1,5 @@
 /*
- * $Id: mime.c,v 1.10 1997/06/26 01:02:48 marcus Exp $
+ * $Id: mime.c,v 1.11 1998/04/04 01:15:40 mirar Exp $
  *
  * RFC1521 functionality for Pike
  *
@@ -9,7 +9,7 @@
 #include "config.h"
 
 #include "global.h"
-RCSID("$Id: mime.c,v 1.10 1997/06/26 01:02:48 marcus Exp $");
+RCSID("$Id: mime.c,v 1.11 1998/04/04 01:15:40 mirar Exp $");
 #include "stralloc.h"
 #include "pike_macros.h"
 #include "object.h"
@@ -594,7 +594,20 @@ static void f_tokenize( INT32 args )
 {
   if (args != 1)
     error( "Wrong number of arguments to MIME.tokenize()\n" );
-  else if (sp[-1].type != T_STRING)
+
+  if (sp[-1].type == T_ARRAY)
+  {
+     /* take first entry from array */
+     struct array *a=sp[-1].u.array;
+     if (a->size>0)
+     {
+	sp--;
+	push_svalue(a->item+0);
+	free_array(a);
+     }
+  }
+
+  if (sp[-1].type != T_STRING)
     error( "Wrong type of argument to MIME.tokenize()\n" );
   else {
 
-- 
GitLab