Recently Written · git

ii-lchat-metapackage

Get suckless irc working for YOU

git clone https://github.com/equwal/ii-lchat-metapackage

Log | Files | Refs


commit e0a1cc73c7ce3625a5fe99ced08dfdb9c40dcb78
Spenser Truex <truex@equwal.com>
2025-09-04 10:47:23 -0700

POSIX compliance fix

 irc-tail-f | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/irc-tail-f b/irc-tail-f
index 4848b53..63b3586 100755
--- a/irc-tail-f
+++ b/irc-tail-f
@@ -16,7 +16,7 @@ find "$1" -name out | grep "#" | sort > "$tempfile"
 while read file; do
     channel=$(echo "$file" | sed 's/.*\/\(#[^\/]*\)\/out$/\1/')
     # Generate color based on channel name hash using sum of all characters (mod to keep number small)
-    hash=$(printf "%s" "$channel" | od -An -tu1 | tr -d ' ' | awk '{s=0; for(i=1;i<=NF;i++) s=(s+$i)%1000; print s}')
+    hash=$(printf "%s" "$channel" | od -b | awk '{for(i=2;i<=NF;i++) s=(s+$i)%1000} END{print s+0}')
     color=$((31 + hash % 6))
     (tail -F -n $LINES "$file" | ./"$FILTER" | sed -u 's/\x1b\[[0-9;]*m//g' | sed -u "s/^/\x1b[${color}m[$channel]\x1b[0m\t/" | stdbuf -o0 cat) &
 done < "$tempfile"