From 84516616d9547a46e6676ba7e942edc60009345a Mon Sep 17 00:00:00 2001 From: hackbard Date: Thu, 8 Jul 2004 12:06:19 +0000 Subject: [PATCH] major bugfixes, still need clean up + improvements, not to mention speex and video stuff --- src/Makefile | 2 +- src/ivac.c | 50 ++++++++++++++++++++++++++------------------------ src/start_ivac | 25 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 25 deletions(-) create mode 100755 src/start_ivac diff --git a/src/Makefile b/src/Makefile index 1b567db..ca8d2e4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,7 @@ INCLUDEDIR = /usr/include -CFLAGS = -DDISPLAY -DDEBUG -O3 -Wall +CFLAGS = -O3 -Wall LIBS = -lncurses OBJS = network.o event.o input.o display.o audio.o diff --git a/src/ivac.c b/src/ivac.c index f6a1118..12e5f59 100644 --- a/src/ivac.c +++ b/src/ivac.c @@ -342,6 +342,11 @@ int ivac_parse_command(t_input *input,void *ptr) { valid=0; /* refresh prompt content only */ +#ifdef DEBUG + sprintf(debug_string,"-> %02x c_count = %d",input->content[input->c_count-1], + input->c_count); + ivac_add_to_monitor(ivac,debug_string); +#endif ivac_display_prompt_content(ivac); ivac_display_draw(ivac); @@ -359,18 +364,21 @@ int ivac_parse_command(t_input *input,void *ptr) { /* get args */ len=0; - while(data[len]!='\n'||data[len]!='\r') len++; + while(data[len]!='\n'&&data[len]!='\r') len++; +#ifdef DEBUG + sprintf(debug_string,"len = %d\n",len); + ivac_add_to_monitor(ivac,debug_string); +#endif i=0; j=0; while((inet.connection[channel].ip, ivac->net.connection[channel].port); event_math(ivac->net.connection[channel].fd,&(ivac->event),READ,ADD); ivac_send_info(channel,ivac); } + else if(i==N_E_CONNECT) + sprintf(c_str,"channel %02d: connection error - %s", + channel,sys_errlist[errno]); } else sprintf(c_str,"invalid argument: '%s'",arg[1]); } @@ -484,14 +495,13 @@ int ivac_parse_command(t_input *input,void *ptr) { /* add console string to console buffer */ ivac_add_to_monitor(ivac,c_str); - /* refresh whole display content */ - ivac_display_content(ivac); - ivac_display_draw(ivac); - /* delete input content buffer + reset counter */ memset(input->content,0,input->c_count-1); input->c_count=0; + /* refresh whole display content */ + ivac_display_content(ivac); + ivac_display_draw(ivac); } return SUCCESS; @@ -561,14 +571,17 @@ int ivac_display_console(t_ivac *ivac) { int ivac_display_console_content(t_ivac *ivac) { - int i; + int i,size; char string[IVAC_CONSOLE_STRING_LEN]; for(i=0;iconsole[i]); + size=strlen(ivac->console[i]); + size=(sizeconsole[i],size); + memset(string+size,' ',IVAC_CONSOLE_STRING_LEN-size); display_string(&(ivac->display), 0,ivac->display.max_y-IVAC_PROMPT_LEN-IVAC_CONSOLE_LEN+1+i, - string,strlen(string)); + string,IVAC_CONSOLE_STRING_LEN); } return SUCCESS; @@ -585,25 +598,14 @@ int ivac_display_prompt_content(t_ivac *ivac) { char string[IVAC_CONSOLE_STRING_LEN]; int count; -#ifdef DEBUG - char debug_string[IVAC_CONSOLE_STRING_LEN]; -#endif for(count=0;countinput.c_count;count++) string[count]=ivac->input.content[count]; for(count=ivac->input.c_count;countdisplay),8,ivac->display.max_y-1, - string,ivac->display.max_x); + string,IVAC_CONSOLE_STRING_LEN-8); -#ifdef DEBUG - sprintf(debug_string,"%02x %02x %02x %02x ...",ivac->input.content[0], - ivac->input.content[1], - ivac->input.content[2], - ivac->input.content[3]); - ivac_add_to_monitor(ivac,debug_string); -#endif - return SUCCESS; } diff --git a/src/start_ivac b/src/start_ivac new file mode 100755 index 0000000..426d436 --- /dev/null +++ b/src/start_ivac @@ -0,0 +1,25 @@ +#!/bin/bash + +KEEPLOG=1 + +# ivac start script +if [ ! -d ~/.ivac ] ; then + echo "creating .ivac directory ..." + mkdir ~/.ivac +fi + +IVAC=`type -p ivac` +[ -z "$IVAC" ] && IVAC="./ivac" + +if [ ! -e $IVAC ] ; then + echo "ivac executable not found :(" +else + echo "running $IVAC ..." + $IVAC $@ 2> ~/.ivac/log + if [ -z "`echo $@ | grep -- -h`" ] ; then + reset + clear + fi +fi + +[ "$KEEPLOG" = "0" ] && rm -f ~/.ivac/log -- 2.39.2