Lines Matching full:stack
16 char stack[PATH_MAX+1]; in realpath() local
25 l = strnlen(filename, sizeof stack); in realpath()
31 p = sizeof stack - l - 1; in realpath()
33 memcpy(stack+p, filename, l+1); in realpath()
35 /* Main loop. Each iteration pops the next part from stack of in realpath()
38 * pushed to the stack. */ in realpath()
40 for (; ; p+=slash_len(stack+p)) { in realpath()
41 /* If stack starts with /, the whole component is / or // in realpath()
43 if (stack[p] == '/') { in realpath()
50 if (stack[p] == '/' && stack[p+1] != '/') in realpath()
55 char *z = __strchrnul(stack+p, '/'); in realpath()
56 l0 = l = z-(stack+p); in realpath()
61 if (l==1 && stack[p]=='.') { in realpath()
71 stack[--p] = '/'; in realpath()
75 memcpy(output+q, stack+p, l); in realpath()
80 if (l0==2 && stack[p-2]=='.' && stack[p-1]=='.') { in realpath()
95 ssize_t k = readlink(output, stack, p); in realpath()
111 check_dir = stack[p]; in realpath()
120 * stack to avoid /->// or //->/// or spurious toolong. */ in realpath()
121 if (stack[k-1]=='/') while (stack[p]=='/') p++; in realpath()
123 memmove(stack+p, stack, k); in realpath()
125 /* Skip the stack advancement in case we have a new in realpath()
133 if (!getcwd(stack, sizeof stack)) return 0; in realpath()
134 l = strlen(stack); in realpath()
138 while(l>1 && stack[l-1]!='/') l--; in realpath()
143 if (q-p && stack[l-1]!='/') stack[l++] = '/'; in realpath()
146 memcpy(output, stack, l); in realpath()