fixed status output if channels are in

a different order.
This commit is contained in:
armin 2000-06-13 10:51:06 +00:00
parent b1daea1eec
commit 238f8bf530
1 changed files with 22 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $Id: imon.c,v 1.3 1997/05/17 12:23:35 fritz Exp $
/* $Id: imon.c,v 1.4 2000/06/13 10:51:06 armin Exp $
*
* iMON , extended version.
* original iMON source (c) Michael Knigge
@ -19,6 +19,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: imon.c,v $
* Revision 1.4 2000/06/13 10:51:06 armin
* fixed status output if channels are in
* a different order.
*
* Revision 1.3 1997/05/17 12:23:35 fritz
* Corrected some Copyright notes to refer to GPL.
*
@ -299,7 +303,7 @@ int imon_draw_mask(int color) {
wattroff(stathdr, COLOR_PAIR(WHITE_ON_BLACK));
wattron(stathdr, COLOR_PAIR(YELLOW_ON_BLUE));
}
mvaddstr(1, 2, "iMON 2.0");
mvaddstr(1, 2, "iMON 2.1");
mvaddstr(1, COLS-23 , "Last Update: ");
mvwaddstr(stathdr, 0, 0, "Nr. LineID Status Phone Number Usage Type ");
wmove(stathdr, 1, 0);
@ -340,6 +344,7 @@ int imon_draw_status(int color, time_t *current_time) {
char *ptr_idmap;
char *ptr_chmap;
char *ptr_drmap;
char *ptr_usage;
char *ptr_flags;
char *ptr_phone;
@ -355,16 +360,26 @@ int imon_draw_status(int color, time_t *current_time) {
int usage;
int chanum;
int flags;
int drvnum;
int flags[ISDN_MAX_DRIVERS];
int line;
int len;
ptr_idmap = idmap_line + 7;
ptr_chmap = chmap_line + 7;
ptr_drmap = drmap_line + 7;
ptr_usage = usage_line + 7;
ptr_flags = flags_line + 7;
ptr_phone = phone_line + 7;
/*
* get flags for all drivers
*/
for(line=0; line<ISDN_MAX_DRIVERS; line++) {
sscanf(ptr_flags, "%d %n", &flags[line], &len);
ptr_flags += len;
}
/*
* now print info for every line
*/
@ -378,10 +393,8 @@ int imon_draw_status(int color, time_t *current_time) {
ptr_phone += len;
sscanf(ptr_chmap, "%d %n", &chanum, &len);
ptr_chmap += len;
if (chanum == 0) {
sscanf(ptr_flags, "%d %n", &flags, &len);
ptr_flags += len;
}
sscanf(ptr_drmap, "%d %n", &drvnum, &len);
ptr_drmap += len;
/* A channel-number of -1 indicates an nonexistent channel */
if (chanum==-1) {
@ -409,7 +422,7 @@ int imon_draw_status(int color, time_t *current_time) {
sprintf(s_usage, " ");
sprintf(inout, " ");
} else {
int online = (flags & (1<<chanum));
int online = (flags[drvnum] & (1<<chanum));
if (color) {
if (online)
wattron(statwin, COLOR_PAIR(RED_ON_BLUE));