summaryrefslogtreecommitdiff
path: root/libbb/llist.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-10-25 00:33:44 +0000
committerDenis Vlasenko2006-10-25 00:33:44 +0000
commitc8400a216206a848f6c4b83b668df37f6fb546ee (patch)
tree4aa28c4440e6c150a31188f1910b6a945176c27c /libbb/llist.c
parent44c7917cab43713a034622bfb6e464de92cf8f1c (diff)
downloadbusybox-c8400a216206a848f6c4b83b668df37f6fb546ee.zip
busybox-c8400a216206a848f6c4b83b668df37f6fb546ee.tar.gz
wget: wget $'-\207' ... should not be allowed to work. ever. :)
So fix wget & getopt32. Also fix multiple --header options order: add and use rev_llist.
Diffstat (limited to 'libbb/llist.c')
-rw-r--r--libbb/llist.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libbb/llist.c b/libbb/llist.c
index 8bf89a5..8a74832 100644
--- a/libbb/llist.c
+++ b/libbb/llist.c
@@ -62,3 +62,17 @@ void llist_free(llist_t *elm, void (*freeit)(void *data))
if (freeit) freeit(data);
}
}
+
+/* Reverse list order. Useful since getopt32 saves option params
+ * in reverse order */
+llist_t* rev_llist(llist_t *list)
+{
+ llist_t *new = NULL;
+ while (list) {
+ llist_t *next = list->link;
+ list->link = new;
+ new = list;
+ list = next;
+ }
+ return new;
+}