Lines Matching defs:cur
124 * in cur, and 1 if it is a directory and we need to add or 0 if we need
131 fsnode *cur;
134 cur = join->next;
136 if (cur == NULL || strcmp(cur->name, name) == 0)
138 if (cur == last) {
139 cur = NULL;
142 cur = cur->next;
144 if (cur == NULL) {
149 if (S_ISDIR(cur->type) && S_ISDIR(st->st_mode)) {
156 __func__, path, cur->child);
157 *curp = cur;
166 inode_type(st->st_mode), path, inode_type(cur->type));
174 if (cur == join->next)
175 join->next = cur->next;
179 p->next != cur; p = p->next)
181 p->next = cur->next;
184 *curp = cur;
200 fsnode *first, *cur, *prev, *last;
220 first = cur = join;
221 while (cur->next != NULL)
222 cur = cur->next;
223 prev = last = cur;
277 if (fsnode_join(&cur, join, last, path, name, &stbuf,
279 cur->child = walk_dir(root, rp, cur,
280 cur->child, replace, follow);
282 } else if (cur) {
283 if (prev == cur) {
289 free(cur->name);
290 free(cur->path);
291 free(cur);
295 cur = create_fsnode(root, dir, name, &stbuf);
296 cur->parent = parent;
299 cur->next = first;
300 first = cur;
302 prev = cur;
303 cur->first = first;
306 prev->next = cur;
307 prev = cur;
309 first = cur;
310 cur->first = first;
311 if (S_ISDIR(cur->type)) {
312 cur->child = walk_dir(root, rp, cur, NULL,
320 curino = link_check(cur->inode);
322 free(cur->inode);
323 cur->inode = curino;
324 cur->inode->nlink++;
332 if (S_ISLNK(cur->type)) {
340 cur->symlink = estrdup(slink);
345 for (cur = first->next; cur != NULL; cur = cur->next)
346 cur->first = first;
357 fsnode *cur;
359 cur = ecalloc(1, sizeof(*cur));
360 cur->path = estrdup(path);
361 cur->name = estrdup(name);
362 cur->inode = ecalloc(1, sizeof(*cur->inode));
363 cur->root = root;
364 cur->type = stbuf->st_mode & S_IFMT;
365 cur->inode->nlink = 1;
366 cur->inode->st = *stbuf;
368 cur->inode->st.st_atime = stampst.st_atime;
369 cur->inode->st.st_mtime = stampst.st_mtime;
370 cur->inode->st.st_ctime = stampst.st_ctime;
372 cur->inode->st.st_atimensec = stampst.st_atimensec;
373 cur->inode->st.st_mtimensec = stampst.st_mtimensec;
374 cur->inode->st.st_ctimensec = stampst.st_ctimensec;
377 cur->inode->st.st_birthtime = stampst.st_birthtime;
378 cur->inode->st.st_birthtimensec = stampst.st_birthtimensec;
381 return (cur);
392 fsnode *cur, *next;
407 for (cur = node->first; cur->next; cur = cur->next) {
408 if (cur->next == node) {
409 cur->next = node->next;
416 for (cur = node; cur != NULL; cur = next) {
417 next = cur->next;
418 if (cur->child) {
419 cur->child->parent = NULL;
420 free_fsnodes(cur->child);
422 if (cur->inode->nlink-- == 1)
423 free(cur->inode);
424 if (cur->symlink)
425 free(cur->symlink);
426 free(cur->path);
427 free(cur->name);
428 free(cur);
704 * dump the fsnodes from `cur'
709 fsnode *cur;
713 for (cur = root; cur != NULL; cur = cur->next) {
714 if (snprintf(path, sizeof(path), "%s/%s", cur->path,
715 cur->name) >= (int)sizeof(path))
719 printf("%s: cur=%8p parent=%8p first=%8p ", __func__,
720 cur, cur->parent, cur->first);
721 printf("%7s: %s", inode_type(cur->type), path);
722 if (S_ISLNK(cur->type)) {
723 assert(cur->symlink != NULL);
724 printf(" -> %s", cur->symlink);
726 assert(cur->symlink == NULL);
728 if (cur->inode->nlink > 1)
729 printf(", nlinks=%d", cur->inode->nlink);
732 if (cur->child) {
733 assert(cur->type == S_IFDIR);
734 dump_fsnodes(cur->child);