dot

packages and services management
Log | Files | Refs | README

commit b244a0d3f74c540a48d5278b0c18c1c0c6407980
parent d3bb0b48dbcdac0699f2c2be75ff534ecde99650
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Tue, 23 May 2017 07:36:32 +0200

Fixed FreeBSD compatibility (rlfe broken)

Diffstat:
Mbin/build | 6+++---
Abin/ii-client | 10++++++++++
Mbin/ii-filter | 10+++-------
Abin/ii-filter-sed | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mbin/io-irc | 12+++---------
Abuild/rlfe/build | 7+++++++
Abuild/rlfe/url | 1+
Dbuild/rlwrap/url | 1-
8 files changed, 88 insertions(+), 20 deletions(-)

diff --git a/bin/build b/bin/build @@ -26,9 +26,9 @@ compile() cd "$PREFIX" || exit 1 mkdir -p bin doc etc include lib libexec share man - ln -s bin sbin - ln -s ../man share/man - ln -s . usr + ln -fs bin sbin + ln -fs ../man share/man + ln -fs . usr cd "$SRC/$1" || exit 1 if [ -f "$ETC/build/$1/build" ] diff --git a/bin/ii-client b/bin/ii-client @@ -0,0 +1,10 @@ +# Simple tiny ii client + +[ -d "$1" ] || exit 1 + +tail -n 80 -f "$1/out" | ii-filter & + +while IFS='' read -r line +do + printf '%s\n' "$line" > "$1/in" +done diff --git a/bin/ii-filter b/bin/ii-filter @@ -6,19 +6,15 @@ BEGIN { WIDTH = 80 - 17; } -{ - last = date; - date = $1; -} - -last != date { +date != $1 { printf("\n----------------------------------"); printf(" %s ", date); printf("----------------------------------\n") + + date = $1; } { - if ($3 ~ "<.*>" || $3 ~ "-!-") { sub("<", "", $3); sub(">", "", $3); diff --git a/bin/ii-filter-sed b/bin/ii-filter-sed @@ -0,0 +1,61 @@ +busybox awk ' + +BEGIN { + NICK_COL = 14; + TEXT_COL = 80 - NICK_COL - length(" "); +} + +/^$/ { + next; +} + +/==> .* <==/ { + sub("/out <==", ""); + sub("==> ", ""); + + print("\n" $0); + + next; +} + +{ + sub(/[0-9]*-[0-9]*-[0-9]* /, ""); + + date = $0; + sub(/ .*/, "", date); + sub(/^[^ ]* /, "", $0 ); + + if (match($0, /^[-=<#*@+]/)) { + nick = $0; + sub(/ .*/, "", nick); + sub(/^[^ ]* /, "", $0 ); + sub(/</, "", nick); + sub(/>/, "", nick); + } else { + nick = "-!-"; + } + + if (nick != lastnick) + printf("%-" NICK_COL "s|\n", date); + + printf("%" NICK_COL "s| ", + (nick != lastnick && nick != "-!-") ? nick : ""); + + for (first = 1; length($0) >= TEXT_COL; first = 0) { + line = substr($0, 1, TEXT_COL); + sub(/ [^ ]*$/, "", line); + $0 = substr($0, length(line) + 1); + + if (!first) + printf("%" NICK_COL "s| ", ""); + + print(line); + } + + if (!first) + printf("%" NICK_COL "s| ", ""); + + print($0); + + lastnick = nick; +}' "$@" diff --git a/bin/io-irc b/bin/io-irc @@ -1,11 +1,5 @@ -# a pager to browse ii channels +cd "$1" || exit 1 -[ -d "$1" ] || exit 1 +tail -n 80 -f out | ii-filter & -tail -n 40 -f "$1/out" | ii-filter & - -while IFS='' read -r line -do - printf '\r\033[A\033[K' 1>&2 - printf '%s\n' "$line" > "$1/in" -done +cat > in diff --git a/build/rlfe/build b/build/rlfe/build @@ -0,0 +1,7 @@ +cd examples/rlfe || exit + +./configure --prefix="$PREFIX" + +make rlfe + +cp rlfe "$PREFIX/bin/rlfe" diff --git a/build/rlfe/url b/build/rlfe/url @@ -0,0 +1 @@ +ftp://ftp.gnu.org/gnu/readline/readline-6.3.tar.gz diff --git a/build/rlwrap/url b/build/rlwrap/url @@ -1 +0,0 @@ -http://github.com/hanslub42/rlwrap/archive/master.tar.gz