From 07126a4d50b6343369b48a037fb6c45195495e2f Mon Sep 17 00:00:00 2001 From: espie Date: Wed, 17 May 2023 15:51:58 +0000 Subject: [PATCH] stop using old-style prototypes except where strictly necessary (for try/catch) signatures will be much more powerful once I move to 5.36 --- usr.sbin/pkg_add/OpenBSD/Delete.pm | 4 +- usr.sbin/pkg_add/OpenBSD/Error.pm | 8 +- usr.sbin/pkg_add/OpenBSD/Getopt.pm | 4 +- usr.sbin/pkg_add/OpenBSD/PackageInfo.pm | 8 +- usr.sbin/pkg_add/OpenBSD/PackageName.pm | 4 +- usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 14 +-- .../pkg_add/OpenBSD/PackageRepository/HTTP.pm | 6 +- .../pkg_add/OpenBSD/PackageRepository/SCP.pm | 6 +- usr.sbin/pkg_add/OpenBSD/Paths.pm | 100 +++++++++--------- usr.sbin/pkg_add/OpenBSD/PkgCfl.pm | 10 +- usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 24 ++--- usr.sbin/pkg_add/OpenBSD/RequiredBy.pm | 6 +- usr.sbin/pkg_add/OpenBSD/Signer.pm | 4 +- 13 files changed, 99 insertions(+), 99 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 2d023bbece2..d444f4cf614 100644 --- a/usr.sbin/pkg_add/OpenBSD/Delete.pm +++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Delete.pm,v 1.165 2022/06/09 09:27:11 espie Exp $ +# $OpenBSD: Delete.pm,v 1.166 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -360,7 +360,7 @@ sub delete } } -sub should_run() { 1 } +sub should_run { 1 } package OpenBSD::PackingElement::UnexecDelete; sub should_run diff --git a/usr.sbin/pkg_add/OpenBSD/Error.pm b/usr.sbin/pkg_add/OpenBSD/Error.pm index 7905d763cf7..0c7bd630e55 100644 --- a/usr.sbin/pkg_add/OpenBSD/Error.pm +++ b/usr.sbin/pkg_add/OpenBSD/Error.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Error.pm,v 1.40 2019/07/24 18:05:26 espie Exp $ +# $OpenBSD: Error.pm,v 1.41 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie # @@ -20,7 +20,7 @@ use warnings; # this is a set of common classes related to error handling in pkg land package OpenBSD::Auto; -sub cache(*&) +sub cache :prototype(*&) { my ($sym, $code) = @_; my $callpkg = caller; @@ -170,7 +170,7 @@ sub dienow } } -sub try(&@) +sub try :prototype(&@) { my ($try, $catch) = @_; eval { &$try }; @@ -189,7 +189,7 @@ sub rethrow die $e if $e; } -sub catch(&) +sub catch :prototype(&) { bless $_[0], "OpenBSD::Error::catch"; } diff --git a/usr.sbin/pkg_add/OpenBSD/Getopt.pm b/usr.sbin/pkg_add/OpenBSD/Getopt.pm index 2de3b1f1a11..d25bf2b5842 100644 --- a/usr.sbin/pkg_add/OpenBSD/Getopt.pm +++ b/usr.sbin/pkg_add/OpenBSD/Getopt.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Getopt.pm,v 1.12 2012/04/10 16:57:12 espie Exp $ +# $OpenBSD: Getopt.pm,v 1.13 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2006 Marc Espie # @@ -48,7 +48,7 @@ sub handle_option } } -sub getopts($;$) +sub getopts { my ($args, $hash) = @_; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm index 865deb4b95e..979b0f4f9af 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageInfo.pm,v 1.63 2022/02/15 07:35:35 espie Exp $ +# $OpenBSD: PackageInfo.pm,v 1.64 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -174,7 +174,7 @@ sub installed_name return $name; } -sub info_names() +sub info_names { return @info; } @@ -187,7 +187,7 @@ sub is_info_name my $dlock; -sub lock_db($;$) +sub lock_db { my ($shared, $state) = @_; my $mode = $shared ? LOCK_SH : LOCK_EX; @@ -206,7 +206,7 @@ sub lock_db($;$) return; } -sub unlock_db() +sub unlock_db { if (defined $dlock) { flock($dlock, LOCK_UN); diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index 58894c9546e..4cbe0b6bf9d 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageName.pm,v 1.56 2021/11/25 18:23:53 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.57 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie # @@ -20,7 +20,7 @@ use warnings; package OpenBSD::PackageName; -sub url2pkgname($) +sub url2pkgname { my $name = $_[0]; $name =~ s|.*/||; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index 1ffb6a6ecd1..78104765f12 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageRepository.pm,v 1.172 2022/05/08 13:21:04 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.173 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie # @@ -101,12 +101,12 @@ sub dont_cleanup { } -sub ftp() { 'OpenBSD::PackageRepository::FTP' } -sub http() { 'OpenBSD::PackageRepository::HTTP' } -sub https() { 'OpenBSD::PackageRepository::HTTPS' } -sub scp() { 'OpenBSD::PackageRepository::SCP' } -sub file() { 'OpenBSD::PackageRepository::Local' } -sub installed() { 'OpenBSD::PackageRepository::Installed' } +sub ftp { 'OpenBSD::PackageRepository::FTP' } +sub http { 'OpenBSD::PackageRepository::HTTP' } +sub https { 'OpenBSD::PackageRepository::HTTPS' } +sub scp { 'OpenBSD::PackageRepository::SCP' } +sub file { 'OpenBSD::PackageRepository::Local' } +sub installed { 'OpenBSD::PackageRepository::Installed' } sub parse { diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm index ea4fea212cc..d9cd1333cac 100755 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/HTTP.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: HTTP.pm,v 1.13 2017/08/04 11:53:03 sthen Exp $ +# $OpenBSD: HTTP.pm,v 1.14 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2011 Marc Espie # @@ -232,7 +232,7 @@ package _Proxy; my $pid; my $token = 0; -sub batch(&) +sub batch { my $code = shift; if (defined $pid) { @@ -250,7 +250,7 @@ sub batch(&) } } -sub abort_batch() +sub abort_batch { if (defined $pid) { kill HUP => $pid; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm index 519f0fd88e1..adab12a7412 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SCP.pm,v 1.29 2014/08/27 18:40:03 kspillner Exp $ +# $OpenBSD: SCP.pm,v 1.30 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2003-2006 Marc Espie # @@ -64,7 +64,7 @@ my $pid; my $token = 0; $|= 1; -sub batch(&) +sub batch { my $code = shift; if (defined $pid) { @@ -82,7 +82,7 @@ sub batch(&) } } -sub abort_batch() +sub abort_batch { if (defined $pid) { kill 1, $pid; diff --git a/usr.sbin/pkg_add/OpenBSD/Paths.pm b/usr.sbin/pkg_add/OpenBSD/Paths.pm index 091927842b2..32054be5fd4 100644 --- a/usr.sbin/pkg_add/OpenBSD/Paths.pm +++ b/usr.sbin/pkg_add/OpenBSD/Paths.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Paths.pm,v 1.37 2022/04/13 21:19:16 espie Exp $ +# $OpenBSD: Paths.pm,v 1.38 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2007-2014 Marc Espie # @@ -21,61 +21,61 @@ use warnings; package OpenBSD::Paths; # Commands -sub ldconfig() { '/sbin/ldconfig' } -sub chroot() { '/usr/sbin/chroot' } -sub mkfontscale() { '/usr/X11R6/bin/mkfontscale' } -sub mkfontdir() { '/usr/X11R6/bin/mkfontdir' } -sub fc_cache() { '/usr/X11R6/bin/fc-cache' } -sub install_info() { '/usr/bin/install-info' } -sub useradd() { '/usr/sbin/useradd' } -sub groupadd() { '/usr/sbin/groupadd' } -sub sysctl() { '/sbin/sysctl' } -sub openssl() { '/usr/bin/openssl' } -sub pkgca() { '/etc/ssl/pkgca.pem' } -sub signify() { '/usr/bin/signify' } +sub ldconfig { '/sbin/ldconfig' } +sub chroot { '/usr/sbin/chroot' } +sub mkfontscale { '/usr/X11R6/bin/mkfontscale' } +sub mkfontdir { '/usr/X11R6/bin/mkfontdir' } +sub fc_cache { '/usr/X11R6/bin/fc-cache' } +sub install_info { '/usr/bin/install-info' } +sub useradd { '/usr/sbin/useradd' } +sub groupadd { '/usr/sbin/groupadd' } +sub sysctl { '/sbin/sysctl' } +sub openssl { '/usr/bin/openssl' } +sub pkgca { '/etc/ssl/pkgca.pem' } +sub signify { '/usr/bin/signify' } sub signifykey { my $s = $_[1]; "/etc/signify/$s.pub" } -sub pkg_add() { '/usr/sbin/pkg_add' } -sub chmod() { '/bin/chmod' } # external command is used for symbolic modes. -sub gzip() { '/usr/bin/gzip' } -sub ftp() { $ENV{'FETCH_CMD'} || '/usr/bin/ftp' } -sub groff() { '/usr/local/bin/groff' } -sub sh() { '/bin/sh' } -sub arch() { '/usr/bin/arch' } -sub uname() { '/usr/bin/uname' } -sub userdel() { '/usr/sbin/userdel' } -sub groupdel() { '/usr/sbin/groupdel' } -sub makewhatis() { '/usr/sbin/makewhatis' } -sub mknod() { '/sbin/mknod' } -sub mount() { '/sbin/mount' } -sub df() { '/bin/df' } -sub ssh() { '/usr/bin/ssh' } -sub make() { '/usr/bin/make' } -sub mklocatedb() { '/usr/libexec/locate.mklocatedb' } -sub locate() { '/usr/bin/locate' } -sub hostname() { '/bin/hostname' } -sub doas() { '/usr/bin/doas' } -sub env() { '/usr/bin/env' } -sub du() { '/usr/bin/du' } -sub diff() { '/usr/bin/diff' } -sub sha256() { '/bin/sha256' } +sub pkg_add { '/usr/sbin/pkg_add' } +sub chmod { '/bin/chmod' } # external command is used for symbolic modes. +sub gzip { '/usr/bin/gzip' } +sub ftp { $ENV{'FETCH_CMD'} || '/usr/bin/ftp' } +sub groff { '/usr/local/bin/groff' } +sub sh { '/bin/sh' } +sub arch { '/usr/bin/arch' } +sub uname { '/usr/bin/uname' } +sub userdel { '/usr/sbin/userdel' } +sub groupdel { '/usr/sbin/groupdel' } +sub makewhatis { '/usr/sbin/makewhatis' } +sub mknod { '/sbin/mknod' } +sub mount { '/sbin/mount' } +sub df { '/bin/df' } +sub ssh { '/usr/bin/ssh' } +sub make { '/usr/bin/make' } +sub mklocatedb { '/usr/libexec/locate.mklocatedb' } +sub locate { '/usr/bin/locate' } +sub hostname { '/bin/hostname' } +sub doas { '/usr/bin/doas' } +sub env { '/usr/bin/env' } +sub du { '/usr/bin/du' } +sub diff { '/usr/bin/diff' } +sub sha256 { '/bin/sha256' } # Various paths -sub shells() { '/etc/shells' } -sub pkgdb() { '/var/db/pkg' } -sub localbase() { '/usr/local' } -sub vartmp() { '/tmp' } -sub portsdir() { '/usr/ports' } +sub shells { '/etc/shells' } +sub pkgdb { '/var/db/pkg' } +sub localbase { '/usr/local' } +sub vartmp { '/tmp' } +sub portsdir { '/usr/ports' } -sub library_dirs() { ("/usr", "/usr/X11R6") } -sub master_keys() { ("/etc/master_key") } -sub installurl() { "/etc/installurl" } -sub srclocatedb() { "/usr/lib/locate/src.db" } -sub xlocatedb() { "/usr/X11R6/lib/locate/xorg.db" } +sub library_dirs { ("/usr", "/usr/X11R6") } +sub master_keys { ("/etc/master_key") } +sub installurl { "/etc/installurl" } +sub srclocatedb { "/usr/lib/locate/src.db" } +sub xlocatedb { "/usr/X11R6/lib/locate/xorg.db" } sub updateinfodb { '/usr/local/share/update.db' } -sub font_cruft() { ("fonts.alias", "fonts.dir", "fonts.cache-1", "fonts.scale") } -sub man_cruft() { ("whatis.db", "mandoc.db", "mandoc.index") } -sub info_cruft() { ("dir") } +sub font_cruft { ("fonts.alias", "fonts.dir", "fonts.cache-1", "fonts.scale") } +sub man_cruft { ("whatis.db", "mandoc.db", "mandoc.index") } +sub info_cruft { ("dir") } # a bit of code, OS-dependent stuff that's run-time detected and has no # home yet. diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm index bdc5c77e214..19b8c0958a4 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PkgCfl.pm,v 1.39 2014/02/01 10:53:17 espie Exp $ +# $OpenBSD: PkgCfl.pm,v 1.40 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie # @@ -68,20 +68,20 @@ sub conflicts_with } } -sub register($$) +sub register { my ($plist, $state) = @_; $state->{conflict_list}{$plist->pkgname} = $plist->conflict_list; } -sub unregister($$) +sub unregister { my ($plist, $state) = @_; delete $state->{conflict_list}{$plist->pkgname}; } -sub fill_conflict_lists($) +sub fill_conflict_lists { my $state = shift; for my $pkg (installed_packages()) { @@ -96,7 +96,7 @@ sub fill_conflict_lists($) } } -sub find($$) +sub find { my ($pkgname, $state) = @_; my @bad = (); diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index eb8d0ff23c4..22d287f1127 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.186 2023/05/16 14:30:55 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.187 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -250,7 +250,7 @@ sub register_forbidden } } -sub is_forbidden() { 0 } +sub is_forbidden { 0 } sub resolve_link { my ($filename, $base, $level) = @_; @@ -507,7 +507,7 @@ sub prepare_for_archival return $o; } -sub forbidden() { 1 } +sub forbidden { 1 } sub register_for_archival { @@ -842,31 +842,31 @@ sub check_version } package OpenBSD::PackingElement::DigitalSignature; -sub is_forbidden() { 1 } +sub is_forbidden { 1 } package OpenBSD::PackingElement::Signer; -sub is_forbidden() { 1 } +sub is_forbidden { 1 } package OpenBSD::PackingElement::ExtraInfo; -sub is_forbidden() { 1 } +sub is_forbidden { 1 } package OpenBSD::PackingElement::ManualInstallation; -sub is_forbidden() { 1 } +sub is_forbidden { 1 } package OpenBSD::PackingElement::Firmware; -sub is_forbidden() { 1 } +sub is_forbidden { 1 } package OpenBSD::PackingElement::Url; -sub is_forbidden() { 1 } +sub is_forbidden { 1 } package OpenBSD::PackingElement::Arch; -sub is_forbidden() { 1 } +sub is_forbidden { 1 } package OpenBSD::PackingElement::LocalBase; -sub is_forbidden() { 1 } +sub is_forbidden { 1 } package OpenBSD::PackingElement::Version; -sub is_forbidden() { 1 } +sub is_forbidden { 1 } # put together file and filename, in order to handle fragments simply package MyFile; diff --git a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm index bffdf7863af..e900bf5ceb3 100644 --- a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm +++ b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: RequiredBy.pm,v 1.28 2023/05/04 14:02:44 espie Exp $ +# $OpenBSD: RequiredBy.pm,v 1.29 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie # @@ -166,12 +166,12 @@ package OpenBSD::RequiredBy; our @ISA=qw(OpenBSD::RequirementList); use OpenBSD::PackageInfo; -sub filename() { REQUIRED_BY }; +sub filename { REQUIRED_BY }; package OpenBSD::Requiring; our @ISA=qw(OpenBSD::RequirementList); use OpenBSD::PackageInfo; -sub filename() { REQUIRING }; +sub filename { REQUIRING }; 1; diff --git a/usr.sbin/pkg_add/OpenBSD/Signer.pm b/usr.sbin/pkg_add/OpenBSD/Signer.pm index da41fe55c1b..9686387e28f 100644 --- a/usr.sbin/pkg_add/OpenBSD/Signer.pm +++ b/usr.sbin/pkg_add/OpenBSD/Signer.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: Signer.pm,v 1.10 2016/10/03 13:17:30 espie Exp $ +# $OpenBSD: Signer.pm,v 1.11 2023/05/17 15:51:58 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -19,7 +19,7 @@ use strict; use warnings; -# code necessary to create signed package +# code necessary to create signed packages # the factory that chooses what method to use to sign things package OpenBSD::Signer; -- 2.20.1