[lwatch-cvs] files/src config.h.in,1.15,1.16 control.c,1.16,1.17 control.h,1.6,1.7 lwatch.c,1.21,1.2
Brought to you by:
arturcz
|
From: <os...@us...> - 2004-01-12 11:17:58
|
Update of /cvsroot/lwatch/files/src
In directory sc8-pr-cvs1:/tmp/cvs-serv15165/src
Modified Files:
config.h.in control.c control.h lwatch.c settings.c
Log Message:
Changed way of obtaining terminal width.
Index: config.h.in
===================================================================
RCS file: /cvsroot/lwatch/files/src/config.h.in,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** config.h.in 11 Jan 2004 21:23:48 -0000 1.15
--- config.h.in 12 Jan 2004 11:17:55 -0000 1.16
***************
*** 108,111 ****
--- 108,114 ----
#undef PACKAGE_VERSION
+ /* Define to 1 if you want to compile with resize support. */
+ #undef RESIZE
+
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
Index: control.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/control.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** control.c 11 Jan 2004 23:22:11 -0000 1.16
--- control.c 12 Jan 2004 11:17:55 -0000 1.17
***************
*** 41,55 ****
int loop;
! #ifdef CURSES
! #include <curses.h>
! #include <term.h>
! int win_width; /* Window width */
! int get_term_width() {
! int retval;
! initscr();
! retval=tgetnum("co");
! endwin();
#ifdef DEBUG
printf("Terminal width=%d\n",retval);
--- 41,55 ----
int loop;
! #ifdef RESIZE
! #include <sys/ioctl.h>
! #include <termios.h>
! unsigned short int win_width; /* Window width */
! unsigned short int get_term_width() {
! struct winsize wsz;
! unsigned short int retval;
! if (ioctl(fileno(stdout),TIOCGWINSZ,&wsz)) wsz.ws_col=80; /* Defaults to 80, if it's not a tty and other errors */
! retval=wsz.ws_col;
#ifdef DEBUG
printf("Terminal width=%d\n",retval);
***************
*** 82,86 ****
loop=0;
break;
! #ifdef CURSES
case SIGWINCH: /* Window resize */
printf("aaa\n");
--- 82,86 ----
loop=0;
break;
! #ifdef RESIZE
case SIGWINCH: /* Window resize */
printf("aaa\n");
***************
*** 103,107 ****
sig_check(signal(i,&signal_handle),"");
}
! #ifdef CURSES
sig_check(signal(SIGWINCH,&signal_handle),""); /* Window resize support */
#endif
--- 103,107 ----
sig_check(signal(i,&signal_handle),"");
}
! #ifdef RESIZE
sig_check(signal(SIGWINCH,&signal_handle),""); /* Window resize support */
#endif
Index: control.h
===================================================================
RCS file: /cvsroot/lwatch/files/src/control.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** control.h 11 Jan 2004 23:22:11 -0000 1.6
--- control.h 12 Jan 2004 11:17:55 -0000 1.7
***************
*** 46,50 ****
void show_poll_res(int res, struct pollfd *ufds, int n);
#endif
extern int loop;
! extern int win_width; /* Window width */
--- 46,53 ----
void show_poll_res(int res, struct pollfd *ufds, int n);
#endif
+ #ifdef RESIZE
+ unsigned short int get_term_width(void);
+ #endif
extern int loop;
! extern unsigned short int win_width; /* Window width */
Index: lwatch.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/lwatch.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** lwatch.c 11 Jan 2004 23:22:11 -0000 1.21
--- lwatch.c 12 Jan 2004 11:17:55 -0000 1.22
***************
*** 56,60 ****
checkeof=0;
! #ifdef CURSES
win_width=get_term_width();
#endif
--- 56,60 ----
checkeof=0;
! #ifdef RESIZE
win_width=get_term_width();
#endif
Index: settings.c
===================================================================
RCS file: /cvsroot/lwatch/files/src/settings.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** settings.c 11 Jan 2004 23:22:11 -0000 1.22
--- settings.c 12 Jan 2004 11:17:55 -0000 1.23
***************
*** 105,109 ****
"\tshows unparsed lines (like `last message repeated X times')",
" -O, --omit-rc",
! #ifdef CURSES
" -t, --term-cut",
"\tCut lines to terminal width",
--- 105,109 ----
"\tshows unparsed lines (like `last message repeated X times')",
" -O, --omit-rc",
! #ifdef RESIZE
" -t, --term-cut",
"\tCut lines to terminal width",
***************
*** 131,136 ****
{"show-unparsed",0,0,'s'},
{"omit-rc",0,0,'O'},
! #ifdef CURSES
! {"term-cut",0,0,'t'}¸
#endif
{"help",0,0,'h'},
--- 131,136 ----
{"show-unparsed",0,0,'s'},
{"omit-rc",0,0,'O'},
! #ifdef RESIZE
! {"term-cut",0,0,'t'},
#endif
{"help",0,0,'h'},
***************
*** 201,205 ****
#endif
break;
! #ifdef CURSES
case 't':
lw_conf.term_cut=1;
--- 201,205 ----
#endif
break;
! #ifdef RESIZE
case 't':
lw_conf.term_cut=1;
|