diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2018-07-11 09:54:50 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2018-07-11 09:54:50 +0000 |
commit | d48e38e509cde46160d5f39a40fd328f860a3356 (patch) | |
tree | d5ad3cf1478eaf2f338c602fb628413da575a068 /usr.sbin/pkg_add/OpenBSD | |
parent | cbc8b5ccfbab5b0cf8e131631136e42f3b6a013d (diff) |
allow state->new to deduce the command name from $0
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/State.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/State.pm b/usr.sbin/pkg_add/OpenBSD/State.pm index 18adfdea928..f430b3a770d 100644 --- a/usr.sbin/pkg_add/OpenBSD/State.pm +++ b/usr.sbin/pkg_add/OpenBSD/State.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: State.pm,v 1.52 2018/05/16 10:02:40 espie Exp $ +# $OpenBSD: State.pm,v 1.53 2018/07/11 09:54:49 espie Exp $ # # Copyright (c) 2007-2014 Marc Espie <espie@openbsd.org> # @@ -105,6 +105,10 @@ sub new { my $class = shift; my $cmd = shift; + if (!defined $cmd) { + $cmd = $0; + $cmd =~ s,.*/,,; + } my $o = bless {cmd => $cmd}, $class; $o->init(@_); return $o; |