/*
    (C) 1995 AROS - The Amiga Replacement OS
    $Id: remhead.c 1.1 1995/11/05 22:49:09 digulla Exp digulla $
    $Log: remhead.c $
 * Revision 1.1  1995/11/05  22:49:09  digulla
 * Initial revision
 *
    Desc:
    Lang: english
*/
/* I want the macros */
#define AROS_ALMOST_COMPATIBLE
#include "exec_intern.h"

/*****************************************************************************

    NAME */
	#include <exec/lists.h>
	#include <clib/exec_protos.h>

	__AROS_LH1I(struct Node *, RemHead,

/*  SYNOPSIS */
	__AROS_LA(struct List *, list, A0),

/*  LOCATION */
	struct SysBase *, SysBase, 43, Exec)

/*  FUNCTION
	Remove the first node from a list.

    INPUTS
	list - Remove the node from this list

    RESULT
	The node that has been removed.

    NOTES

    EXAMPLE
	struct List * list;
	struct Node * head;

	// Remove node and return it
	head = RemHead (list);

    BUGS

    SEE ALSO

    INTERNALS

    HISTORY
	26-08-95    digulla created after EXEC-Routine
	26-10-95    digulla adjusted to new calling scheme

******************************************************************************/
{
    struct Node * node;

    assert (list);
    /*
	Unfortunately, there is no (quick) check that the node
	is in a list
    */

    /* Get the address of the first node or NULL */
    if (node = GetHead (list))
    {
	/* normal code to remove a node */
	node->ln_Pred->ln_Succ = node->ln_Succ;
	node->ln_Succ->ln_Pred = node->ln_Pred;
    }

    /* Return the address or NULL */
    return node;
} /* RemHead */

