From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 13 06:35:13 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 878D016A46C for ; Wed, 13 Jun 2007 06:35:13 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from mxout3.cac.washington.edu (mxout3.cac.washington.edu [140.142.32.166]) by mx1.freebsd.org (Postfix) with ESMTP id 6481113C469 for ; Wed, 13 Jun 2007 06:35:13 +0000 (UTC) (envelope-from youshi10@u.washington.edu) Received: from smtp.washington.edu (smtp.washington.edu [140.142.33.7] (may be forged)) by mxout3.cac.washington.edu (8.13.7+UW06.06/8.13.7+UW07.05) with ESMTP id l5D6ZCs0026401 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Jun 2007 23:35:12 -0700 X-Auth-Received: from [192.168.10.45] (c-24-10-12-194.hsd1.ca.comcast.net [24.10.12.194]) (authenticated authid=youshi10) by smtp.washington.edu (8.13.7+UW06.06/8.13.7+UW07.03) with ESMTP id l5D6ZBvt027132 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 12 Jun 2007 23:35:12 -0700 Message-ID: <466F9020.9050306@u.washington.edu> Date: Tue, 12 Jun 2007 23:35:12 -0700 From: Garrett Cooper User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: Alexander Leidinger References: <466F86C6.7010006@u.washington.edu> <20070613083046.atl5dyq3s488s0o8@webmail.leidinger.net> In-Reply-To: <20070613083046.atl5dyq3s488s0o8@webmail.leidinger.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 5.3.1.294258, Antispam-Engine: 2.5.1.298604, Antispam-Data: 2007.6.12.231945 X-Uwash-Spam: Gauge=IIIIIII, Probability=7%, Report='__CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' Cc: hackers@freebsd.org Subject: Re: Using shell commands versus C equivalents 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: Wed, 13 Jun 2007 06:35:13 -0000 Alexander Leidinger wrote: > Quoting Garrett Cooper (from Tue, 12 Jun > 2007 22:55:18 -0700): > >> Another simple question (I hope): >> Is there any reason why shell commands should be used in place of a >> C command (in this case chmod via vsystem instead of the chmod(2) >> function)? It seems like the fork / exec would be more expensive with >> the shell command, but any area where code could be optimized is more >> than welcome I would think. > > If it is just one file, I don't see the reason to use the shell > command, but if you need to reinvent "chmod -R", I don't see a reason > to forbid the use of the shell command (pragmatic programming). > > Bye, > Alexander. > Exactly my thinking (ch{own,mod} for one file, not reinventing the -R 'wheel'). After looking over style(7) I don't see anything about not doing that. Thanks for the reply :). -Garrett