47 lines
1.3 KiB
C
47 lines
1.3 KiB
C
/*-
|
|
* LstAtFront.c --
|
|
* Add a node at the front of the list
|
|
*
|
|
* Copyright (c) 1988 by the Regents of the University of California
|
|
*
|
|
* 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: lstAtFront.c,v 1.3 88/11/17 20:51:51 adam Exp $ SPRITE (Berkeley)";
|
|
#endif lint
|
|
|
|
#include "lstInt.h"
|
|
|
|
/*-
|
|
*-----------------------------------------------------------------------
|
|
* Lst_AtFront --
|
|
* Place a piece of data at the front of a list
|
|
*
|
|
* Results:
|
|
* SUCCESS or FAILURE
|
|
*
|
|
* Side Effects:
|
|
* A new ListNode is created and stuck at the front of the list.
|
|
* hence, firstPtr (and possible lastPtr) in the list are altered.
|
|
*
|
|
*-----------------------------------------------------------------------
|
|
*/
|
|
ReturnStatus
|
|
Lst_AtFront (l, d)
|
|
Lst l;
|
|
ClientData d;
|
|
{
|
|
register LstNode front;
|
|
|
|
front = Lst_First (l);
|
|
return (Lst_Insert (l, front, d));
|
|
}
|