make menu work on mingw (run command is still disabled), based on patch by Christophe Perinaud

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10865 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
faust3 2003-09-13 18:02:20 +00:00
parent 9f1d1bc466
commit 67831d551c
2 changed files with 12 additions and 6 deletions

View File

@ -7,7 +7,9 @@
#include <ctype.h> #include <ctype.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#ifndef __MINGW32__
#include <sys/wait.h> #include <sys/wait.h>
#endif
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
@ -223,6 +225,7 @@ static void read_cmd(menu_t* menu,int cmd) {
} }
static void check_child(menu_t* menu) { static void check_child(menu_t* menu) {
#ifndef __MINGW32__
fd_set rfd; fd_set rfd;
struct timeval tv; struct timeval tv;
int max_fd = mpriv->child_fd[2] > mpriv->child_fd[1] ? mpriv->child_fd[2] : int max_fd = mpriv->child_fd[2] > mpriv->child_fd[1] ? mpriv->child_fd[2] :
@ -268,12 +271,14 @@ static void check_child(menu_t* menu) {
w = 1; w = 1;
} }
} }
#endif
} }
#define close_pipe(pipe) close(pipe[0]); close(pipe[1]) #define close_pipe(pipe) close(pipe[0]); close(pipe[1])
static int run_shell_cmd(menu_t* menu, char* cmd) { static int run_shell_cmd(menu_t* menu, char* cmd) {
#ifndef __MINGW32__
int in[2],out[2],err[2]; int in[2],out[2],err[2];
printf("Console run %s ...\n",cmd); printf("Console run %s ...\n",cmd);
@ -311,6 +316,7 @@ static int run_shell_cmd(menu_t* menu, char* cmd) {
mpriv->child_fd[2] = err[0]; mpriv->child_fd[2] = err[0];
mpriv->prompt = mpriv->child_prompt; mpriv->prompt = mpriv->child_prompt;
//add_line(mpriv,"Child process started"); //add_line(mpriv,"Child process started");
#endif
return 1; return 1;
} }
@ -439,7 +445,7 @@ static void read_key(menu_t* menu,int c) {
} }
static int open(menu_t* menu, char* args) { static int openMenu(menu_t* menu, char* args) {
menu->draw = draw; menu->draw = draw;
@ -469,5 +475,5 @@ const menu_info_t menu_info_console = {
&cfg_dflt, &cfg_dflt,
cfg_fields cfg_fields
}, },
open, openMenu,
}; };

View File

@ -103,19 +103,19 @@ static void free_entry(list_entry_t* entry) {
free(entry); free(entry);
} }
static void close(menu_t* menu) { static void closeMenu(menu_t* menu) {
menu_list_uninit(menu,free_entry); menu_list_uninit(menu,free_entry);
if(mpriv->edit) if(mpriv->edit)
free(mpriv->edit); free(mpriv->edit);
} }
static int open(menu_t* menu, char* args) { static int openMenu(menu_t* menu, char* args) {
list_entry_t* e; list_entry_t* e;
menu->draw = menu_list_draw; menu->draw = menu_list_draw;
menu->read_cmd = menu_list_read_cmd; menu->read_cmd = menu_list_read_cmd;
menu->read_key = read_key; menu->read_key = read_key;
menu->close = close; menu->close = closeMenu;
if(!args) { if(!args) {
@ -155,5 +155,5 @@ const menu_info_t menu_info_pref = {
&cfg_dflt, &cfg_dflt,
cfg_fields cfg_fields
}, },
open openMenu
}; };