#!/local/gauche/bin/gosh (use srfi-1) (use srfi-13) (use gauche.process) (define (process-entry atlist) (if (= (length atlist) 9) (let ((match (#/\.(\d+\.\d+\.\d+\.\d+)$/ (first atlist))) (mac (string-join (take-right atlist 6) ":"))) (if match (print (match 1) " " mac)) ) ) ) (define (read-loop op) (port-for-each (lambda (l) (process-entry (string-tokenize l))) (lambda () (read-line op)) ) ) (define (main args) (let ((sp (start-snmp (second args)))) (read-loop (process-output sp)) (process-wait sp) ) ) (define (start-snmp hostname) (run-process (list "/usr/physics/net-snmp/bin/snmpbulkwalk" "-Os" "-c" "public" "-v" "2c" hostname "1.3.6.1.2.1.3.1.1.2") :output :pipe :error "/dev/null") )