From 91daaedbd55ee502ca6e7486dbb6d4b6ca0a6ed3 Mon Sep 17 00:00:00 2001 From: espie Date: Wed, 11 Jul 2018 09:54:49 +0000 Subject: [PATCH] allow state->new to deduce the command name from $0 --- usr.sbin/pkg_add/OpenBSD/State.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- 2.20.1