exports typo
David O'Brien
obrien at freebsd.org
Fri Nov 5 11:39:55 PST 2004
On Mon, Nov 01, 2004 at 09:55:39PM +0200, Giorgos Keramidas wrote:
> On 2004-11-01 19:30, Jilles Tjoelker <jilles at 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 at 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;
}
More information about the freebsd-current
mailing list