annotate files.c @ 8:97243badae69

split place stuff to its own file
author David A. Holland
date Sun, 19 Dec 2010 19:15:55 -0500
parents b8167949474a
children 1fbcbd58742e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
1 #include <stdbool.h>
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
2 #include <stdio.h>
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
3 #include <stdlib.h>
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
4 #include <unistd.h>
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
5 #include <fcntl.h>
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
6 #include <err.h>
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
7
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
8 #include "array.h"
8
97243badae69 split place stuff to its own file
David A. Holland
parents: 7
diff changeset
9 #include "place.h"
6
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
10 #include "files.h"
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
11
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
12 struct incdir {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
13 const char *name;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
14 bool issystem;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
15 };
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
16
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
17 struct seenfile {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
18 struct place includedfrom;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
19 char *name;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
20 bool fromsystemdir;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
21 };
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
22
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
23 DECLARRAY(incdir);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
24 DECLARRAY(seenfile);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
25 DEFARRAY(incdir, );
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
26 DEFARRAY(seenfile, );
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
27
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
28 static struct incdirarray quotepath, bracketpath;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
29 static struct seenfilearray seenfiles;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
30
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
31 ////////////////////////////////////////////////////////////
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
32 // management
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
33
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
34 #define DESTROYALL(T) \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
35 static \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
36 void \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
37 T##array_destroyall(struct T##array *arr) \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
38 { \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
39 unsigned i, num; \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
40 struct T *t; \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
41 \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
42 num = T##array_num(arr); \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
43 for (i=0; i<num; i++) { \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
44 t = T##array_get(arr, i); \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
45 T##_destroy(t); \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
46 } \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
47 T##array_setsize(arr, 0); \
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
48 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
49
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
50 static
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
51 struct incdir *
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
52 incdir_create(const char *name, bool issystem)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
53 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
54 struct incdir *id;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
55
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
56 id = domalloc(sizeof(*id));
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
57 id->name = name;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
58 id->issystem = issystem;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
59 return id;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
60 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
61
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
62 static
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
63 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
64 incdir_destroy(struct incdir *id)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
65 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
66 free(id);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
67 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
68
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
69 static
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
70 struct seenfile *
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
71 seenfile_create(const struct place *from, char *name, bool fromsystemdir)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
72 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
73 struct seenfile *sf;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
74
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
75 sf = domalloc(sizeof(*sf));
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
76 sf->includedfrom = *from;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
77 sf->name = name;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
78 sf->fromsystemdir = fromsystemdir;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
79 return sf;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
80 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
81
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
82 static
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
83 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
84 seenfile_destroy(struct seenfile *sf)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
85 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
86 free(sf->name);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
87 free(sf);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
88 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
89
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
90 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
91 files_init(void)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
92 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
93 incdirarray_init(&quotepath);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
94 incdirarray_init(&bracketpath);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
95 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
96
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
97 DESTROYALL(incdir);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
98 DESTROYALL(seenfile);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
99
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
100 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
101 files_cleanup(void)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
102 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
103 seenfilearray_destroyall(&seenfiles);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
104 seenfilearray_cleanup(&seenfiles);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
105
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
106 incdirarray_destroyall(&quotepath);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
107 incdirarray_cleanup(&quotepath);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
108 incdirarray_destroyall(&bracketpath);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
109 incdirarray_cleanup(&bracketpath);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
110 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
111
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
112 ////////////////////////////////////////////////////////////
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
113 // path setup
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
114
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
115 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
116 files_addquotepath(const char *dir, bool issystem)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
117 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
118 struct incdir *id;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
119
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
120 id = incdir_create(dir, issystem);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
121 incdirarray_add(&quotepath, id, NULL);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
122 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
123
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
124 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
125 files_addbracketpath(const char *dir, bool issystem)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
126 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
127 struct incdir *id;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
128
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
129 id = incdir_create(dir, issystem);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
130 incdirarray_add(&bracketpath, id, NULL);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
131 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
132
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
133 ////////////////////////////////////////////////////////////
8
97243badae69 split place stuff to its own file
David A. Holland
parents: 7
diff changeset
134 // seenfile functions exposed for places.c
6
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
135
8
97243badae69 split place stuff to its own file
David A. Holland
parents: 7
diff changeset
136 const char *
97243badae69 split place stuff to its own file
David A. Holland
parents: 7
diff changeset
137 seenfile_getname(const struct seenfile *file)
6
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
138 {
8
97243badae69 split place stuff to its own file
David A. Holland
parents: 7
diff changeset
139 return file->name;
7
b8167949474a make places work better
David A. Holland
parents: 6
diff changeset
140 }
b8167949474a make places work better
David A. Holland
parents: 6
diff changeset
141
8
97243badae69 split place stuff to its own file
David A. Holland
parents: 7
diff changeset
142 const struct place *
97243badae69 split place stuff to its own file
David A. Holland
parents: 7
diff changeset
143 seenfile_getincludeplace(const struct seenfile *file)
6
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
144 {
8
97243badae69 split place stuff to its own file
David A. Holland
parents: 7
diff changeset
145 return &file->includedfrom;
6
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
146 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
147
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
148 ////////////////////////////////////////////////////////////
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
149 // parsing
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
150
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
151 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
152 file_read(struct seenfile *sf, int fd);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
153
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
154 ////////////////////////////////////////////////////////////
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
155 // path search
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
156
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
157 static
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
158 int
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
159 file_tryopen(const char *file)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
160 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
161 int fd;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
162
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
163 fd = open(file, O_RDONLY);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
164 if (fd < 0) {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
165 return -1;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
166 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
167 /* XXX: do we need to do anything here or is this function pointless?*/
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
168 return fd;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
169 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
170
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
171 static
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
172 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
173 file_search(struct place *place, struct incdirarray *path, const char *name)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
174 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
175 unsigned i, num;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
176 struct incdir *id;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
177 struct seenfile *sf;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
178 char *file;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
179 int fd;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
180
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
181 assert(place != NULL);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
182
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
183 num = incdirarray_num(path);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
184 for (i=0; i<num; i++) {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
185 id = incdirarray_get(path, i);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
186 file = dostrdup3(id->name, "/", name);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
187 fd = file_tryopen(file);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
188 if (fd >= 0) {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
189 sf = seenfile_create(place, file, id->issystem);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
190 seenfilearray_add(&seenfiles, sf, NULL);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
191 file_read(sf, fd);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
192 close(fd);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
193 return;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
194 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
195 free(file);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
196 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
197 complain(place, "Include file %s not found", name);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
198 complain_fail();
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
199 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
200
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
201 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
202 file_readquote(struct place *place, const char *name)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
203 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
204 file_search(place, &quotepath, name);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
205 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
206
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
207 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
208 file_readbracket(struct place *place, const char *name)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
209 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
210 file_search(place, &bracketpath, name);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
211 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
212
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
213 void
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
214 file_readabsolute(struct place *place, const char *name)
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
215 {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
216 struct seenfile *sf;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
217 int fd;
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
218
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
219 assert(place != NULL);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
220
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
221 fd = file_tryopen(name);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
222 if (fd < 0) {
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
223 warn("%s", name);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
224 die();
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
225 }
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
226 sf = seenfile_create(place, dostrdup(name), false);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
227 seenfilearray_add(&seenfiles, sf, NULL);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
228 file_read(sf, fd);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
229 close(fd);
0601b6e8e53d checkpoint - can find files
David A. Holland
parents:
diff changeset
230 }