From 7226fdf27a138b5f96b1232e0d8431d97189acd8 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Fri, 14 Jun 2002 19:34:19 +0000 Subject: [PATCH] * strgutil.c (pop_strlist): New function to pop the head off of a strlist. --- util/ChangeLog | 5 +++++ util/strgutil.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/util/ChangeLog b/util/ChangeLog index 27245a78d..ec4a285b9 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,8 @@ +2002-06-14 David Shaw + + * strgutil.c (pop_strlist): New function to pop the head off of a + strlist. + 2002-06-05 Timo Schulz * fileutil.c (is_file_compressed): Corrected the magic values diff --git a/util/strgutil.c b/util/strgutil.c index 6ad434006..ff1ff5126 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -168,7 +168,23 @@ strlist_last( STRLIST node ) return node; } +char * +pop_strlist( STRLIST *list ) +{ + char *str=NULL; + STRLIST sl=*list; + if(sl) + { + str=m_alloc(strlen(sl->d)+1); + strcpy(str,sl->d); + + *list=sl->next; + m_free(sl); + } + + return str; +} /**************** * look for the substring SUB in buffer and return a pointer to that