1ea6ae205Smrg/*
2ea6ae205Smrg  Copyright (c) 2002 by Juliusz Chroboczek
3ea6ae205Smrg
4ea6ae205Smrg  Permission is hereby granted, free of charge, to any person obtaining a copy
5ea6ae205Smrg  of this software and associated documentation files (the "Software"), to deal
6ea6ae205Smrg  in the Software without restriction, including without limitation the rights
7ea6ae205Smrg  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8ea6ae205Smrg  copies of the Software, and to permit persons to whom the Software is
9ea6ae205Smrg  furnished to do so, subject to the following conditions:
10ea6ae205Smrg
11ea6ae205Smrg  The above copyright notice and this permission notice shall be included in
12ea6ae205Smrg  all copies or substantial portions of the Software.
13ea6ae205Smrg
14ea6ae205Smrg  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15ea6ae205Smrg  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16ea6ae205Smrg  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17ea6ae205Smrg  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18ea6ae205Smrg  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19ea6ae205Smrg  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20ea6ae205Smrg  THE SOFTWARE.
21ea6ae205Smrg*/
22ea6ae205Smrg
23ea6ae205Smrg#ifndef _MKS_LIST_H_
24ea6ae205Smrg#define _MKS_LIST_H_ 1
25ea6ae205Smrg
26245f6787Smrg#include <X11/Xfuncproto.h> /* for _X_ATTRIBUTE_PRINTF */
27245f6787Smrg
28663cdc11Smrgchar *dsprintf(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
29ea6ae205Smrg
30ea6ae205Smrgtypedef struct _List {
31ea6ae205Smrg    char *value;
32ea6ae205Smrg    struct _List *next;
33ea6ae205Smrg} ListRec, *ListPtr;
34ea6ae205Smrg
35663cdc11Smrgint listMember(const char *elt, ListPtr list);
36ea6ae205SmrgListPtr listCons(char *car, ListPtr cdr);
37ea6ae205SmrgListPtr listAdjoin(char *car, ListPtr cdr);
38663cdc11SmrgListPtr listConsF(ListPtr cdr, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
39663cdc11SmrgListPtr listAdjoinF(ListPtr cdr, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
40ea6ae205Smrgint listLength(ListPtr list);
41ea6ae205SmrgListPtr appendList(ListPtr first, ListPtr second);
42ea6ae205SmrgListPtr makeList(char **a, int n, ListPtr old, int begin);
43ea6ae205SmrgListPtr reverseList(ListPtr old);
44245f6787SmrgListPtr sortList(ListPtr old);
45ea6ae205Smrgvoid destroyList(ListPtr old);
46ea6ae205Smrgvoid deepDestroyList(ListPtr old);
47ea6ae205Smrg
48ea6ae205Smrg#endif /* _MKS_LIST_H_ */
49