]> Pileus Git - wmpus/blobdiff - util.c
Add floating layer
[wmpus] / util.c
diff --git a/util.c b/util.c
index 7425be00fa41ab37cd3437ad01204633c808be7d..325c2a2b8ab397dfcd7fd360d3abf0d4a3109d7b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1,9 +1,27 @@
+/*
+ * Copyright (C) 2011 Andy Spencer <andy753421@gmail.com>
+ * 
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
 
 #include "util.h"
 
+/* Doubly linked lists */
 list_t *list_insert(list_t *next, void *data)
 {
        list_t *node = new0(list_t);
@@ -57,6 +75,13 @@ int list_length(list_t *node)
        return len;
 }
 
+list_t *list_last(list_t *list)
+{
+       while (list && list->next)
+               list = list->next;
+       return list;
+}
+
 list_t *list_find(list_t *list, void *data)
 {
        for (list_t *cur = list; cur; cur = cur->next)