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