libroken: Build on windows
[openafs.git] / src / update / utils.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13 #include <roken.h>
14
15 #include <afs/stds.h>
16 #include <rx/rxkad.h>
17 #include "global.h"
18 #ifdef AFS_NT40_ENV
19 #include <afs/errmap_nt.h>
20 #include <afs/afsutil.h>
21 #include <WINNT/afssw.h>
22 #endif
23 #include <stdio.h>
24 #include <string.h>
25 #ifdef HAVE_UNISTD_H
26 #include <unistd.h>
27 #endif
28 #include <stdlib.h>
29
30 int
31 AddToList(struct filestr **ah, char *aname)
32 {
33     struct filestr *tf;
34     tf = (struct filestr *)malloc(sizeof(struct filestr));
35     tf->next = *ah;
36     *ah = tf;
37     tf->name = (char *)malloc(strlen(aname) + 1);
38     strcpy(tf->name, aname);
39     return 0;
40 }
41
42 int
43 ZapList(struct filestr **ah)
44 {
45     struct filestr *tf, *nf;
46     for (tf = *ah; tf; tf = nf) {
47         nf = tf->next;          /* save before freeing */
48         free(tf->name);
49         free(tf);
50     }
51     *ah = NULL;
52     return 0;
53 }