aboutsummaryrefslogtreecommitdiff
path: root/bin/license
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2023-01-02 12:33:58 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2023-01-02 12:33:58 +0100
commiteab596b672b18c8db1103d99d7a9408a0fc9a09c (patch)
treeab0186d5e9e42608a47d823e9ce645be45b6f32f /bin/license
parentafdedcc50168208c7f6da855d7dbce9a0ad0e8fa (diff)
downloaddotfiles-eab596b672b18c8db1103d99d7a9408a0fc9a09c.tar.gz
dotfiles-eab596b672b18c8db1103d99d7a9408a0fc9a09c.zip
Updated copyright notice
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'bin/license')
-rwxr-xr-xbin/license28
1 files changed, 13 insertions, 15 deletions
diff --git a/bin/license b/bin/license
index 029b629..449848e 100755
--- a/bin/license
+++ b/bin/license
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-# Copyright (C) 2014-2022 Miquel Sabaté Solà <mikisabate@gmail.com>
+# Copyright (C) 2014-2023 Miquel Sabaté Solà <mikisabate@gmail.com>
#
# 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
@@ -65,7 +65,7 @@ my $name = 'Miquel';
# The current year. I previously thought to be clever and set it to `date +%Y`,
# but then I decided that I didn't want to be clever here to avoid problems and
# be more flexible.
-my $current_year = '2022';
+my $current_year = '2023';
# The command that feeds this command if no command line argument was given.
my $default_cmd = "git grep -l 'Copyright' | xargs";
@@ -82,29 +82,28 @@ my $re = qr/
(.*)$ # Save the rest of the line.
/x;
-
-sub update_file
-{
+sub update_file {
my ($file) = @_;
open my $in, '<', $file or die "Can't open file $file";
- my $perm = (stat $in)[2] & 07777;
+ my $perm = ( stat $in )[2] & 07777;
open my $out, '>', "$file.new" or die "Can't open file $file.new";
while (<$in>) {
my $line = $_;
- if ($line =~ $re) {
+ if ( $line =~ $re ) {
+
# Get the values from the regular expression safely.
my $prev = ($1) ? $1 : '';
my $year = ($3) ? $3 : $current_year;
- my $c = ($2) ? $2 : '(C)';
+ my $c = ($2) ? $2 : '(C)';
my $next = ($6) ? $6 : '';
- $c =~ s/^\s//;
+ $c =~ s/^\s//;
$year =~ s/^\s//;
# Get the range of years straight.
- my @years = split('-', $year);
- if ($years[0] ne $current_year) {
+ my @years = split( '-', $year );
+ if ( $years[0] ne $current_year ) {
$year = "$years[0]-$current_year";
}
@@ -119,15 +118,14 @@ sub update_file
# And move the file while preserving the old permission bits.
`mv $file.new $file`;
open $in, '<', $file or die "Can't open file $file";
- chmod($perm | 0600, $in);
+ chmod( $perm | 0600, $in );
close($in);
}
-
##
# Main: get the files from the command line and update them.
-my @files = (@ARGV > 0) ? @ARGV : split(' ', `$default_cmd`);
+my @files = ( @ARGV > 0 ) ? @ARGV : split( ' ', `$default_cmd` );
foreach my $f (@files) {
- update_file($f);
+ update_file($f);
}