summaryrefslogtreecommitdiff
path: root/rc/bin/bullshit
diff options
context:
space:
mode:
authoraiju <aiju@phicode.de>2011-08-08 18:14:52 +0200
committeraiju <aiju@phicode.de>2011-08-08 18:14:52 +0200
commitb14408f5c68d8aa556f0b0e36bead8b8eda236e9 (patch)
tree4675b4813752fb4db257957a83ad9d29c9e97b66 /rc/bin/bullshit
parent00f4e0ff7a889b6ad4960ca65b4eb66d6385fc8d (diff)
bullshit!
Diffstat (limited to 'rc/bin/bullshit')
-rwxr-xr-xrc/bin/bullshit43
1 files changed, 43 insertions, 0 deletions
diff --git a/rc/bin/bullshit b/rc/bin/bullshit
new file mode 100755
index 000000000..0579bd28d
--- /dev/null
+++ b/rc/bin/bullshit
@@ -0,0 +1,43 @@
+#!/bin/rc
+awk '
+function min(a, b){
+ if(a > b)
+ return b
+ else
+ return a
+}
+$2 == "*" { protocol[nprotocol++] = $1; next }
+$2 == "$" { end[nend++] = $1; next }
+$2 == "^" { start[nstart++] = $1; next }
+$2 == "|" { noend[nword] = 1 }
+{ word[nword++] = $1; next }
+END {
+ srand()
+ last = -1
+ out = 0
+ total = int(rand() * 7)
+ n = int(rand() * min(total - out, 3))
+ for(i = 0; i < n; i++)
+ printf "%s ", start[int(rand() * nstart)]
+ out += n
+ n = int(rand() * min(total - out, 3))
+ for(i = 0; i < n; i++)
+ printf "%s ", word[last = int(rand() * nword)]
+ out += n
+ if(rand() > 0.5){
+ n = int(rand() * 3)
+ for(i = 0; i < n; i++)
+ printf "%s %s", protocol[int(rand() * nprotocol)], (i != n-1) ? "over " : ""
+ out += n
+ last = -1
+ }
+ n = int(rand() * min(total - out, 3))
+ if(out + n == 1 || last == -1)
+ n += 2
+ for(i = 0; i < n; i++)
+ printf "%s ", word[last = int(rand() * nword)]
+ if(rand() > 0.5 || (last >= 0 && noend[last]))
+ printf "%s ", word[int(rand() * nend)]
+ print ""
+}
+' /lib/bullshit