3 # Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
5 # Licensed under the OpenSSL license (the "License"). You may not use
6 # this file except in compliance with the License. You can obtain a copy
7 # in the file LICENSE in the source distribution or at
8 # https://www.openssl.org/source/license.html
11 myname="$(basename $0)"
13 this_year="$(date '+%Y')"
14 some_year="[12][0-9][0-9][0-9]"
16 copyright_owner="The OpenSSL Project"
18 search="Copyright \(([cC]) \)\?\(${some_year}\)\(-${some_year}\)\? ${copyright_owner}"
19 replace="Copyright \1\2-${this_year} ${copyright_owner}"
24 usage: $myname [-h|--help] [file|directory] ...
26 Updates the year ranges of all OpenSSL copyright statements in the given
27 files or directories. (Directories are traversed recursively.)
44 echo -e "illegal option: $arg\n" >& 2
49 if [ -f "$arg" ]; then
50 sed -i "s/${search}/${replace}/g" "$arg"
51 elif [ -d "$arg" ]; then
52 find "$arg" -name '.[a-z]*' -prune -o -type f -exec sed -i "s/${search}/${replace}/g" {} +
54 echo "$arg: no such file or directory" >&2