Copyright 2026-2027 by The Software Samurai.
On the web: http://www.SoftwareSam.us/
Software released under GNU GPL3, and documentation released under FDL1.3
CrYears (cryr.pl): version 0.0.02
Developed under : Perl v:5.42.3
Grep v:3.12
This package includes the Perl script 'cryr.pl' which demonstrates the use of grep to simplify updating of source
code in preparation for creating a distribution package.
Coincidentally, it also demonstrates some basic (and not-so-basic) Perl functionality and syntax.
The author uses this program to scan for strings which represent a range of years, primarily in connection with
copyright notices; hence, the name: CopyrightYears.pl
It is also used to identify date ranges used in screenshots, diagrams and other instances which may occasionally
become stale when each new year arrives.
Example: ./cryr.pl -path='./1_TestData' (see invocation options)'test.cpp' is a fully-functional (but brain-damaged) application originally created in response
to a student request and modified slightly for this package. The application can be built using the included 'Makefile'.cd 1_TestData gmake ./test --help
1_TestData directory are simply examples for testing the
cryr.pl program.cryr.pl program can easily be modified to scan your source code for any often-included and occasionally-updated sequence,
such as an address, a URL, contact information, version number, etc.
cryr.pl - Perl script dempnstrating grep scans
README - Release notes (this file)
1_TestData - Subdirectory containing test data
test.cpp
test.hpp
Makefile
Base.texi
df.py
report.pl
VERSION_HISTORY
README
cryr.pl on a regular basis, it should be visible on the system path.Usage: cryr.pl [OPTIONS]
Invocation options fall into two categories:File-specification Options
When invoked without parameters, the files scanned will be all '.hpp' and '.cpp' files
in the CWD (Current-Working-Directory). This is the “Regular Expression” (regex)
specifying the default basic source file group to be scanned: *[.][hc]pp
Note that the order in which filespec options are specified can affect which files are actually scanned.
.hpp
.cpp
-fspec='*[.]py'To exclude the '*.hpp' and '*.cpp' filename group, use
'fspec' to specify a pattern that will match no filenames.
Example: cryr.pl --all --fspec='no_files'.
'-texi','-pl','-make','-aux' are
added to the primary filespec option.cryr.pl -pl” will scan all files in the CWD with extensions of
'.hpp','.cpp' and '.pl'.
*[.]texi”
*[.]pl”
Makefile” “myMakefile” “Makefile.bak”.README” and “VERSION_HISTORY”.
cryr.pl -all'.hpp', '.cpp', '.texi', '.pl', all filenames containing
the 'Makefile' substring, as well as the “README” and
“VERSION_HISTORY” files.
Other Options
./cryr.pl --path='./1_TestData' -all
stdout.'less' utility; however, if desired, the
'-stdout' option can be used to bypass 'less' and write the data directly to the
terminal window.
Sale! Offer good 2025-2026 only. Buy Now!
but the following records would be excluded:
Sale! Offer good 2024-2025 only. Buy Now! OBSOLETE
Sale! Offer good 2023-2024 only. Buy Now! Obsolete
Sale! Offer good 2022-2023 only. Buy Now! obsolete
Special Case: Using the '-excl' option with an empty string invokes a special case of the exclusion scan:
cryr.pl -excl=''
cryr.pl -excl=
(However, 'cryr.pl -excl' would be a syntax error)
This specifies that the text of the exclusion filter is to be automagically set to exclude primary-scan tokens which
end with the current year (as reported by the system). In practice, this means that the report will exclude any items
which have already been updated for the current year.cryr.pl -excl=
// Copyright 2020-2026 Karen the Kourageous Koder
// Copyright 2020 - 2026 Patty the Perl Piggie
# Written by Ruby Redneck during a tequila binge:1998-1999
but will exclude:
// Copyright 2020-2027 Paul the Pythonian
// Copyright 2020 - 2027 Rust-belt Randy
Notes
User friendliness begins with an acknowledgment that many users are too bloody lazy to read the documentation; therefore, as with many of the author's other script files, an option may be specified using either a single dash or a double dash.cryr.pl -icasecryr.pl --icasecryr.pl ---------icaseThe Primary Scan Regular Expression
Notes on the regular expression (regexp) used to scan for date-range substrings. The basic target is a string of the form: "2021-2025" or minor variations on that form.The Secondary Scan Filters
Technical Note:It is possible (though unlikely) that the secondary
filters could match text in the temporary buffer which represents an embedded ANSI color escape sequence
inserted by the grep utility rather than actual source code.
Color escape sequences take the general form:
ESC [ 0 1 ; 3 1 m
1b 5b 30 31 3b 33 31 6d
If this happens, adjust the search token to exclude the ANSI sequence.
Inclusion Filter
The inclusion filter is applied to the data captured during the primary scan. This is done by writing the results of the primary scan to a temporary file.'grep' is then used to scan the temporary file.Example: cryr.pl -incl='Copyright'"Copyright (c) 2004-2024, Bobo the Basement Troll"const char* crYears = "2004-2024"; // copyright yearsExample: cryr.pl -incl='Copyright' -icaseExample: cryr.pl -incl='[cC]opyright'Exclusion Filter
The exclusion filter is applied to one of two sets of captured data: 1) Applied to the data captured during the primary scan. 2) Applied to the results of the inclusion-filter scan.'grep' is then used to scan the temporary file.
Only lines which include the primary-scan token but not the
exclusion token will be reported.Example: -excl='[-] ?2026'const char* crYears = "2004-2025";const char* crYears = "2004 - 2025";const char* crYears = "2004-2026";const char* crYears = "2004 - 2026";-excl=''”
option described above.)Special Characters
Both the shell program and the grep utility define a set of “special” characters. Unfortunately, it is not the same set and the “specialness” of each character may be defined differently by each. If the filter argument is enclosed in single quotes, the shell will probably pass special characters through without interpretation.Example: --incl='[-] ?2023'Example: --incl='(c)'Example: --incl='\(c\)'Example: --incl='[(]c[)]''-').Example: --incl='This is a double-quote: "'Example: --incl="This is a single-quote: '"Example: --incl='\-Hello World!' (backslash '\' removes the specialness)Example: --incl='Hello-World!' (not the first character of token)cryr.pl:'--' double-dash/double-hyphen operator is used to signal the end of command-line arguments for the utility
being invoked. Any tokens following the double-dash will not be interpreted as grep invocation options, but will
instead be passed to grep as operational parameters.Example: grep -nHsE --color=always -- '-abc' '-stupid nonportable filename.txt'Example: cryr --incl='-Hello World!'(Don't even get us started on the backtick [`] character,
which in the world of special characters, is poison-on-a-stick.)
Version History
See the source file.