summaryrefslogtreecommitdiffstats
path: root/src/intrf.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-04-18 18:13:15 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2009-04-18 18:13:15 +0200
commitb9fbd6cadb4f610ccdff30ffc59e87b354cc90d1 (patch)
tree0a5aa9537c2c988d36c719db6fd61e877d11d6ee /src/intrf.c
parent77d476a5ca79f234b5d9840fe83be9637ce94f53 (diff)
Handle more than 80 columns
Diffstat (limited to 'src/intrf.c')
-rw-r--r--src/intrf.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/intrf.c b/src/intrf.c
index 0974fdb..a7ac5d4 100644
--- a/src/intrf.c
+++ b/src/intrf.c
@@ -63,7 +63,7 @@
#include "dir.h"
#include "log.h"
-char intr_buffer_screen[MAX_LINES][LINE_LENGTH+1];
+char intr_buffer_screen[MAX_LINES][BUFFER_LINE_LENGTH+1];
int intr_nbr_line=0;
int screen_buffer_add(const char *_format, ...)
@@ -71,14 +71,14 @@ int screen_buffer_add(const char *_format, ...)
char tmp_line[BUFFER_LINE_LENGTH+1];
char *pos_in_tmp_line=tmp_line;
va_list ap;
+ memset(tmp_line, '\0', sizeof(tmp_line));
va_start(ap,_format);
- memset(tmp_line,'\0',sizeof(tmp_line));
- vsnprintf(tmp_line,BUFFER_LINE_LENGTH,_format,ap);
+ vsnprintf(tmp_line, sizeof(tmp_line), _format, ap);
va_end(ap);
while(pos_in_tmp_line!=NULL && (intr_nbr_line<MAX_LINES))
{
- unsigned int len=strlen(intr_buffer_screen[intr_nbr_line]);
- unsigned int nbr=LINE_LENGTH-len;
+ const unsigned int len=strlen(intr_buffer_screen[intr_nbr_line]);
+ unsigned int nbr=BUFFER_LINE_LENGTH-len;
char *ret_ligne= strchr(pos_in_tmp_line,'\n');
if(ret_ligne!=NULL && ret_ligne-pos_in_tmp_line < nbr)
nbr=ret_ligne-pos_in_tmp_line;
@@ -116,10 +116,8 @@ void screen_buffer_to_stdout()
void screen_buffer_reset()
{
- int i;
intr_nbr_line=0;
- for(i=0;i<MAX_LINES;i++)
- memset(intr_buffer_screen[i],0,LINE_LENGTH+1);
+ memset(intr_buffer_screen, 0, sizeof(intr_buffer_screen));
}
void screen_buffer_to_log()