示例#1
0
static void check(const char *cwd, const char *path, const char *good)
{
	static int n = 0;
	printf("%-2d: %10s$ cd %s", ++n, cwd, path);
	char *t = pathexpand(cwd, path);
	if ( strcmp(t, good) )
		printf(" ____________________failed(%s)\n", t);
	else
		printf(" \033[32m%s\033[0m\n", t);
	free(t);
}
示例#2
0
static str
pathiterate (str path, str *sch, 
	     int recdepth = 0, bool firsttime = false)
{
//   warn << print_indent (recdepth) << "iteratepath: " << path << "\n";
  str s = pathexpand (path, sch, recdepth);
  if (path == s && !firsttime)
    return path;

  vec<str> components;
  split (&components, "/", s);
  str newpath ("");
  for (unsigned int i = 1; i < components.size (); i++) {
    newpath = pathiterate (newpath << "/" << components[i], sch,
			   recdepth + 5);
//     warn << print_indent (recdepth) << newpath << "\n";
  }
  return newpath;
}