Date: Fri, 5 Nov 2004 11:39:53 -0800 From: "David O'Brien" <obrien@freebsd.org> To: Giorgos Keramidas <keramida@freebsd.org> Cc: Jilles Tjoelker <jilles@stack.nl> Subject: Re: exports typo Message-ID: <20041105193953.GD44972@dragon.nuxi.com> In-Reply-To: <20041101195539.GB2127@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>
next in thread | previous in thread | raw e-mail | index | archive | help
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. > 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 <stdio.h> #include <stdarg.h> #include <unistd.h> 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041105193953.GD44972>