hbbs

bbs.hlirc.net
Log | Files | Refs | README | LICENSE

commit f49e77d27378e649f22d70180fde058841568075
parent d05da13d78b5b03d9f56a36132b1b1634c475b1b
Author: hhvn <hayden@haydenvh.com>
Date:   Mon,  1 Feb 2021 00:09:56 +0000

bin/interface.sh: make multi-line pasting possible

Diffstat:
Mbin/interface.sh | 16++++------------
1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/bin/interface.sh b/bin/interface.sh @@ -102,13 +102,9 @@ menu_list(){ ;; n) [ "$arg" = "" ] && prompt "Subject" subject || subject="$arg" - info "Type \".\" on it's own to finish the post" + info "Type ctrl+d to save the post" file="$datadir/boards/$board/$(echo "$(find $datadir/boards/$board/ -type f | wc -l) + 1" | bc).post" - while prompt "" line - do - [ "$line" = "." ] && break - echo "$line" >> $file - done + cat > $file awk -v "data=1 0 $(date +%d-%b-%Y) $user $subject $(basename $file)" -F" " \ 'BEGIN {print data}; $4 != "root" {print $1 + 1 "\t" $2 "\t" $3 "\t" $4 "\t" $5 "\t" $6 "\t" $7}' \ < $datadir/boards/$board/list > $datadir/boards/$board/list.new @@ -169,14 +165,10 @@ menu_read(){ ;; b) set_mode boards; break ;; l) - info "Type \".\" on it's own to finish the post" + info "Type ctrl+d save the post" ofile="$file" file="$datadir/boards/$board/$(echo "$(find $datadir/boards/$board/ -type f | wc -l) + 1" | bc).post" - while prompt "" line - do - [ "$line" = "." ] && break - echo "$line" >> $file - done + cat > $file lnum=$(echo "$(awk -v "file=$(echo "$ofile" | sed 's/ .*//')" -F" " '$6 == file' < $datadir/boards/$board/list | wc -l) - 1" | bc) anykey awk -v "n=1" -v "file=$(basename "$file")" -v "lnum=$lnum" -v "user=$user" -v "date=$(date +%d-%b-%Y)" -v "ofile=$(echo "$ofile" | sed 's/ .*//')" -F" " '