somwhere_in_libcurl()
{
  path = "/here/*/*.log"  // in conn
  
  if (wildcard_enabled) {
    resolving_path("/"); // entry here
  }
}

nowvoid resolve_path(part)
{
  if (part == "/") 
    go("/"); // protocol dependent, .. in FTP => CWD /
  else {
    go(deletelastslash(part));
  }

  part = get_next_part_of_path(path); 
  path = path + strlen(part);
  
  if (empty(part)) {
    // probably LIST the directory?
    // what to do, when user wants: ftp://debian.org/*/ ? 
    // i think, that ftp://debian.org/debian-archive/*/ should do the same as
    //      ftp://debian.org/debian-archive/debian/
    //      ftp://debian.org/debian-archive/debian-amd64/
    //      ftp://debian.org/debian-archive/.../
    // but others protocols are "future" questions
  }
  else {
    if (wildcard_exists(part)) {
      // we could be:                ====vvvv
      // ftp://debian.org/debian-archive/HERE*/   or
      // ftp://debian.org/debian-archive/HERE*    or
      // ftp://debian.org/debian-archive/HERE*/next-folder...
      get_list_and_parse(); // content should be dependet on protocol
      match_and_fill_fifo's(); // makes 2 FIFO's matched_dirs and matched_files

      if (ends_with_slash(part)) {
        // we could be:
        // ftp://debian.org/debian-archive/HERE*/   or
        // ftp://debian.org/debian-archive/HERE*/next-folder...
        while (!empty(matched_dirs)) {
          resolve_path(matched_dirs->next); // call recursive
          delete_first(matched_dirs);
        }
      }
      else {
        // we are:
        // ftp://debian.org/debian-archive/HERE*
        while (!empty(matched_files)) {
          download_file(matched_files->next); // protocol dependent function
          delete_first(matched_files);
        }

        if (allowed_recursive_download) {
          while (!empty(matched_dirs)) {
            resolve_path(matched_dirs->next."/*"); // path has to be concatenated with "/*"
            delete_first(matched_dirs);
          }  
        }
        else {
          // do nothing, we cannot go deeper, if user have disallowed it
        }
      }
    }
    else { 
      // we could be:
      // ftp://debian.org/*archiive/HERE/   or
      // ftp://debian.org/*archive/HERE     or
      // ftp://debian.org/*archive/HERE/next-folder...
      if (ends_with_slash(part)) {
        // we are:
        // ftp://debian.org/*archiive/HERE/   or
        // ftp://debian.org/*archive/HERE/next-folder...
        resolve_path(part);
      }
      else  {
        // we are
        // ftp://debian.org/*archive/HERE
        download_file(part); 
      }
    }
  }

  go(up); // cd ..
}
