From owner-freebsd-current@FreeBSD.ORG Fri Nov 5 19:39:55 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 C3EFC16A4CE; Fri, 5 Nov 2004 19:39:55 +0000 (GMT) Received: from dragon.nuxi.com (trang.nuxi.com [66.93.134.19]) by mx1.FreeBSD.org (Postfix) with ESMTP id 907C543D1D; Fri, 5 Nov 2004 19:39:55 +0000 (GMT) (envelope-from obrien@NUXI.com) Received: from dragon.nuxi.com (obrien@localhost [127.0.0.1]) by dragon.nuxi.com (8.13.1/8.13.1) with ESMTP id iA5JdshA079394; Fri, 5 Nov 2004 11:39:54 -0800 (PST) (envelope-from obrien@dragon.nuxi.com) Received: (from obrien@localhost) by dragon.nuxi.com (8.13.1/8.13.1/Submit) id iA5JdrYQ079393; Fri, 5 Nov 2004 11:39:53 -0800 (PST) (envelope-from obrien) Date: Fri, 5 Nov 2004 11:39:53 -0800 From: "David O'Brien" To: Giorgos Keramidas Message-ID: <20041105193953.GD44972@dragon.nuxi.com> References: <000901c4bfdc$6d1c2d50$0200000a@redline> <20041101164117.M14827@mp2.macomnet.net> <20041101135250.GA41645@orion.daedalusnetworks.priv> <20041101183035.GC22427@stack.nl> <20041101195539.GB2127@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041101195539.GB2127@gothmog.gr> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 6.0-CURRENT Organization: The NUXI BSD Group X-Pgp-Rsa-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Rsa-Keyid: 1024/34F9F9D5 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 Reply-To: obrien@freebsd.org List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2004 19:39:55 -0000 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. > 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? -- -- David (obrien@FreeBSD.org) #include #include #include void vsystem(char *fmt, ...) { char cmd[500]; va_list args; va_start(args, fmt); vsnprintf(cmd, sizeof cmd, fmt, args); va_end(args); execl("/bin/sh", "/bin/sh", "-c", cmd, (char *)NULL); } int main() { //vsystem("echo '# Note that BSD'\\''s export syntax is \"host-centric\" vs. Sun'\\''s \"FS-centric\" one.' >> /tmp/exports"); //vsystem("echo '# Note that BSD'\"'\"'s export syntax is \"host-centric\" vs. Sun'\"'\"'s \"FS-centric\" one.' >> /tmp/exports"); return 0; }