]> git.decadent.org.uk Git - ap-utils.git/blobdiff - lib/sysinfo.c
Imported Upstream version 1.5~pre1
[ap-utils.git] / lib / sysinfo.c
index fd60dccd1f70bf9a817ee9503aca97577e037fec..283309f87779bbe79b2e0d3892f94ead8975ad22 100644 (file)
 #include <unistd.h>
 #include <stdlib.h>
 #include <fcntl.h>
-#include <signal.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include "ap-utils.h"
-#include "ap-curses.h"
 
 #define SYS_DESCR _("System Description: ")
+#define SYSINFO _("System Info")
 
 #define OID_NUM 11
 
 extern WINDOW *main_sub;
-extern int LINES;
 
 void atmel_sysinfo()
 {
@@ -51,13 +49,14 @@ void atmel_sysinfo()
     char message[200];
     int i;
     varbind varbinds[3];
-    struct SysDeviceInfo_ATMEL410 ptr410;
-    struct SysDeviceInfo_ATMEL12350 ptr12350;
-    extern short ap_type;
-    extern char IS_ATMEL12350_VERNET;
+    struct sysDeviceInfo_ATMEL410 str410;
+    struct sysDeviceInfo_ATMEL12350 str12350;
+    extern short ap_type, ap_vendorext;
+    extern int LINES, wait_mode;
+    extern rdprops regdom_types[];
 
     /*
-     * These have to represent used SysDeviceInfo_{ATMEL410,ATMEL12350} members
+     * These have to represent used sysDeviceInfo_{ATMEL410,ATMEL12350} members
      */
     uint32_t ap_sversion;
     char *ap_macaddr;
@@ -75,125 +74,152 @@ void atmel_sysinfo()
        sysDeviceInfo[6] = 0x3E;
     }
 
-    i = 0;
+    print_top(wait_mode == WAIT_TIMEOUT ? POLL_ON : POLL_OFF, SYSINFO);
 
-    varbinds[0].oid = sysDescr;
-    varbinds[0].len_oid = sizeof(sysDescr);
-    varbinds[0].value = sysDescr;
-    varbinds[0].type = NULL_VALUE;
-    varbinds[0].len_val = 0;
-    i++;
-
-    varbinds[1].oid = sysDeviceInfo;
-    varbinds[1].len_oid = sizeof(sysDeviceInfo);
-    varbinds[1].value = sysDeviceInfo;
-    varbinds[1].len_val = 0;
-    varbinds[1].type = NULL_VALUE;
-    i++;
-
-    if (IS_ATMEL12350_VERNET) {
-       varbinds[2].oid = UpTime;
-       varbinds[2].len_oid = sizeof(UpTime);
-       varbinds[2].value = UpTime;
-       varbinds[2].len_val = 0;
-       varbinds[2].type = NULL_VALUE;
-       i++;
-    }
-
-    print_help(WAIT_RET);
-    if (snmp(varbinds, i, GET) <= 0) {
-       print_helperr(ERR_RET);
-       goto exit;
-    }
+    if (wait_mode == WAIT_TIMEOUT)
+       print_help(QT_HELP);
 
-    print_title(_("System Info"));
+    while (1) {
+       i = 0;
 
-    mvwaddstr(main_sub, 0, 0, _("Device hardware/software/name info:"));
-    for (i = 0; i < varbinds[0].len_val && *(varbinds[0].value + i); i++) {
-       mvwaddch(main_sub, 1, i + 1, *(varbinds[0].value + i));
-    }
+       varbinds[0].oid = sysDescr;
+       varbinds[0].len_oid = sizeof(sysDescr);
+       varbinds[0].value = sysDescr;
+       varbinds[0].type = NULL_VALUE;
+       varbinds[0].len_val = 0;
+       i++;
 
-    if (ap_type == ATMEL410) {
-       
-       memcpy(&ptr410, varbinds[1].value, sizeof(struct SysDeviceInfo_ATMEL410));
-       ap_sversion = ptr410.StructVersion;
-       ap_macaddr = ptr410.MacAddress;
-       ap_regdomain = swap4(ptr410.RegulationDomain);
-       ap_prodtype = ptr410.ProductType;
-       ap_oemname = ptr410.OEMName;
-       ap_oemid = ptr410.OEMID;
-       ap_prodname = ptr410.ProductName;
-       ap_hwrev = ptr410.HardwareRevision;
-    } else { /* ATMEL12350 */
-       
-       memcpy(&ptr12350, varbinds[1].value, sizeof(struct SysDeviceInfo_ATMEL12350));
-       ap_regdomain = ptr12350.RegulationDomain;
-       ap_sversion = ptr12350.StructVersion;
-       ap_macaddr = ptr12350.MacAddress;
-       ap_prodtype = ptr12350.ProductType;
-       ap_oemname = ptr12350.OEMName;
-       ap_oemid = ptr12350.OEMID;
-       ap_prodname = ptr12350.ProductName;
-       ap_hwrev = ptr12350.HardwareRevision;
-    }
+       varbinds[1].oid = sysDeviceInfo;
+       varbinds[1].len_oid = sizeof(sysDeviceInfo);
+       varbinds[1].value = sysDeviceInfo;
+       varbinds[1].len_val = 0;
+       varbinds[1].type = NULL_VALUE;
+       i++;
 
-    sprintf(message, "%s%02X%02X%02X%02X%02X%02X", MAC,
+       if (ap_vendorext == VERNET) {
+           varbinds[2].oid = UpTime;
+           varbinds[2].len_oid = sizeof(UpTime);
+           varbinds[2].value = UpTime;
+           varbinds[2].len_val = 0;
+           varbinds[2].type = NULL_VALUE;
+           i++;
+       }
+
+       if (wait_mode == WAIT_FOREVER)
+           print_help(WAIT_RET);
+
+       if (snmp(varbinds, i, GET) <= 0) {
+           print_helperr(ERR_RET);
+           getch();
+           goto quit;
+       }
+
+       if (wait_mode == WAIT_FOREVER)
+           print_help(QT_HELP);
+
+       mvwaddstr(main_sub, 0, 0, _("Device hardware/software/name info:"));
+       for (i = 0; i < varbinds[0].len_val && *(varbinds[0].value + i); i++)
+           mvwaddch(main_sub, 1, i + 1, *(varbinds[0].value + i));
+
+       if (ap_type == ATMEL410) {
+           memcpy(&str410, varbinds[1].value,
+               sizeof(struct sysDeviceInfo_ATMEL410));
+           ap_sversion = str410.StructVersion;
+           ap_macaddr = str410.MacAddress;
+           ap_regdomain = swap4(str410.RegulatoryDomain);
+           ap_prodtype = str410.ProductType;
+           ap_oemname = str410.OEMName;
+           ap_oemid = str410.OEMID;
+           ap_prodname = str410.ProductName;
+           ap_hwrev = str410.HardwareRevision;
+       } else { /* ATMEL12350 */
+           memcpy(&str12350, varbinds[1].value,
+               sizeof(struct sysDeviceInfo_ATMEL12350));
+           ap_regdomain = str12350.RegulatoryDomain;
+           ap_sversion = str12350.StructVersion;
+           ap_macaddr = str12350.MacAddress;
+           ap_prodtype = str12350.ProductType;
+           ap_oemname = str12350.OEMName;
+           ap_oemid = str12350.OEMID;
+           ap_prodname = str12350.ProductName;
+           ap_hwrev = str12350.HardwareRevision;
+       }
+
+       sprintf(message, "%s%02X%02X%02X%02X%02X%02X", MAC,
            ap_macaddr[0] & 0xFF, ap_macaddr[1] & 0xFF,
            ap_macaddr[2] & 0xFF, ap_macaddr[3] & 0xFF,
            ap_macaddr[4] & 0xFF, ap_macaddr[5] & 0xFF);
-    mvwaddstr(main_sub, 2, 0, message);
-
-    mvwaddstr(main_sub, 3, 0, _("Product name:"));
-    for (i = 0; i < 32 && ap_prodname[i]; i++) {
-       mvwaddch(main_sub, 3, i + 14, ap_prodname[i]);
-    }
-
-    sprintf(message, _("Product type: %u"), swap4(ap_prodtype));
-    mvwaddstr(main_sub, 4, 0, message);
-
-    sprintf(message, _("Hardware revision: %u"), swap4(ap_hwrev));
-    mvwaddstr(main_sub, 5, 0, message);
-
-    mvwaddstr(main_sub, 6, 0, _("OEM name:"));
-    for (i = 0; i < 32 && ap_oemname[i]; i++) {
-       mvwaddch(main_sub, 6, i + 10, ap_oemname[i]);
-    }
-
-    sprintf(message, "OEM ID: %u", swap4(ap_oemid));
-    mvwaddstr(main_sub, 7, 0, message);
-
-    sprintf(message, _("Regulation domain: %s [%d]"),
-           (ap_regdomain == 0x10) ? _("FCC (USA)") :
-           (ap_regdomain == 0x20) ? _("DOC (Canada)") :
-           (ap_regdomain == 0x30) ? _("ETSI (Europe)") :
-           (ap_regdomain == 0x31) ? _("Spain") :
-           (ap_regdomain == 0x32) ? _("France") :
-           (ap_regdomain == 0x40) ? _("MKK (Japan)") : _("unknown"), ap_regdomain);
-    mvwaddstr(main_sub, 8, 0, message);
-
-    sprintf(message, _("Info structure version: %u"), swap4(ap_sversion));
-    mvwaddstr(main_sub, 9, 0, message);
-
-    sprintf(message, _("Manufacturer OUI: %02X %02X %02X (%s)"),
-       ap_macaddr[0] & 0xFF, ap_macaddr[1] & 0xFF, ap_macaddr[2] & 0xFF,
-       oui2manufacturer(ap_macaddr));
-    mvwaddstr(main_sub, 10, 0, message);
-
-    if (IS_ATMEL12350_VERNET) {
-       i = varbinds[2].len_val == 2 ?
-           (varbinds[2].value[0] << 8) | varbinds[2].value[1] :
-           varbinds[2].value[0] < 0x80 ?
-           varbinds[2].value[0] : 0xff00 | varbinds[2].value[0];
-       sprintf(message, _("Uptime: %u days, %02u:%02u:%02u hours:mins:secs"),
-           i / 60 / 60 / 24, i / 60 / 60 % 24, i / 60 % 60, i % 60);
-       mvwaddstr(main_sub, 11, 0, message);
+       mvwaddstr(main_sub, 2, 0, message);
+
+       mvwaddstr(main_sub, 3, 0, _("Product name:"));
+       for (i = 0; i < 32 && ap_prodname[i]; i++)
+           mvwaddch(main_sub, 3, i + 14, ap_prodname[i]);
+
+       sprintf(message, _("Product type: %u"), swap4(ap_prodtype));
+       mvwaddstr(main_sub, 4, 0, message);
+
+       mvwaddstr(main_sub, 5, 0, _("OEM name:"));
+       for (i = 0; i < 32 && ap_oemname[i]; i++)
+           mvwaddch(main_sub, 5, i + 10, ap_oemname[i]);
+
+       sprintf(message, "OEM ID: %u", swap4(ap_oemid));
+       mvwaddstr(main_sub, 6, 0, message);
+
+       sprintf(message, _("Hardware revision: %u"), swap4(ap_hwrev));
+       mvwaddstr(main_sub, 7, 0, message);
+
+       i = regdom_idx(ap_regdomain);
+       sprintf(message, "Regulatory domain: %s [%d]",
+           regdom_types[i].desc, ap_regdomain);
+       mvwaddstr(main_sub, 8, 0, message);
+
+       sprintf(message, _("Info structure version: %u"), swap4(ap_sversion));
+       mvwaddstr(main_sub, 9, 0, message);
+
+       sprintf(message, _("Manufacturer OUI: %02X %02X %02X (%s)"),
+           ap_macaddr[0] & 0xFF, ap_macaddr[1] & 0xFF, ap_macaddr[2] & 0xFF,
+           oui2manufacturer(ap_macaddr));
+       mvwaddstr(main_sub, 10, 0, message);
+
+       if (ap_vendorext == VERNET) {
+           unsigned int j = 0;
+
+           if (varbinds[2].len_val > 1) {
+               for (i = 0; i < varbinds[2].len_val; i++)
+                   j |= (varbinds[2].value[i]
+                       << (8 * (varbinds[2].len_val - i - 1)));
+           } else {
+               j = varbinds[2].value[0] & 0x80 ?
+                   0xff00 | varbinds[2].value[0] : varbinds[2].value[0];
+           }
+           sprintf(message,
+               _("Uptime: %u days, %02u:%02u:%02u hours:mins:secs"),
+               j / 60 / 60 / 24, j / 60 / 60 % 24, j / 60 % 60, j % 60);
+           mvwaddstr(main_sub, 11, 0, message);
+       }
+
+       wrefresh(main_sub);
+
+       i = wait_key();
+       if (i == -1)
+           goto quit;
+
+       switch((char) i) {
+           case 'q':
+           case 'Q':
+               goto quit;
+           case 't':
+           case 'T':
+               wait_mode = (wait_mode == WAIT_FOREVER ?
+                   WAIT_TIMEOUT : WAIT_FOREVER);
+               print_top(wait_mode == WAIT_TIMEOUT ? POLL_ON : POLL_OFF,
+                   SYSINFO);
+       }
+
+       /* either timeout for user input (i == 0) or invalid key => continue */
     }
-
-    wrefresh(main_sub);
-    print_help(ANY_KEY);
-  exit:
-    getch();
-    print_title("");
+  quit:
+    print_top(NULL, NULL);
     clear_main(0);
 }
 
@@ -212,7 +238,6 @@ int get_RegDomain()
     if (snmp(varbinds, 1, GET) <= 0)
        return 0;
     return *(varbinds[0].value);
-
 }
 
 void nwn_sysinfo()
@@ -268,190 +293,214 @@ void nwn_sysinfo()
     struct in_addr ip;
     varbind varbinds[OID_NUM];
     size_t time_stamp;
-
-    for (i = 0; i < OID_NUM; i++) {
-       varbinds[i].value = oid_mac;
-       varbinds[i].type = NULL_VALUE;
-       varbinds[i].len_val = 0;
-    }
-    varbinds[0].oid = oid_mac;
-    varbinds[0].len_oid = sizeof(oid_mac);
-    varbinds[1].oid = oid_manufacturerID;
-    varbinds[1].len_oid = sizeof(oid_manufacturerID);
-    varbinds[2].oid = oid_productID;
-    varbinds[2].len_oid = sizeof(oid_productID);
-    varbinds[3].oid = oid_dot11manufacturerOUI;
-    varbinds[3].len_oid = sizeof(oid_dot11manufacturerOUI);
-    varbinds[4].oid = oid_dot11manufacturerName;
-    varbinds[4].len_oid = sizeof(oid_dot11manufacturerName);
-    varbinds[5].oid = oid_dot11manufacturerProductName;
-    varbinds[5].len_oid = sizeof(oid_dot11manufacturerProductName);
-    varbinds[6].oid = oid_dot11manufacturerProductVersion;
-    varbinds[6].len_oid = sizeof(oid_dot11manufacturerProductVersion);
-    varbinds[7].oid = oid_dot11PHYType;
-    varbinds[7].len_oid = sizeof(oid_dot11PHYType);
-    varbinds[8].oid = oid_dot11TempType;
-    varbinds[8].len_oid = sizeof(oid_dot11TempType);
-    varbinds[9].oid = oid_TxPowerLevel1;
-    varbinds[9].len_oid = sizeof(oid_TxPowerLevel1);
-
-    print_help(WAIT_RET);
-    if (snmp(varbinds, OID_NUM - 1, GET) <= 0) {
-       print_helperr(ERR_RET);
-       goto exit;
-    }
-    print_title(_("System Info"));
-
-
-
-    sprintf(message, "%s%02X%02X%02X%02X%02X%02X", MAC,
+    extern int wait_mode;
+
+    print_top(wait_mode == WAIT_TIMEOUT ? POLL_ON : POLL_OFF, SYSINFO);
+
+    if (wait_mode == WAIT_TIMEOUT)
+       print_help(QT_HELP);
+
+    while (1) {
+       for (i = 0; i < OID_NUM; i++) {
+           varbinds[i].value = oid_mac;
+           varbinds[i].type = NULL_VALUE;
+           varbinds[i].len_val = 0;
+       }
+       varbinds[0].oid = oid_mac;
+       varbinds[0].len_oid = sizeof(oid_mac);
+       varbinds[1].oid = oid_manufacturerID;
+       varbinds[1].len_oid = sizeof(oid_manufacturerID);
+       varbinds[2].oid = oid_productID;
+       varbinds[2].len_oid = sizeof(oid_productID);
+       varbinds[3].oid = oid_dot11manufacturerOUI;
+       varbinds[3].len_oid = sizeof(oid_dot11manufacturerOUI);
+       varbinds[4].oid = oid_dot11manufacturerName;
+       varbinds[4].len_oid = sizeof(oid_dot11manufacturerName);
+       varbinds[5].oid = oid_dot11manufacturerProductName;
+       varbinds[5].len_oid = sizeof(oid_dot11manufacturerProductName);
+       varbinds[6].oid = oid_dot11manufacturerProductVersion;
+       varbinds[6].len_oid = sizeof(oid_dot11manufacturerProductVersion);
+       varbinds[7].oid = oid_dot11PHYType;
+       varbinds[7].len_oid = sizeof(oid_dot11PHYType);
+       varbinds[8].oid = oid_dot11TempType;
+       varbinds[8].len_oid = sizeof(oid_dot11TempType);
+       varbinds[9].oid = oid_TxPowerLevel1;
+       varbinds[9].len_oid = sizeof(oid_TxPowerLevel1);
+
+       if (wait_mode == WAIT_FOREVER)
+           print_help(WAIT_RET);
+
+       if (snmp(varbinds, OID_NUM - 1, GET) <= 0) {
+           print_helperr(ERR_RET);
+           getch();
+           goto quit;
+       }
+
+       sprintf(message, "%s%02X%02X%02X%02X%02X%02X", MAC,
            varbinds[0].value[0] & 0xFF, varbinds[0].value[1] & 0xFF,
            varbinds[0].value[2] & 0xFF, varbinds[0].value[3] & 0xFF,
            varbinds[0].value[4] & 0xFF, varbinds[0].value[5] & 0xFF);
-    mvwaddstr(main_sub, 0, 0, message);
+       mvwaddstr(main_sub, 0, 0, message);
 
-    mvwaddstr(main_sub, 3, 0, _("Manufacturer:"));
-    i = 0;
-    while (varbinds[4].len_val > i) {
-       mvwaddch(main_sub, 3, i + 20, *(varbinds[4].value + i++));
-    }
+       mvwaddstr(main_sub, 3, 0, _("Manufacturer:"));
+       i = 0;
+       while (varbinds[4].len_val > i)
+           mvwaddch(main_sub, 3, i + 20, *(varbinds[4].value + i++));
 
-    mvwaddstr(main_sub, 4, 0, _("Manufacturer ID:"));
-    i = 0;
-    while (varbinds[1].len_val > i) {
-       mvwaddch(main_sub, 4, i + 20, *(varbinds[1].value + i++));
-    }
+       mvwaddstr(main_sub, 4, 0, _("Manufacturer ID:"));
+       i = 0;
+       while (varbinds[1].len_val > i)
+           mvwaddch(main_sub, 4, i + 20, *(varbinds[1].value + i++));
 
-    sprintf(message, _("Manufacturer OUI: %02X %02X %02X (%s)"),
+       sprintf(message, _("Manufacturer OUI: %02X %02X %02X (%s)"),
            varbinds[3].value[0] & 0xFF, varbinds[3].value[1] & 0xFF,
            varbinds[3].value[2] & 0xFF,
            oui2manufacturer(varbinds[3].value));
-    mvwaddstr(main_sub, 5, 0, message);
-
-    sprintf(message, _("Product Name:"));
-    mvwaddstr(main_sub, 6, 0, message);
-    i = 0;
-    while (varbinds[5].len_val > i) {
-       mvwaddch(main_sub, 6, i + 20, *(varbinds[5].value + i++));
-    }
-
-    sprintf(message, _("Product ID:"));
-    mvwaddstr(main_sub, 7, 0, message);
-    i = 0;
-    while (varbinds[2].len_val > i) {
-       mvwaddch(main_sub, 7, i + 20, *(varbinds[2].value + i++));
-    }
-    sprintf(message, _("Product Version:"));
-    mvwaddstr(main_sub, 8, 0, message);
-    i = 0;
-    while (varbinds[6].len_val > i) {
-       mvwaddch(main_sub, 8, i + 20, *(varbinds[6].value + i++));
-    }
-
-
-    sprintf(message, _("PHYType: %s"), types[*(varbinds[7].value) - 1]);
-    mvwaddstr(main_sub, 9, 0, message);
-
-    sprintf(message, _("Temperature: %s"), temp[*(varbinds[8].value) - 1]);
-    mvwaddstr(main_sub, 10, 0, message);
-
-    if ((i = get_RegDomain()) == 0) {
-       print_helperr(ERR_RET);
-       goto exit;
-    }
-    sprintf(message, _("Regulation Domain: %s"),
+       mvwaddstr(main_sub, 5, 0, message);
+
+       sprintf(message, _("Product Name:"));
+       mvwaddstr(main_sub, 6, 0, message);
+       i = 0;
+       while (varbinds[5].len_val > i)
+           mvwaddch(main_sub, 6, i + 20, *(varbinds[5].value + i++));
+
+       sprintf(message, _("Product ID:"));
+       mvwaddstr(main_sub, 7, 0, message);
+       i = 0;
+       while (varbinds[2].len_val > i)
+           mvwaddch(main_sub, 7, i + 20, *(varbinds[2].value + i++));
+
+       sprintf(message, _("Product Version:"));
+       mvwaddstr(main_sub, 8, 0, message);
+       i = 0;
+       while (varbinds[6].len_val > i)
+           mvwaddch(main_sub, 8, i + 20, *(varbinds[6].value + i++));
+
+       sprintf(message, _("PHYType: %s"), types[*(varbinds[7].value) - 1]);
+       mvwaddstr(main_sub, 9, 0, message);
+
+       sprintf(message, _("Temperature: %s"), temp[*(varbinds[8].value) - 1]);
+       mvwaddstr(main_sub, 10, 0, message);
+
+       if ((i = get_RegDomain()) == 0) {
+           print_helperr(ERR_RET);
+           getch();
+           goto quit;
+       }
+       sprintf(message, _("Regulatory Domain: %s"),
            (i == 0x10) ? _("FCC (USA)") :
            (i == 0x20) ? _("DOC (Canada)") :
            (i == 0x30) ? _("ETSI (Europe)") :
            (i == 0x31) ? _("Spain") :
            (i == 0x32) ? _("France") :
            (i == 0x40) ? _("MKK (Japan)") : _("unknown"));
-    mvwaddstr(main_sub, 11, 0, message);
-
-    sprintf(message, _("Transmit Power: %u mW"), *(varbinds[9].value));
-    mvwaddstr(main_sub, 12, 0, message);
-
-    varbinds[0].oid = oid_dot11PrivacyOptionImplemented;
-    varbinds[0].len_oid = sizeof(oid_dot11PrivacyOptionImplemented);
-    varbinds[0].value = oid_mac;
-    varbinds[0].type = NULL_VALUE;
-    varbinds[0].len_val = 0;
-    varbinds[1].oid = oid_dot11DiversitySupport;
-    varbinds[1].len_oid = sizeof(oid_dot11DiversitySupport);
-    varbinds[1].value = oid_mac;
-    varbinds[1].type = NULL_VALUE;
-    varbinds[1].len_val = 0;
-    varbinds[2].oid = oid_sysDescr;
-    varbinds[2].len_oid = sizeof(oid_sysDescr);
-    varbinds[2].value = oid_mac;
-    varbinds[2].type = NULL_VALUE;
-    varbinds[2].len_val = 0;
-    varbinds[3].oid = oid_sysUptime;
-    varbinds[3].len_oid = sizeof(oid_sysUptime);
-    varbinds[3].value = oid_mac;
-    varbinds[3].type = NULL_VALUE;
-    varbinds[3].len_val = 0;
-
-    print_help(WAIT_RET);
-    if (snmp(varbinds, 4, GET) <= 0) {
-       print_helperr(ERR_RET);
-       goto exit;
-    }
+       mvwaddstr(main_sub, 11, 0, message);
 
-    sprintf(message, _("WEP implemented: %s"),
+       sprintf(message, _("Transmit Power: %u mW"), *(varbinds[9].value));
+       mvwaddstr(main_sub, 12, 0, message);
+
+       varbinds[0].oid = oid_dot11PrivacyOptionImplemented;
+       varbinds[0].len_oid = sizeof(oid_dot11PrivacyOptionImplemented);
+       varbinds[0].value = oid_mac;
+       varbinds[0].type = NULL_VALUE;
+       varbinds[0].len_val = 0;
+       varbinds[1].oid = oid_dot11DiversitySupport;
+       varbinds[1].len_oid = sizeof(oid_dot11DiversitySupport);
+       varbinds[1].value = oid_mac;
+       varbinds[1].type = NULL_VALUE;
+       varbinds[1].len_val = 0;
+       varbinds[2].oid = oid_sysDescr;
+       varbinds[2].len_oid = sizeof(oid_sysDescr);
+       varbinds[2].value = oid_mac;
+       varbinds[2].type = NULL_VALUE;
+       varbinds[2].len_val = 0;
+       varbinds[3].oid = oid_sysUptime;
+       varbinds[3].len_oid = sizeof(oid_sysUptime);
+       varbinds[3].value = oid_mac;
+       varbinds[3].type = NULL_VALUE;
+       varbinds[3].len_val = 0;
+
+       if (snmp(varbinds, 4, GET) <= 0) {
+           print_helperr(ERR_RET);
+           getch();
+           goto quit;
+       }
+
+       sprintf(message, _("WEP implemented: %s"),
            (*(varbinds[0].value) == 1) ? ON : OFF);
-    mvwaddstr(main_sub, 13, 0, message);
-    sprintf(message, _("Diversity: %s"),
+       mvwaddstr(main_sub, 13, 0, message);
+       sprintf(message, _("Diversity: %s"),
            diversity[*(varbinds[1].value) - 1]);
-    mvwaddstr(main_sub, 14, 0, message);
-    mvwaddstr(main_sub, LINES - 8, 0, SYS_DESCR);
-    i = 0;
-    while (varbinds[2].len_val > i && varbinds[2].value[i]) {
-       message[i] = varbinds[2].value[i];
-       i++;
-    }
-    message[i] = '\0';
-    mvwaddstr(main_sub, LINES - 8, strlen(SYS_DESCR) + 1, message);
-
-    time_stamp = 0;
-    i = 1;
-
-    for (c = 1; c <= varbinds[3].len_val; c++) {
-       time_stamp +=
-           (unsigned char) varbinds[3].value[varbinds[3].len_val - c] * i;
-       i *= 256;
-    }
-
-    hand = time_stamp % 100;
-    time_stamp = time_stamp / 100;
-    sec = time_stamp % 60;
-    time_stamp = time_stamp / 60;
-    min = time_stamp % 60;
-    time_stamp = time_stamp / 60;
-
-    sprintf(message, _("Uptime: %u:%02u:%02u.%02u"), time_stamp, min, sec,
+       mvwaddstr(main_sub, 14, 0, message);
+       mvwaddstr(main_sub, LINES - 8, 0, SYS_DESCR);
+       i = 0;
+       while (varbinds[2].len_val > i && varbinds[2].value[i]) {
+           message[i] = varbinds[2].value[i];
+           i++;
+       }
+       message[i] = '\0';
+       mvwaddstr(main_sub, LINES - 8, strlen(SYS_DESCR) + 1, message);
+
+       time_stamp = 0;
+       i = 1;
+
+       for (c = 1; c <= varbinds[3].len_val; c++) {
+           time_stamp +=
+               (unsigned char) varbinds[3].value[varbinds[3].len_val - c] * i;
+           i *= 256;
+       }
+
+       hand = time_stamp % 100;
+       time_stamp = time_stamp / 100;
+       sec = time_stamp % 60;
+       time_stamp = time_stamp / 60;
+       min = time_stamp % 60;
+       time_stamp = time_stamp / 60;
+
+       sprintf(message, _("Uptime: %u:%02u:%02u.%02u"), time_stamp, min, sec,
            hand);
-    mvwaddstr(main_sub, 15, 0, message);
-
-    varbinds[0].oid = oid_ip;
-    varbinds[0].len_oid = sizeof(oid_ip);
-    varbinds[0].value = oid_mac;
-    varbinds[0].type = NULL_VALUE;
-    varbinds[0].len_val = 0;
-
-    print_help(WAIT_RET);
-    if (snmp(varbinds, 1, GET_NEXT) <= 0) {
-       print_helperr(ERR_RET);
-       goto exit;
+       mvwaddstr(main_sub, 15, 0, message);
+
+       varbinds[0].oid = oid_ip;
+       varbinds[0].len_oid = sizeof(oid_ip);
+       varbinds[0].value = oid_mac;
+       varbinds[0].type = NULL_VALUE;
+       varbinds[0].len_val = 0;
+
+       if (snmp(varbinds, 1, GET_NEXT) <= 0) {
+           print_helperr(ERR_RET);
+           getch();
+           goto quit;
+       }
+
+       if (wait_mode == WAIT_FOREVER)
+           print_help(QT_HELP);
+
+       memcpy(&ip.s_addr, varbinds[0].value, 4);
+       sprintf(message, _("IP  Address: %s"), inet_ntoa(ip));
+       mvwaddstr(main_sub, 1, 0, message);
+       wrefresh(main_sub);
+
+       i = wait_key();
+       if (i == -1)
+           goto quit;
+
+       switch((char) i) {
+           case 'q':
+           case 'Q':
+               goto quit;
+           case 't':
+           case 'T':
+               wait_mode = (wait_mode == WAIT_FOREVER ?
+                   WAIT_TIMEOUT : WAIT_FOREVER);
+               print_top(wait_mode == WAIT_TIMEOUT ? POLL_ON : POLL_OFF,
+                   SYSINFO);
+       }
+
+       /* either timeout for user input (i == 0) or invalid key => continue */
     }
-    memcpy(&ip.s_addr, varbinds[0].value, 4);
-    sprintf(message, _("IP  Address: %s"), inet_ntoa(ip));
-    mvwaddstr(main_sub, 1, 0, message);
-
-    wrefresh(main_sub);
-    print_help(ANY_KEY);
-  exit:
-    getch();
-    print_title("");
+  quit:
+    print_top(NULL, NULL);
     clear_main(0);
 }
+