table

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

чување 5012fc6c1f5d1524e8c462fa865ab66e4d6f445d
родитељ 8f95b90ab103f836bc7b669b7d902089a6bb8ecf
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Thu,  5 Feb 2026 11:45:52 +0100

lib: Synchronize build scripts with other projects; update copyright year

Diffstat:
M.gitignore | 20+++++++++++---------
MREADME | 2+-
Mdefs.h | 2+-
Mlib/makedate | 26++++++++++++++++++++++++--
Mlib/makeversion | 28+++++++++++++++++++++++++---
Mlib/mkpack | 4++--
Mlib/runtests | 2+-
Mtable.1.in | 4++--
Mtable.c | 4++--
Mutf8.c | 2+-
Mutf8.h | 2+-
Mversion.h.in | 2+-
измењених датотека: 12, додавања: 72(+), брисања: 26(-)

diff --git a/.gitignore b/.gitignore @@ -1,28 +1,30 @@ -.cache -.redo -*.session .gdbinit -.do_built -.do_built.dir +*.session +.rebuild *~ *.bak +*.err +*.out *.orig *.rej *.o -*.pdf -*.ps +*.sig *.swp *.did +tags +**/tags cscope.out nohup.out *.gz *.xz -*.sig +*.html +*.pdf +*.ps *.png *.1 +*.pkg.tar.zst table table.1 -table.html date version version.h diff --git a/README b/README @@ -129,7 +129,7 @@ License ------- table - Command line utility to format and display CSV -Copyright (C) 2020-2024 Страхиња Радић +Copyright (C) 2020-2026 Страхиња Радић This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/defs.h b/defs.h @@ -1,5 +1,5 @@ /* This program is licensed under the terms of GNU GPL v3 or (at your option) - * any later version. Copyright (C) 2020-2024 Страхиња Радић. + * any later version. Copyright (C) 2020-2026 Страхиња Радић. * See the file LICENSE for exact copyright and license details. */ #include "utf8.h" diff --git a/lib/makedate b/lib/makedate @@ -4,6 +4,24 @@ FALLBACKDATE=${FALLBACKDATE:-unknown} LC_ALL=C export LC_ALL +getent() +{ + if command -v getent >/dev/null 2>&1; then + command getent "$@" + return + fi + case "$1" in + passwd|group) + if [ -z "$2" ]; then + cat /etc/"$1" + else + awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1" + fi + ;; + *) ;; + esac +} + if [ -d .got ] && command -v got >/dev/null 2>&1; then got log | awk ' @@ -26,8 +44,12 @@ if [ -d .got ] && command -v got >/dev/null 2>&1; then exit }' >date.new elif [ -d .git ] && command -v git >/dev/null 2>&1; then - user=$(unalias ls >/dev/null 2>&1 || true; \ - command ls -ld . | awk '{print $3}') + user=$(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 + fi e_user=$(id -un) if [ "$e_user" = "$user" ]; then git log --format=format:%cd \ diff --git a/lib/makeversion b/lib/makeversion @@ -2,6 +2,24 @@ # vim: set ft=bash: FALLBACKVER=${FALLBACKVER:-unknown} +getent() +{ + if command -v getent >/dev/null 2>&1; then + command getent "$@" + return + fi + case "$1" in + passwd|group) + if [ -z "$2" ]; then + cat /etc/"$1" + else + awk -F: -vu="$2" '{ if ($3 == u) print }' /etc/"$1" + fi + ;; + *) ;; + esac +} + if [ -d .got ] && command -v got >/dev/null 2>&1; then lastcommit=$(got log | awk '/^commit/ {print substr($2,1,7); exit}') @@ -33,13 +51,17 @@ if [ -d .got ] && command -v got >/dev/null 2>&1; then elif [ -d .git ] && command -v git >/dev/null 2>&1; then LC_ALL=C export LC_ALL - user=$(unalias ls >/dev/null 2>&1 || true; \ - command ls -ld . | awk '{print $3}') + user=$(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 + fi e_user=$(id -un) if [ "$e_user" = "$user" ]; then git describe 2>/dev/null | sed 's/^v//' >version.new else - su "${user}" -c 'git describe' 2>/dev/null | + su "$user" -c 'git describe' 2>/dev/null | sed 's/^v//' >version.new fi else diff --git a/lib/mkpack b/lib/mkpack @@ -4,7 +4,7 @@ DISTDIR=$(grep '^PROG[[:space:]]\{1,\}=' config.mk | sed -E 's,.*=[[:space:]]+([[:alpha:]]+),\1,')-$(cat version) mkdir "$DISTDIR" if [ -d .got ] && command -v got >/dev/null 2>&1; then - files=$(got tree | sed -e 's,[@/*$]$,,g') + files=$(got tree -R | sed -e 's,[@/*$]$,,g') elif [ -d .git ] && command -v git >/dev/null 2>&1; then files=$(git ls-files) else @@ -14,7 +14,7 @@ fi for f in $files; do d="$DISTDIR"/"$(dirname "$f")" mkdir -p "$d" - cp "$f" "$d"/ + [ -f "$f" ] && cp "$f" "$d"/ done tar -cf - "$DISTDIR" | xz -9v - > "$DISTDIR".tar.xz rm -fr "$DISTDIR" diff --git a/lib/runtests b/lib/runtests @@ -1,6 +1,6 @@ #!/usr/bin/perl # This program is licensed under the terms of GNU GPL v3 or (at your option) -# any later version. Copyright (C) 2022-2024 Страхиња Радић. +# any later version. Copyright (C) 2022-2026 Страхиња Радић. # See the file LICENSE for exact copyright and license details. diff --git a/table.1.in b/table.1.in @@ -1,5 +1,5 @@ .\" This program is licensed under the terms of GNU GPL v3 or (at your option) -.\" any later version. Copyright (C) 2020-2024 Страхиња Радић. +.\" any later version. Copyright (C) 2020-2026 Страхиња Радић. .\" See the file LICENSE for exact copyright and license details. .Dd %DATE% .Dt TABLE 1 @@ -287,7 +287,7 @@ $ table -n -H -d: -arccclll -see -f3:1:1:1:4:4:4 /etc/passwd . .Sh AUTHORS .An Strahinya Radich Aq Mt sr@strahinja.org , -2020\-2024 +2020\-2026 . .Sh BUGS Bugs can be reported using the ticket tracker at: diff --git a/table.c b/table.c @@ -1,5 +1,5 @@ /* This program is licensed under the terms of GNU GPL v3 or (at your option) - * any later version. Copyright (C) 2020-2024 Страхиња Радић. + * any later version. Copyright (C) 2020-2026 Страхиња Радић. * See the file LICENSE for exact copyright and license details. */ #include <assert.h> @@ -19,7 +19,7 @@ #define COPYRIGHT \ (" This program is licensed under the terms of GNU GPL v3" \ " or (at your option)\n" \ - " any later version. Copyright (C) 2020-2024 Strahinya Radich.\n" \ + " any later version. Copyright (C) 2020-2026 Strahinya Radich.\n" \ " See the file LICENSE for exact copyright and license " \ "details.") diff --git a/utf8.c b/utf8.c @@ -1,5 +1,5 @@ /* This program is licensed under the terms of GNU GPL v3 or (at your option) - * any later version. Copyright (C) 2020-2024 Страхиња Радић. + * any later version. Copyright (C) 2020-2026 Страхиња Радић. * See the file LICENSE for exact copyright and license details. */ #include "utf8.h" diff --git a/utf8.h b/utf8.h @@ -1,5 +1,5 @@ /* This program is licensed under the terms of GNU GPL v3 or (at your option) - * any later version. Copyright (C) 2020-2024 Страхиња Радић. + * any later version. Copyright (C) 2020-2026 Страхиња Радић. * See the file LICENSE for exact copyright and license details. */ #include <stdint.h> diff --git a/version.h.in b/version.h.in @@ -1,5 +1,5 @@ /* This program is licensed under the terms of GNU GPL v3 or (at your option) - * any later version. Copyright (C) 2020-2024 Страхиња Радић. + * any later version. Copyright (C) 2020-2026 Страхиња Радић. * See the file LICENSE for exact copyright and license details. */ #define PROGRAMNAME "table"