/*------- LL Double linked list library: core functions ---------------- */
/*  author: G. Matas                           (g.matas@ee.surrey.ac.uk) */
/* +-------------------------------------------------------------------+ */
/* | Copyright 1992, 1993, George Matas.                               | */
/* |   Permission to use, copy, modify, and distribute this software   | */
/* |   and its documentation for any purpose and without fee is hereby | */
/* |   granted, provided that the above copyright notice appear in all | */
/* |   copies and that both that copyright notice and this permission  | */
/* |   notice appear in supporting documentation.  This software is    | */
/* |   provided "as is" without express or implied warranty.           | */
/* +-------------------------------------------------------------------+
*/

/*
  The code bellow was kindly made available by David Kastrup under
  these conditions:
*/

/* listsort.c
 * Copyright (c) 1992 David Kastrup, Goethestra"se~20/22, W-5100~Aachen,
 *       Germany
 * You are allowed to use this software in any form, even
 * in commercial software, as long as you do not restrain the right of
 * those using your software to obtain this code. That is, you must inform
 * your customer that this piece of code is in your program, and must provide
 * the unmodified source to him at request, at not more than a moderate
 * copying charge. You can save yourself this work if you include this in
 * source in your distribution. It is small enough.
 *
 * Other than that, you are free to use this software at will.
 */

/* The sort routine. Arguments are a pointer to the head pointer of
   a list to be sorted, as well as the number of elements to sort.
   Only n elements will be sorted, the rest of the list will not be
   disturbed. listsort returns a pointer to the head pointer of the
   rest of the list, located in the last element of the sorted part
   of the list. Thus if listsort calls itself recursively to sort
   the first half of a list, this call returns the head pointer of
   the second half to be sorted, list traversal thus being done on
   the fly.
*/

