static int vlclua_console_read( lua_State *L ) { char psz_buffer[MAX_LINE_LENGTH+1]; int i_size = 0; ReadWin32( GetConsole( L ), psz_buffer, &i_size ); lua_pushlstring( L, psz_buffer, i_size ); return 1; }
static int vlclua_console_read( lua_State *L ) { char psz_buffer[MAX_LINE_LENGTH+1]; int i_size = 0; HANDLE consol = GetConsole( L ); // sunqueen add ReadWin32( &consol/*GetConsole( L )*/, psz_buffer, &i_size ); // sunqueen modify lua_pushlstring( L, psz_buffer, i_size ); return 1; }
vlc_bool_t ReadCommand( intf_thread_t *p_intf, char *p_buffer, int *pi_size ) { int i_read = 0; #ifdef WIN32 if( p_intf->p_sys->i_socket == -1 ) return ReadWin32( p_intf, p_buffer, pi_size ); #endif while( !p_intf->b_die && *pi_size < MAX_LINE_LENGTH && (i_read = net_ReadNonBlock( p_intf, p_intf->p_sys->i_socket == -1 ? STDIN_FILENO : p_intf->p_sys->i_socket, p_buffer + *pi_size, 1, INTF_IDLE_SLEEP ) ) > 0 ) { if( p_buffer[ *pi_size ] == '\r' || p_buffer[ *pi_size ] == '\n' ) break; (*pi_size)++; } /* Connection closed */ if( i_read == -1 ) { p_intf->p_sys->i_socket = -1; p_buffer[ *pi_size ] = 0; return VLC_TRUE; } if( *pi_size == MAX_LINE_LENGTH || p_buffer[ *pi_size ] == '\r' || p_buffer[ *pi_size ] == '\n' ) { p_buffer[ *pi_size ] = 0; return VLC_TRUE; } return VLC_FALSE; }