Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include <errno.h>
  2.   2 #include "node.h"
  3.   3 #include "dir.h"
  4.   4
  5.   5 int getnoderelativeto(const char *path, struct node *root, struct node **node){
  6.   6         if (!S_ISDIR(root->vstat.st_mode)){
  7.   7                 errno = ENOTDIR;
  8.   8                 return 0;
  9.   9         }
  10.  10
  11.  11         if (path[0] != '/'){
  12.  12                 errno = EINVAL;
  13.  13                 return 0;
  14.  14         }
  15.  15
  16.  16         if (path[1] == '\0'){
  17.  17                 *node = root;
  18.  18                 return 1;
  19.  19         }
  20.  20
  21.  21         const char *name = path + 1;
  22.  22         int namelen = 0;
  23.  23         const char *name_end = name;
  24.  24
  25.  25         while (*name_end != '\0' )
  26.  26 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement