Date: Sat, 6 Nov 2004 08:38:47 +0200 From: Giorgos Keramidas <keramida@freebsd.org> To: "David O'Brien" <obrien@freebsd.org> Cc: Jilles Tjoelker <jilles@stack.nl> Subject: Re: exports typo Message-ID: <20041106063847.GA881@gothmog.gr> In-Reply-To: <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> <20041105193953.GD44972@dragon.nuxi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2004-11-05 11:39, David O'Brien <obrien@FreeBSD.org> wrote: > On Mon, Nov 01, 2004 at 09:55:39PM +0200, Giorgos Keramidas wrote: > > On 2004-11-01 19:30, Jilles Tjoelker <jilles@stack.nl> 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...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041106063847.GA881>