Commit | Line | Data |
---|---|---|
bb2109e7 KB |
1 | /* |
2 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | |
3 | * All rights reserved. | |
c65fedcf | 4 | * |
bb2109e7 KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Adam de Boor. | |
c65fedcf | 7 | * |
f15db449 | 8 | * %sccs.include.redist.c% |
c65fedcf | 9 | */ |
bb2109e7 | 10 | |
c65fedcf | 11 | #ifndef lint |
f15db449 | 12 | static char sccsid[] = "@(#)lstEnQueue.c 5.3 (Berkeley) %G%"; |
bb2109e7 KB |
13 | #endif /* not lint */ |
14 | ||
15 | /*- | |
16 | * LstEnQueue.c-- | |
17 | * Treat the list as a queue and place a datum at its end | |
18 | */ | |
c65fedcf KB |
19 | |
20 | #include "lstInt.h" | |
21 | ||
22 | /*- | |
23 | *----------------------------------------------------------------------- | |
24 | * Lst_EnQueue -- | |
25 | * Add the datum to the tail of the given list. | |
26 | * | |
27 | * Results: | |
28 | * SUCCESS or FAILURE as returned by Lst_Append. | |
29 | * | |
30 | * Side Effects: | |
31 | * the lastPtr field is altered all the time and the firstPtr field | |
32 | * will be altered if the list used to be empty. | |
33 | * | |
34 | *----------------------------------------------------------------------- | |
35 | */ | |
36 | ReturnStatus | |
37 | Lst_EnQueue (l, d) | |
38 | Lst l; | |
39 | ClientData d; | |
40 | { | |
41 | if (LstValid (l) == FALSE) { | |
42 | return (FAILURE); | |
43 | } | |
44 | ||
45 | return (Lst_Append (l, Lst_Last(l), d)); | |
46 | } | |
47 |