]> git.decadent.org.uk Git - ap-utils.git/blobdiff - lib/aps.c
Update description to cover all current utilities
[ap-utils.git] / lib / aps.c
index f2c99d7f1cbe5ab680f21c4d61e8eca3725c36fb..234a2c2ed4b33d05834add6c92e6f00ff42def75 100644 (file)
--- a/lib/aps.c
+++ b/lib/aps.c
@@ -2,6 +2,7 @@
  *      aps.c from Access Point SNMP Utils for Linux
  *
  * Copyright (c) 2002 Roman Festchook <roma at polesye dot net>
+ * Copyright (c) 2004 Jan Rafaj <jr-aputils at cedric dot unob dot cz>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License Version 2 from
 #include <fcntl.h>
 #include <stdlib.h>
 #include "ap-utils.h"
-#include "ap-curses.h"
 
-extern WINDOW *main_sub/*, *win_for_menu*/;
-extern short ap_type;
+#define KNOWN_APS _("Known Access Points")
+
+extern WINDOW *main_win, *main_sub /* *win_for_menu */;
+extern short ap_type, ap_vendorext;
 extern int sockfd, atmel410_filter;
 extern struct in_addr ap_ip;
 
@@ -151,19 +153,8 @@ void APs()
        wattrset(main_sub, A_NORMAL);
        mvwaddstr(main_sub, 12, 20, _("Do you want to continue? "));
        wrefresh(main_sub);
-       print_help(_("(Y - Yes; N - No (it's safer to answer No)"));
-       i = 1;
-       while (i)
-           switch (getch()) {
-           case 'Y':
-           case 'y':
-               clear_main(3);
-               i = 0;
-               break;
-           case 'n':
-           case 'N':
-               goto quit;
-           }
+       if (help_ysn())
+           goto quit;
 
        needs_opmode_restore = 1;
        print_help(WAIT_RET);
@@ -185,6 +176,9 @@ void APs()
        sleep(7);
     }
 
+    sprintf(message, "%s%c", VIEW, ap_viewtype + '0');
+    print_top(message, KNOWN_APS);
+
 get_stats:
     varbinds[0].oid = KnownAP;
     varbinds[0].len_oid = sizeof(KnownAP);
@@ -199,14 +193,9 @@ get_stats:
 
 
 show_stats:
-    print_title(_("Known Access Points"));
-    message[0] = ap_viewtype + '0';
-    message[1] = '\0';
-    print_viewtype(message);
-
     /* display column info in main_sub */
     mvwin(main_sub, 0, 0);
-    wattrset(main_sub, COLOR_PAIR(3));
+    wattrset(main_sub, COLOR_PAIR(13));
     for (i = 0; i < 64; i++)
        waddch(main_sub, ' ');
     switch (ap_viewtype) {
@@ -328,7 +317,7 @@ show_stats:
                }
                break;
            case 2:
-               sprintf(message, "%3d", -96 + app->q1);
+               sprintf(message, "%3d", dbmconv(app->q1));
                mvwaddstr(main_sub, aps_num+1, 56, message);
                if (ap_type == ATMEL410) {
                    sprintf(message, "%3d%%",
@@ -570,6 +559,8 @@ show_stats:
                    if (ap_viewtype > 4)
                        ap_viewtype = 1;
                    clear_main(0);
+                   sprintf(message, "%s%c", VIEW, ap_viewtype + '0');
+                   print_top(message, KNOWN_APS);
                    goto show_stats;
            default:
                    print_help(WAIT_RET);
@@ -600,7 +591,7 @@ show_stats:
  exit:
     getch();
  quit:
-    print_title("");
+    print_top(NULL, NULL);
     clear_main(0);
 }