140412Sbostic /*
262085Sbostic  * Copyright (c) 1988, 1989, 1990, 1993
362085Sbostic  *	The Regents of the University of California.  All rights reserved.
440411Sbostic  *
540412Sbostic  * This code is derived from software contributed to Berkeley by
640412Sbostic  * Adam de Boor.
740411Sbostic  *
842741Sbostic  * %sccs.include.redist.c%
940411Sbostic  */
1040412Sbostic 
1140411Sbostic #ifndef lint
12*69094Schristos static char sccsid[] = "@(#)lstDeQueue.c	8.2 (Berkeley) 04/28/95";
1340412Sbostic #endif /* not lint */
1440411Sbostic 
1540412Sbostic /*-
1640412Sbostic  * LstDeQueue.c --
1740412Sbostic  *	Remove the node and return its datum from the head of the list
1840412Sbostic  */
1940412Sbostic 
2040411Sbostic #include	"lstInt.h"
2140411Sbostic 
2240411Sbostic /*-
2340411Sbostic  *-----------------------------------------------------------------------
2440411Sbostic  * Lst_DeQueue --
2540411Sbostic  *	Remove and return the datum at the head of the given list.
2640411Sbostic  *
2740411Sbostic  * Results:
2840411Sbostic  *	The datum in the node at the head or (ick) NIL if the list
2940411Sbostic  *	is empty.
3040411Sbostic  *
3140411Sbostic  * Side Effects:
3240411Sbostic  *	The head node is removed from the list.
3340411Sbostic  *
3440411Sbostic  *-----------------------------------------------------------------------
3540411Sbostic  */
3640411Sbostic ClientData
Lst_DeQueue(l)3740411Sbostic Lst_DeQueue (l)
3840411Sbostic     Lst	    	  l;
3940411Sbostic {
4040411Sbostic     ClientData	  rd;
4140411Sbostic     register ListNode	tln;
4240411Sbostic 
4340411Sbostic     tln = (ListNode) Lst_First (l);
4440411Sbostic     if (tln == NilListNode) {
4540411Sbostic 	return ((ClientData) NIL);
4640411Sbostic     }
4740411Sbostic 
4840411Sbostic     rd = tln->datum;
4940411Sbostic     if (Lst_Remove (l, (LstNode)tln) == FAILURE) {
5040411Sbostic 	return ((ClientData) NIL);
5140411Sbostic     } else {
5240411Sbostic 	return (rd);
5340411Sbostic     }
5440411Sbostic }
5540411Sbostic 
56