From: espie Date: Wed, 11 Jul 2018 09:54:49 +0000 (+0000) Subject: allow state->new to deduce the command name from $0 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=91daaedbd55ee502ca6e7486dbb6d4b6ca0a6ed3;p=openbsd allow state->new to deduce the command name from $0 --- 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 # @@ -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;