Ejemplo n.º 1
0
void update(void)
{
  StatRec stats;

  if (check_mnt_table())
    get_mnt_table();
  cur_changed = False;
  root_modified = check(rootdir);
  cur_modified = dirModified(curdir);
  shelf_modified = dirModified(shelfdir);
  if (!root_modified && !cur_modified && !shelf_modified)
    return;
  if (root_modified || shelf_modified ||
      !dirIsReadable(shelfdir) && !stat(dirName(shelfdir), &stats) &&
      S_ISDIR(stats.st_mode))
    WaitMsg("Updating view, please wait ...");
  else
    Wait();
  if (root_modified)
    dirUpdate(rootdir);
  if (shelf_modified)
    dirUpdate(shelfdir);
  else if (!dirIsReadable(shelfdir) && !stat(dirName(shelfdir), &stats) &&
	   S_ISDIR(stats.st_mode)) {
    /* force shelf to be reread */
    dirReread(shelfdir);
    dirReadFileInfo(shelfdir);
    shelf_modified = True;
  }
  cur_check();
  Done();
}
Ejemplo n.º 2
0
void restat(void)
{
  int d;

  if (check_mnt_table())
    get_mnt_table();
  root_modified = cur_modified = shelf_modified = True;
  WaitMsg("Rebuilding view, please wait ...");
  dirRestat(rootdir);
  dirRestat(shelfdir);
  cur_check();
  Done();
}
Ejemplo n.º 3
0
int NetworkClient::LoginToServer(std::string pass, std::string login)
{
  if(SendMsg(login+"*"+pass) <= 0){
    Disconnect();
    return -1;}
  std::string buffer; 
  if(WaitMsg(buffer) <= 0){
    Disconnect();
    return -1;}
  if((buffer[0] == 'O') && (buffer[1] ==  'K'))
    return 0;
  else
    {
      Disconnect();
      return -1;
    }
}
Ejemplo n.º 4
0
void cur_check(void)
{
  cur_changed = dirFindSubdir(rootdir, save_cur_path, &curdir) == NULL;
  if (!curdir)
    curdir = rootdir;
  if (cur_changed)
    update_cur_path(dirName(curdir));
  if (!dirHasFileInfo(curdir)) {
    if (dirIsReadable(curdir) ||
	dirDev(curdir) == NONE && !(dirOptions(curdir) & NOMOUNT)) {
      int l = strlen(dirName(curdir)) + 8;
      String msg = alloca((l+1) * sizeof(char));
      sprintf(msg, "Reading %s", dirName(curdir));
      WaitMsg(msg);
    }
    if (dirReadFileInfo(curdir))
      cur_modified = True;
  }
}
Ejemplo n.º 5
0
Boolean cur_chdir(String name)
{
  DirPtr newdir;
  StatRec stats;

  root_modified = cur_modified = shelf_modified = cur_changed = False;
  if (!strcmp(dirName(curdir), name) && dirIsReadable(curdir))
    return True;
  else {
    Wait();
    root_modified = True;
    if (!dirSearchSubdir(rootdir, name, &newdir) ||
	strcmp(dirName(newdir), name)) {
      if (!newdir)
	root_modified = False;
      Done();
      return False;
    } else if (curdir != newdir || !dirIsReadable(curdir)) {
      int l = strlen(dirName(newdir)) + 8;
      String msg = alloca((l+1) * sizeof(char));
      sprintf(msg, "Reading %s", dirName(newdir));
      WaitMsg(msg);
      cur_modified = cur_changed = True;
      dirFreeFileInfo(curdir);
      curdir = newdir;
      if (dirOptions(curdir) & NOMOUNT)
	/* force remount */
	dirRestat(curdir);
      if (dirModified(curdir) && dirHasSubdirInfo(curdir))
	dirUpdateSubdirInfo(curdir);
      dirReadFileInfo(curdir);
      update_cur_path(dirName(curdir));
      Done();
      return True;
    }
  }
}