Exemplo n.º 1
0
static int ptfs_getattr(const char *path, struct stat *stbuf) { 
	unsigned int inode, SID;	
	bzero(stbuf, sizeof(struct stat));

	if ( strcmp( path, "/" ) == 0 ) {
		stbuf->st_mode = S_IFDIR | 0500;
		stbuf->st_nlink = sessCounter + 2;
		stbuf->st_mtime = mounttime;
		stbuf->st_atime = root_atime;
		stbuf->st_ctime = mounttime;
		stbuf->st_size = sessCounter + 2;
		stbuf->st_uid = getuid();
		stbuf->st_gid = getgid();
		return 0;
	}

	if ( strncmp( path, link_current, strlen(link_current)-1 ) == 0 ) {
		makestat( stbuf, &sessions[sessCounter-1].nodes[0].st, &sessions[sessCounter-1].st );
		stbuf->st_mode = S_IFLNK | 0500;
		stbuf->st_size = strlen(sessions[sessCounter-1].nm)+1;
		stbuf->st_atime = link_curr_atime;
		return 0;
	}
	
	if ( strncmp( path, link_previous, strlen(link_previous)-1 ) == 0 ) {
		if ( sessCounter < 2 ) return -ENOENT;
		makestat( stbuf, &sessions[sessCounter-2].nodes[0].st, &sessions[sessCounter-2].st );
		stbuf->st_mode = S_IFLNK | 0500;
		stbuf->st_size = strlen(sessions[sessCounter-2].nm)+1;
		stbuf->st_atime = link_prev_atime;
		return 0;
	}
	
	SID = findsession( path );
	if ( SID == -1 ) return -ENOENT;
	inode = findbypath( sessions[SID], hidedate(path) );
	if ( inode == -1 ) return -ENOENT;
	
	makestat( stbuf, &sessions[SID].nodes[inode].st, &sessions[SID].st );
	
	return 0;
}
Exemplo n.º 2
0
int main(int argc, char* argv[])
{
    initscr();
    scrollok(stdscr, TRUE);
    wprintw(stdscr, "Welcome to Scripted ver. %d.%d for the Brave Quest engine.\nCopyright 2012 Mad Science Inc.\nPlease do not redistrubute.\n",scriptedvernum,scriptedvernum2);
    stufffilename();
    if(loadscript(filename) == 1)
    {
        wprintw(stdscr, "File not Found. Would you like to make a new file?\n");
        if(bie() == 'y')
        {
            cleanfilebuff();
            if(savescript(filename) == 1)
            {
                wprintw(stdscr, "Your disk sucks.\n");
                bi();
                return 1;
            }
        }
        else
        {
            wprintw(stdscr, "Goodbye.\n");
            endwin();
            return 1;
        }
    }
    currlinenum = linenum;
    menu();
    wprintw(stdscr, "Press escape to go to the save menu\n");
    for(;;)
    {
        wprintw(stdscr, "q= give, w= take, e= say, r= flag, t= move, y= battle, u= check flag, i= check item, o= party add, p= party remove, [ = check character\n");
        wprintw(stdscr, "a= warp, s= check experience, d= give experience, f= make experience, g= exec script, h= screen effect, j= user input, k= goline, l= make health\n");
        wprintw(stdscr, "b= check stat, n= make stat, m= blank, ,= show line, .= change line.\n");
        input[0] = bie();
        if(input[0] == 27)
            menu();
        if(input[0] == 'q')
            give();
        if(input[0] == 'w')
            take();
        if(input[0] == 'e')
            say();
        if(input[0] == 'r')
            flag();
        if(input[0] == 't')
            mmove();
        if(input[0] == 'y')
            battle();
        if(input[0] == 'u')
            checkflag();
        if(input[0] == 'i')
            checkitem();
        if(input[0] == 'o')
            partyadd();
        if(input[0] == 'p')
            partyrm();
        if(input[0] == '[')
            checkparty();
        if(input[0] == 'a')
            warp();
        if(input[0] == 's')
            checkexp();
        if(input[0] == 'd')
            giveexp();
        if(input[0] == 'f')
            makeexp();
        if(input[0] == 'g')
            execscript();
        if(input[0] == 'h')
            screeneffect();
        if(input[0] == 'j')
            userinput();
        if(input[0] == 'k')
            goline();
        if(input[0] == 'l')
            makehealth();
        if(input[0] == 'z')
            teachspell();
        if(input[0] == 'x')
            unlearnspell();
        if(input[0] == 'b')
            checkstat();
        if(input[0] == 'n')
            makestat();
        if(input[0] == 'm')
            blank();
        if(input[0] == ',')
            showline();
        if(input[0] == '.')
            changeline();
        if(currlinenum > linenum)
            linenum = currlinenum;
    }
    return 0;
};