48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/*-
|
|
* LstEnQueue.c--
|
|
* Treat the list as a queue and place a datum at its end
|
|
*
|
|
* Copyright (c) 1988 by University of California Regents
|
|
*
|
|
* 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 appears in all copies. Neither the University of California nor
|
|
* Adam de Boor makes any representations about the suitability of this
|
|
* software for any purpose. It is provided "as is" without
|
|
* express or implied warranty.
|
|
*/
|
|
#if !defined(lint) && defined(keep_rcsid)
|
|
static char *rcsid =
|
|
"Id: lstEnQueue.c,v 1.4 88/11/17 20:52:26 adam Exp $ SPRITE (Berkeley)";
|
|
#endif lint
|
|
|
|
#include "lstInt.h"
|
|
|
|
/*-
|
|
*-----------------------------------------------------------------------
|
|
* Lst_EnQueue --
|
|
* Add the datum to the tail of the given list.
|
|
*
|
|
* Results:
|
|
* SUCCESS or FAILURE as returned by Lst_Append.
|
|
*
|
|
* Side Effects:
|
|
* the lastPtr field is altered all the time and the firstPtr field
|
|
* will be altered if the list used to be empty.
|
|
*
|
|
*-----------------------------------------------------------------------
|
|
*/
|
|
ReturnStatus
|
|
Lst_EnQueue (l, d)
|
|
Lst l;
|
|
ClientData d;
|
|
{
|
|
if (LstValid (l) == FALSE) {
|
|
return (FAILURE);
|
|
}
|
|
|
|
return (Lst_Append (l, Lst_Last(l), d));
|
|
}
|
|
|