From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 1 17:31:08 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6366716A41F for ; Mon, 1 Aug 2005 17:31:08 +0000 (GMT) (envelope-from diz@linuxpowered.com) Received: from terrence.linuxpowered.com (terrence.linuxpowered.com [70.85.29.100]) by mx1.FreeBSD.org (Postfix) with ESMTP id E81BB43D49 for ; Mon, 1 Aug 2005 17:31:05 +0000 (GMT) (envelope-from diz@linuxpowered.com) Received: from localhost (localhost.localdomain [127.0.0.1]) by terrence.linuxpowered.com (Postfix) with ESMTP id 5E497264278 for ; Mon, 1 Aug 2005 12:29:49 -0500 (CDT) Received: from terrence.linuxpowered.com ([127.0.0.1]) by localhost (terrence.linuxpowered.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21790-09 for ; Mon, 1 Aug 2005 12:29:47 -0500 (CDT) Received: from secure.linuxpowered.com (www.vpisystems.com [70.85.29.100]) by terrence.linuxpowered.com (Postfix) with ESMTP id 7D954264053 for ; Mon, 1 Aug 2005 12:29:47 -0500 (CDT) Received: from 68.95.232.238 (SquirrelMail authenticated user diz@linuxpowered.com); by secure.linuxpowered.com with HTTP; Mon, 1 Aug 2005 12:29:47 -0500 (CDT) Message-ID: <64511.68.95.232.238.1122917387.squirrel@68.95.232.238> Date: Mon, 1 Aug 2005 12:29:47 -0500 (CDT) From: diz@linuxpowered.com To: freebsd-hackers@freebsd.org User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20050801122947_40158" X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: amavisd-new at phpcult.com X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: [patch] rc.d cleanup X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2005 17:31:08 -0000 ------=_20050801122947_40158 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Hi there, This is my first patch to this project. This is the first of many patches to come actually, but I need to find a sponsor to guide me, and review what I submit. The patch is kinda big, and far reaching in terms of altering almost every rc.d script. This patch effects most of the rc.d scripts that utilize simple IF statements, converting them to logical AND/OR's instead. For example: if [ ! -f foo ] then bar fi Would simply become: [ -f foo ] || bar The exception (but not the rule) is for any situation where ELIF/ELSE is required. In other words any exclusive conditional situations. I also applied this notion to many simple blocks of code wrapped around non-exclusive IF statements, such as: [ -f foo ] && { command-list [...] } This has the result of reducing the size of the shell code, and reducing the problem of over-engineering that plagues many scripts. I found quite many places where there were one-line situations wrapped up in multi-line IF statements, which I was compelled to eliminate. Further more, as I audited the scripts, I noticed that in several places this style of scripting was already used in various places. So I feel this make the entire span of scripts uniform. -Jon Disnard ------=_20050801122947_40158--