Imported Upstream version 3.3.2
[debian/amanda] / common-src / am_sl.h
1 /*
2  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3  * Copyright (c) 1991-1998 University of Maryland at College Park
4  * All Rights Reserved.
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and its
7  * documentation for any purpose is hereby granted without fee, provided that
8  * the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of U.M. not be used in advertising or
11  * publicity pertaining to distribution of the software without specific,
12  * written prior permission.  U.M. makes no representations about the
13  * suitability of this software for any purpose.  It is provided "as is"
14  * without express or implied warranty.
15  *
16  * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22  *
23  * Author: James da Silva, Systems Design and Analysis Group
24  *                         Computer Science Department
25  *                         University of Maryland at College Park
26  */
27 /*
28  * $Id: sl.h,v 1.4 2006/05/25 01:47:12 johnfranks Exp $
29  *
30  * A doubly linked list of string (char *)
31  */
32
33 /*
34  * To scan over all element of the list
35  *
36  *    for(sle=sl->first; sle != NULL; sle = sle->next) {
37  *    }
38  */
39 #ifndef STRINGLIST_H
40 #define STRINGLIST_H
41
42 #include "amanda.h"
43
44 typedef struct sle_s {
45     struct sle_s *next, *prev;
46     char *name;
47 } sle_t;
48
49 typedef struct sl_s {
50     struct sle_s *first, *last;
51     int nb_element;
52 } am_sl_t;
53
54 void init_sl(am_sl_t *sl);
55 am_sl_t *new_sl(void);
56 am_sl_t *insert_sl(am_sl_t *sl, char *name);
57 am_sl_t *append_sl(am_sl_t *sl, char *name);
58 am_sl_t *insert_sort_sl(am_sl_t *sl, char *name);
59 void free_sl(am_sl_t *sl);
60 void remove_sl(am_sl_t *sl,sle_t *elem);
61 am_sl_t *duplicate_sl(am_sl_t *sl);
62 int  is_empty_sl(am_sl_t *sl);
63
64 #endif