table

Помоћни програм из командне линије за форматирање и приказ CSV-а
git clone https://git.sr.ht/~strahinja/table
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување f302d73a13c5e197ddc462c6ca3b87914648350f
родитељ a63a6893335bd9040400b4526227ae59ffdd866f
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Sat, 21 Mar 2026 16:27:52 +0000

lib/make{date,version}: Fix build scripts on HaikuOS

Diffstat:
Mlib/makedate | 17+++++++++--------
Mlib/makeversion | 17+++++++++--------
измењених датотека: 2, додавања: 18(+), брисања: 16(-)

diff --git a/lib/makedate b/lib/makedate @@ -15,19 +15,18 @@ exists() command -v $* >/dev/null 2>&1 } -getent() +_getent() { - geresult='' if exists getent; then - geresult=$(command getent "$@" 2>/dev/null) + command getent "$@" 2>/dev/null return fi case "$1" in passwd|group) if [ -z "$2" ]; then - geresult=$(cat /etc/"$1") + cat /etc/"$1" else - geresult=$(awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1") + awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1" fi ;; *) ;; @@ -58,9 +57,11 @@ if [ -d .got ] && exists got; then exit }' >date.new elif [ -d .git ] && exists git; then - getent passwd "$(unalias ls >/dev/null 2>&1 || true; \ - command ls -nd . | awk '{print $3}')" - user=$(printf "%s\n" "$geresult" | awk -F: '{print $1}') + + user=$(printf "%s\n" "$(_getent passwd \ + "$(unalias ls >/dev/null 2>&1 || true; \ + command ls -nd . | awk '{print $3}')")" | + awk -F: '{print $1}') if [ -z "$user" ]; then printf "$0: error: Cannot determine owner of %s" "$(pwd)" >&2 exit 1 diff --git a/lib/makeversion b/lib/makeversion @@ -15,19 +15,18 @@ exists() command -v $* >/dev/null 2>&1 } -getent() +_getent() { - geresult='' if exists getent; then - geresult=$(command getent "$@" 2>/dev/null) + command getent "$@" 2>/dev/null return fi case "$1" in passwd|group) if [ -z "$2" ]; then - geresult=$(cat /etc/"$1") + cat /etc/"$1" else - geresult=$(awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1") + awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1" fi ;; *) ;; @@ -65,9 +64,11 @@ if [ -d .got ] && exists got; then printf "\n" }' >version.new elif [ -d .git ] && exists git; then - getent passwd "$(unalias ls >/dev/null 2>&1 || true; \ - command ls -nd . | awk '{print $3}')" - user=$(printf "%s\n" "$geresult" | awk -F: '{print $1}') + + user=$(printf "%s\n" "$(_getent passwd \ + "$(unalias ls >/dev/null 2>&1 || true; \ + command ls -nd . | awk '{print $3}')")" | + awk -F: '{print $1}') if [ -z "$user" ]; then printf "$0: error: Cannot determine owner of %s" "$(pwd)" >&2 exit 1