NetBSD Problem Report #36232

From jukka+moray@salmi.ch  Sat Apr 28 12:58:49 2007
Return-Path: <jukka+moray@salmi.ch>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id DCC5A63B960
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 28 Apr 2007 12:58:49 +0000 (UTC)
Message-Id: <20070428125848.66BFB153AE@moray.salmi.ch>
Date: Sat, 28 Apr 2007 14:58:48 +0200 (CEST)
From: j+nbsd@2007.salmi.ch
To: gnats-bugs@NetBSD.org
Subject: add backward compatibility to wscons rc.d script (patch supplied)
X-Send-Pr-Version: 3.95

>Number:         36232
>Category:       misc
>Synopsis:       add backward compatibility to wscons rc.d script (patch supplied)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 28 13:00:00 +0000 2007
>Closed-Date:    Sun Feb 25 18:17:27 +0000 2018
>Last-Modified:  Sun Feb 25 18:17:27 +0000 2018
>Originator:     Jukka Salmi
>Release:        NetBSD 4.99.18
>Organization:

>Environment:
System: NetBSD moray.salmi.ch 4.99.18 NetBSD 4.99.18 (MORAY.APM) #0: Thu Apr 26 01:13:24 CEST 2007 build@moray.salmi.ch:/b/build/nbsd/c/i386/sys/arch/i386/compile/MORAY.APM i386
Architecture: i386
Machine: i386
>Description:
Revision 1.12 of src/etc/rc.d/wscons broke backward compatibility with
existing wscons.conf(5) syntax and didn't even document this change.
>How-To-Repeat:
Add a `setvar ...' line in wscons.conf(5) syntax to /etc/wscons.conf
and run `/etc/rc.d/wscons start'...
>Fix:
The attached patch teaches the wscons script to understand both new
and old config file syntax. Additionally, it allows for the old
"variable=value" and the new "variable" "value" syntax to be used for
both syntaxes; this is also backward compatible and thus can be seen
as a feature ;-)

If only the new syntax should be supported, then it used should be
documented in wscons.conf(5).

The patch is also available from
http://salmi.ch/~jukka/patches/nbsd/HEAD/etc/rc.d/wscons.patch

Index: etc/rc.d/wscons
===================================================================
RCS file: /cvsroot/src/etc/rc.d/wscons,v
retrieving revision 1.12
diff -u -p -r1.12 wscons
--- etc/rc.d/wscons	2 Apr 2007 12:42:42 -0000	1.12
+++ etc/rc.d/wscons	25 Apr 2007 09:14:06 -0000
@@ -157,23 +157,42 @@ wscons_start()
 				;;

 			setvar)
-				dev=$arg1
-				var=$arg2
-				val=$arg3
-
-				case $dev in
-				    ttyE*)
-					cmdmod="-d"
-					;;
-				    wskbd*)
-					cmdmod="-k"
-					;;
-				    wsmouse*)
-					cmdmod="-m"
-					;;
+				set -- "$arg1" "$arg2" "$arg3"
+				case "$1" in
+					wskbd*)
+						echo -n "$1: "
+						cmd="$wsctl -f /dev/$1 -k"
+						shift
+						;;
+					ttyE*)
+						echo -n "$1: "
+						cmd="$wsctl -f /dev/$1 -d"
+						shift
+						;;
+					wsmouse*)
+						echo -n "$1: "
+						cmd="$wsctl -f /dev/$1 -m"
+						shift
+						;;
+					# be backward compatible with
+					# old wscons.conf(5) syntax:
+					keyboard)
+						cmd="$wsctl -k"
+						shift
+						;;
+					display)
+						cmd="$wsctl -d"
+						shift
+						;;
+					mouse)
+						cmd="$wsctl -m"
+						shift
+						;;
+					*)
+						cmd="$wsctl"
+						;;
 				esac
-				echo -n "$dev: "
-				cmd="$wsctl -f /dev/$dev $cmdmod -w $var=$val"
+				cmd="$cmd -w ${1}${2+=${2}}"
 				eval $DOIT $cmd
 				;;


>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: maxv@NetBSD.org
State-Changed-When: Sun, 25 Feb 2018 18:17:27 +0000
State-Changed-Why:
Old PR, the fix proposed is not relevant anymore.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.