(context MAIN)
+(define (ipbits IP)
+ (join (map (fn (X) (-8 (string "0000000" (bits X))))
+ (map int (parse IP ".")))))
+
(setf IFACE (main-args -1) FD (LIBC6:raw-socket) )
(when (< FD)
(let ((IP (LN 0)) (N (LN 1)))
(TOT IP (+ (or (TOT IP) 0) N))
(TOT IP (max 0 (- (or (TOT IP) 0) 10000)))
- (push (list IP (TOT IP) (TBL IP)) OUT -1)
+ (push (list (ipbits IP) IP (TOT IP) (TBL IP)) OUT -1)
(TBL IP 0)))
(sort OUT (fn (x y)
- (and (> (x 1))
- (if (> (x 2)) (or (= (y 2)) (> (x 1) (y 1)))
- (= (y 1)) true
- (= (y 2)) (> (x 1) (y 1))))))
+ (and (> (x -2))
+ (if (> (x -1)) (or (= (y -1)) (> (x -2) (y -2)))
+ (= (y -2)) true
+ (= (y -1)) (> (x -2) (y -2))))))
(dotimes (i 30)
(! "tput el")
(when (setf x (pop OUT))
- (unless (> (x 1)) (setf x nil)))
+ (unless (> (x -2)) (setf x nil)))
(println (or x "")))))))
(! "clear")