]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - list.c
Bash-4.4 patch 4
[thirdparty/bash.git] / list.c
diff --git a/list.c b/list.c
index 794b664bcd06dd94ffde1d4a3961d74a3d26832f..88835f58e517bcd1f510183048478278e020f76f 100644 (file)
--- a/list.c
+++ b/list.c
@@ -1,27 +1,29 @@
 /* list.c - Functions for manipulating linked lists of objects. */
 
-/* Copyright (C) 1996
-   Free Software Foundation, Inc.
+/* Copyright (C) 1996-2009 Free Software Foundation, Inc.
 
    This file is part of GNU Bash, the Bourne Again SHell.
 
-   Bash 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 2, or (at your option) any later
-   version.
+   Bash 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.
 
-   Bash 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.
+   Bash 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 Bash; see the file COPYING.  If not, write to the Free Software
-   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   You should have received a copy of the GNU General Public License
+   along with Bash.  If not, see <http://www.gnu.org/licenses/>.
+*/
 
 #include "config.h"
 
 #if defined (HAVE_UNISTD_H)
+#  ifdef _MINIX
+#    include <sys/types.h>
+#  endif
 #  include <unistd.h>
 #endif
 
 /* A global variable which acts as a sentinel for an `error' list return. */
 GENERIC_LIST global_error_list;
 
+#ifdef INCLUDE_UNUSED
 /* Call FUNCTION on every member of LIST, a generic list. */
 void
-map_over_list (list, function)
+list_walk (list, function)
      GENERIC_LIST *list;
-     Function *function;
+     sh_glist_func_t *function;
 {
   for ( ; list; list = list->next)
-    (*function) (list);
+    if ((*function) (list) < 0)
+      return;
 }
 
 /* Call FUNCTION on every string in WORDS. */
 void
-map_over_words (words, function)
+wlist_walk (words, function)
      WORD_LIST *words;
-     Function *function;
+     sh_icpfunc_t *function;
 {
   for ( ; words; words = words->next)
-    (*function) (words->word->word);
+    if ((*function) (words->word->word) < 0)
+      return;
 }
+#endif /* INCLUDE_UNUSED */
 
 /* Reverse the chain of structures in LIST.  Output the new head
    of the chain.  You should always assign the output value of this
    function to something, or you will lose the chain. */
 GENERIC_LIST *
-reverse_list (list)
+list_reverse (list)
      GENERIC_LIST *list;
 {
   register GENERIC_LIST *next, *prev;
@@ -103,11 +109,11 @@ list_append (head, tail)
    then ARG.  Note that LIST contains the address of a variable which points
    to the list.  You might call this function like this:
 
-   SHELL_VAR *elt = delete_element (&variable_list, check_var_has_name, "foo");
+   SHELL_VAR *elt = list_remove (&variable_list, check_var_has_name, "foo");
    dispose_variable (elt);
 */
 GENERIC_LIST *
-delete_element (list, comparer, arg)
+list_remove (list, comparer, arg)
      GENERIC_LIST **list;
      Function *comparer;
      char *arg;