/** * Timered function to check if the console has a new event to be read. * @param tid: timer id * @param tick: tick of execution * @param id: user account id * @param data: unused * @return 0 */ int cnslif_console_timer(int tid, unsigned int tick, int id, intptr_t data) { char buf[MAX_CONSOLE_IN]; //max cmd atm is 63+63+63+3+3 memset(buf,0,MAX_CONSOLE_IN); //clear out buf if(cli_hasevent()){ if(fgets(buf, MAX_CONSOLE_IN, stdin)==NULL) return -1; else if(strlen(buf)>MIN_CONSOLE_IN) cnslif_parse(buf); } return 0; }
// Console Command Parser [Wizputer] //FIXME to be remove (moved to cnslif / will be done once map/char/login, all have their cnslif interface ready) int parse_console(const char* buf){ return cnslif_parse(buf); }