From owner-freebsd-current@FreeBSD.ORG Sat Nov 6 06:40:01 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 50C8216A4CE; Sat, 6 Nov 2004 06:40:01 +0000 (GMT) Received: from kane.otenet.gr (kane.otenet.gr [195.170.0.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9539143D2D; Sat, 6 Nov 2004 06:40:00 +0000 (GMT) (envelope-from keramida@freebsd.org) Received: from gothmog.gr (patr530-b188.otenet.gr [212.205.244.196]) iA66dpON021371; Sat, 6 Nov 2004 08:39:56 +0200 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.1/8.13.1) with ESMTP id iA66cl9M001827; Sat, 6 Nov 2004 08:38:47 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from giorgos@localhost) by gothmog.gr (8.13.1/8.13.1/Submit) id iA66cl6H001826; Sat, 6 Nov 2004 08:38:47 +0200 (EET) (envelope-from keramida@freebsd.org) Date: Sat, 6 Nov 2004 08:38:47 +0200 From: Giorgos Keramidas To: "David O'Brien" Message-ID: <20041106063847.GA881@gothmog.gr> References: <000901c4bfdc$6d1c2d50$0200000a@redline> <20041101164117.M14827@mp2.macomnet.net> <20041101135250.GA41645@orion.daedalusnetworks.priv> <20041101183035.GC22427@stack.nl> <20041101195539.GB2127@gothmog.gr> <20041105193953.GD44972@dragon.nuxi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041105193953.GD44972@dragon.nuxi.com> cc: freebsd-current@freebsd.org cc: Jilles Tjoelker Subject: Re: exports typo X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Nov 2004 06:40:01 -0000 On 2004-11-05 11:39, David O'Brien wrote: > On Mon, Nov 01, 2004 at 09:55:39PM +0200, Giorgos Keramidas wrote: > > On 2004-11-01 19:30, Jilles Tjoelker wrote: > > > > - vsystem("echo '# Note that BSD's export syntax is \"host-centric\" vs. Sun\'s \"FS-centric\" one.' >> /etc/exports"); > > > > + vsystem("echo '# Note that BSD'"'"'s export syntax is \"host-centric\" vs. Sun'"'"'s \"FS-centric\" one.' >> /etc/exports"); > > foo.c:18: error: syntax error before '"' > foo.c:18: error: stray '\' in program > foo.c:18: error: stray '\' in program > > vsystem("echo '# Note that BSD'\"'\"'s export syntax is \"host-centric\" vs. Sun'\"'\"'s \"FS-centric\" one.' >> /tmp/exports"); > is what it takes to make this work. Exactly! The only way to include a single quote character in an sh(1) command argument that is already quoted using single quotes is to quote the single quote character *outside* of the quoted string. I don't know if this sounds confused or confusing :-/ > > This, or the bash-like syntax of: > > vsystem("echo '# Note that BSD'\\''s export syntax...' >> /etc/exports"); > > NOW! we have a winner. > > Below is the test program. Which form should we go with? As long as the output file created by this contains the proper output text, I don't care which form is used. Pick one that you like better. I'd probably also add a comment above this point to make it more obvious why the funny quote and backslash weirdness is necessary in the C source, but that's another thing...