Re: exports typo

From: David O'Brien <obrien_at_freebsd.org>
Date: Fri, 5 Nov 2004 11:39:53 -0800
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;
}
Received on Fri Nov 05 2004 - 18:39:55 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:21 UTC