示例#1
0
void
reset_drive (void)
{
  /* reset last_drive
     This routine is called whenever a UJ disk command is sent, or similar
     reset means are employed */

  int i;

  /* cutesy startup message */
  set_error (73, 0, 0);
  /* clear incoming command channel */
  if (curr_client > -1)
    dos_comm_len[curr_client] = 0;

  /* reset subdirectories */
  for (i = 1; i < 255; i++)
  {
    curr_par[curr_client] = i;
    if (partn_dirs[curr_client][curr_par[curr_client]])
      set_current_dir (partn_dirs[curr_client][curr_par[curr_client]]);
  }				/* for(i=1;i<255;i++) */

  /* set default partition to 1 */
  curr_par[curr_client] = 1;

}
示例#2
0
文件: pw.c 项目: Distrotech/joe
static int rtnpw(BW *bw)
{
	W *w = bw->parent;
	PW *pw = (PW *) bw->object;
	unsigned char *s;
	W *win;
	int *notify;
	int (*pfunc) ();
	void *object;
	long byte;

	/* Extract entered text from buffer */
	p_goto_eol(bw->cursor);
	byte = bw->cursor->byte;
	p_goto_bol(bw->cursor);
	s = brvs(bw->cursor, (int) (byte - bw->cursor->byte));

	/* Save text into history buffer */
	if (pw->hist) {
		if (bw->b->changed) {
			append_history(pw->hist, sv(s));
		} else {
			promote_history(pw->hist, bw->cursor->line);
		}
	}

	/* Do ~ expansion and set new current directory */
	if (pw->file_prompt&2) {
		set_current_dir(s,1);
	}

	if (pw->file_prompt) {
		s = canonical(s);
	}

	win = w->win;
	pfunc = pw->pfunc;
	object = pw->object;
	bwrm(bw);
	joe_free(pw->prompt);
	joe_free(pw);
	w->object = NULL;
	notify = w->notify;
	w->notify = 0;
	wabort(w);
	dostaupd = 1;

	/* Call callback function */
	if (pfunc) {
		return pfunc(win->object, s, object, notify);
	} else {
		return -1;
	}
}
示例#3
0
bool sil_load(string file_path)
{
	string cur_dir=get_current_dir();
	string file_full_path=get_file_full_path(file_path);
	set_current_dir(get_file_dir(file_path));
	int ip=get_new_code_addr(true);
	grammar_parser parser;
	parser.load_file(file_full_path);
	parser.complie();
	bool b_result=false;
	if(error_printer::get_error_count()==0)
	{
		//print_code();
		interpret vm(get_top_gener());
		vm.run(ip);
		b_result=true;
	}
	set_current_dir(cur_dir);
	return b_result;
}
示例#4
0
void FileDialog::set_current_path(const String& p_path) {
	
	if (!p_path.size())
		return;
	int pos=MAX( p_path.find_last("/"), p_path.find_last("\\") );
	if (pos==-1) {
		
		set_current_file(p_path);
	} else {
		
		String dir=p_path.substr(0,pos);
		String file=p_path.substr(pos+1,p_path.length());
		set_current_dir(dir);
		set_current_file(file);
	}
}
示例#5
0
文件: fs.c 项目: jpbottaro/minios
int fs_chdir(const char *path)
{
    struct inode_s *ino, *dir;

    ino = dir = NULL;

    dir = current_dir();
    if ( (ino = find_inode(dir, path, FS_SEARCH_GET)) == NULL)
        goto err;
    release_inode(dir);

    if (!IS_DIR(ino->i_mode))
        goto err;

    set_current_dir(ino);
    release_inode(ino);

    return OK;

err:
    release_inode(dir);
    release_inode(ino);
    return ERROR;
}