]> granicus.if.org Git - strace/blob - copyright-year-gen
Add PAF_ARRAY_TRUNCATED flag for print_array_ex
[strace] / copyright-year-gen
1 #!/bin/sh
2 #
3 # Copyright (c) 2017-2018 The strace developers.
4 # All rights reserved.
5 #
6 # SPDX-License-Identifier: LGPL-2.1-or-later
7
8 : ${YEAR_FILE:=$1}
9 : ${DEFAULT_YEAR:=$2}
10 LC_TIME=C; export LC_TIME
11
12 year=
13
14 [ -n "${YEAR_FILE}" ] || {
15         echo >&2 "$0 $(dirname "$0")/.year [DEFAULT_YEAR]"
16         exit 1
17 }
18
19 [ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
20
21 [ -n "${year}" ] ||
22         year="$(date -u +%Y -d "$(git show -s --format=format:%cD)")"
23
24 [ -n "${year}" ] ||
25         year="${DEFAULT_YEAR}"
26
27 [ -n "${year}" ] ||
28         [ -z "${SOURCE_DATE_EPOCH-}" ] ||
29         year="$(date -u +%Y -d "@${SOURCE_DATE_EPOCH}")"
30
31 [ -n "${year}" ] ||
32         year="$(date -u +%Y)"
33
34 [ -n "${year}" ] || {
35         printf >&2 "%s: Undefined year.\n" "$0"
36         exit 1
37 }
38
39 printf "%s" "${year}"