Introduction
Introduction Statistics Contact Development Disclaimer Help
clippy-say - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
clippy-say (1243B)
---
1 #!/bin/sh
2
3 maxbubblelen=74
4 #DST=""
5 DSTDIR="/br/gopher/paste"
6 CLIPPYTMPL="/br/gopher/memecache/clippy.vtv"
7
8 speaktext="$@"
9 speaklen="$(utf8expr length "${speaktext}")"
10
11 cd /tmp
12 tmpfile="$(mktemp p-XXXXXXXXXXXXX.txt)"
13 touch "${tmpfile}"
14
15 {
16 bubblelen=$(($speaklen + 4))
17 if [ $bubblelen -gt $maxbubblelen ];
18 then
19 bubblelen=$maxbubblelen
20 fi
21
22 printf " "
23 i=0
24 while [ $i -lt $((bubblelen - 2)) ];
25 do
26 printf "_"
27 i=$(($i + 1))
28 done
29 printf "\n"
30
31 textoffset=1
32 bubblecontentlen=$(($bubblelen - 4))
33 while [ $speaklen -gt 0 ];
34 do
35 newoffset=$(($textoffset + $bubblecontentlen))
36 textsubstr="$(utf8expr substr "$speaktext" $textoffset $…
37 substrlen="$(utf8expr length "${textsubstr}")"
38 printf "| %s" "$textsubstr"
39 while [ $substrlen -le $bubblecontentlen ];
40 do
41 printf " "
42 substrlen=$(($substrlen + 1))
43 done
44 printf "|\n"
45 textoffset=$(($newoffset))
46 speaklen=$(($speaklen - $substrlen))
47 done
48
49 printf " "
50 i=0
51 while [ $i -lt $((bubblelen - 2)) ];
52 do
53 printf "-"
54 i=$(($i + 1))
55 done
56 printf "\n"
57
58 tail -n+4 "${CLIPPYTMPL}"
59 } > $tmpfile
60
61 mv $tmpfile $DSTDIR
62 chmod g+rw $DSTDIR/$tmpfile
63 chgrp bitreich $DSTDIR/$tmpfile
64
65 name="$(basename $tmpfile)"
66 printf "gophers://bitreich.org/0/p/%s\n" "$name"
67
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.