master chld/dot / bin / fcg
 1#!/bin/guile
 2!#
 3(use-modules (ice-9 popen)
 4	     (ice-9 rdelim)
 5	     (srfi srfi-1))
 6
 7(define str
 8  (if (> (length (command-line)) 1)
 9      (cadr (command-line))
10      "pwn"
11      ))
12
13(define (system-output . a)
14  (let*  ((p (apply open-pipe* OPEN_READ a))
15	  (s (read-string p)))
16    (close-pipe p)s))
17
18(define f (string-split (system-output "fc-list") #\newline))
19(let main ((i 0))
20  (when (< i (length f))
21    (when (>= (length (string-split (list-ref f i) #\:)) 3)
22      (begin
23	(let parse ((o 0))
24	  (when (not (= o (string-length str)))
25	    (case (string-ref str o)
26	      ((#\p) (format #t "~a" (cadr (string-split (list-ref f i) #\:)))
27	       (when (and (< (+ o 1) (string-length str))
28			  (char=? (string-ref str (+ o 1)) #\w)
29			  )
30		 (format #t " ")
31		 ))
32	      ((#\w) (format #t "(~a)"
33			     (last (string-split (car (string-split (list-ref f i) #\:)) #\.)))
34	       )
35	      ((#\n) (newline))
36	      ) (parse (+ o 1)))
37	  ))) (main (+ i 1))))