| mk-pearls - gopher-lawn - The gopher lawn gopher directory project. | |
| git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhf… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| --- | |
| mk-pearls (1134B) | |
| --- | |
| 1 #!/bin/sh | |
| 2 | |
| 3 { | |
| 4 cat pearls/header.gph | |
| 5 | |
| 6 find db -name "pearl-*" -type f \ | |
| 7 | while read -r pearl; | |
| 8 do | |
| 9 cat $pearl \ | |
| 10 | while read -r line; | |
| 11 do | |
| 12 fieldval="$(printf "%s\n" "${line}" \ | |
| 13 | cut -d':' -f2- | xargs)" | |
| 14 case "${line}" in | |
| 15 Type:*) | |
| 16 gtype="9" | |
| 17 case "${fieldval}" in | |
| 18 link) | |
| 19 gtype="1" | |
| 20 ;; | |
| 21 text) | |
| 22 gtype="0" | |
| 23 ;; | |
| 24 cso) | |
| 25 gtype="2" | |
| 26 ;; | |
| 27 error) | |
| 28 gtype="3" | |
| 29 ;; | |
| 30 uuencoded) | |
| 31 gtype="6" | |
| 32 ;; | |
| 33 search) | |
| 34 gtype="7" | |
| 35 ;; | |
| 36 telnet) | |
| 37 gtype="8" | |
| 38 ;; | |
| 39 esac | |
| 40 ;; | |
| 41 Selector:*) | |
| 42 selector="${fieldval}" | |
| 43 ;; | |
| 44 Host:*) | |
| 45 host="${fieldval}" | |
| 46 ;; | |
| 47 Port:*) | |
| 48 port="${fieldval}" | |
| 49 ;; | |
| 50 LinkName:*) | |
| 51 linkname="${fieldval}" | |
| 52 ;; | |
| 53 *) | |
| 54 ;; | |
| 55 esac | |
| 56 | |
| 57 if [ -n "${selector}" ] \ | |
| 58 && [ -n "${host}" ] \ | |
| 59 && [ -n "${port}" ] \ | |
| 60 && [ -n "${gtype}" ] \ | |
| 61 && [ -n "${linkname}" ]; | |
| 62 then | |
| 63 printf "[%s| (_) %s|%s|%s|%s]\n" \ | |
| 64 "$gtype" \ | |
| 65 "${linkname}" \ | |
| 66 "${selector}" \ | |
| 67 "${host}" \ | |
| 68 "${port}" | |
| 69 selector="" | |
| 70 host="" | |
| 71 port="" | |
| 72 linkname="" | |
| 73 fi | |
| 74 done | |
| 75 done | |
| 76 | |
| 77 cat pearls/footer.gph | |
| 78 } > pearls.gph |