search for: end_passthru

Displaying 7 results from an estimated 7 matches for "end_passthru".

2018 Nov 13
3
[PATCH 0/2] build: Replace ./nbdkit with a C program.
This patch series solves the FreeBSD shebang problem in a completely different way, and a few other things besides. I propose that we replace ./nbdkit with a C program. The C program is a straightforward translation of the shell script. Some advantages of this approach are: - We can parse options in exactly the same way as the real program. - Use the more accurate ‘is_short_name’ test for
2018 Nov 14
2
Re: [PATCH 2/2] build: Replace ./nbdkit with a C program.
...ntf...)), so that the compiler can help diagnose misuse. > +{ > + va_list args; > + char *str; > + > + va_start (args, fs); > + if (vasprintf (&str, fs, args) == -1) > + abort (); > + va_end (args); > + passthru (str); > +} > + > +static void > +end_passthru (void) > +{ > + passthru (NULL); > +} Phew. I didn't see this on my first glance through, and wondered whether your realloc was passing trailing garbage to exec. > + > +static void > +print_command (void) > +{ > + size_t i; > + > + if (len > 0) > + f...
2018 Nov 13
0
[PATCH 2/2] build: Replace ./nbdkit with a C program.
...*)); + if (cmd == NULL) + abort (); + cmd[len] = s; + ++len; +} + +static void +passthru_format (const char *fs, ...) +{ + va_list args; + char *str; + + va_start (args, fs); + if (vasprintf (&str, fs, args) == -1) + abort (); + va_end (args); + passthru (str); +} + +static void +end_passthru (void) +{ + passthru (NULL); +} + +static void +print_command (void) +{ + size_t i; + + if (len > 0) + fprintf (stderr, "%s", cmd[0]); + for (i = 1; i < len && cmd[i] != NULL; ++i) + fprintf (stderr, " %s", cmd[i]); + fprintf (stderr, "\n"); +}...
2018 Nov 14
0
[PATCH nbdkit v2 2/2] build: Replace ./nbdkit with a C program.
...+ cmd[len] = s; + ++len; +} + +static void __attribute__((format (printf, 1, 2))) +passthru_format (const char *fs, ...) +{ + va_list args; + char *str; + + va_start (args, fs); + if (vasprintf (&str, fs, args) == -1) + abort (); + va_end (args); + passthru (str); +} + +static void +end_passthru (void) +{ + passthru (NULL); +} + +static void +print_command (void) +{ + size_t i; + + if (len > 0) + fprintf (stderr, "%s", cmd[0]); + for (i = 1; i < len && cmd[i] != NULL; ++i) + fprintf (stderr, " %s", cmd[i]); + fprintf (stderr, "\n"); +}...
2018 Nov 14
3
[PATCH nbdkit v2 0/2] build: Replace ./nbdkit with a C program.
v1 was here: https://www.redhat.com/archives/libguestfs/2018-November/msg00147.html v2: - Use stdbool for booleans. - Use __attribute__((format(printf))). - Don't abort on invalid options, exit with failure instead. - Preserve long/short option choices in the output. - Add '=' in long option output, ie. always use --longopt=arg. - Add "--" parameter
2018 Nov 14
0
Re: [PATCH 2/2] build: Replace ./nbdkit with a C program.
...kit/plugins/file/.libs/nbdkit-file-plugin.so -my-file > >+ > >+ /* Everything else is passed through without rewriting. */ > >+ while (optind < argc) { > >+ passthru (argv[optind]); > >+ ++optind; > >+ } > >+ } > >+ > >+ end_passthru (); > >+ if (verbose) > >+ print_command (); > > The rewrite from './nbdkit -f' into '/path/to/src/nbdkit > --foreground' looks weird; I argued that a helper function to > preserve the short option spelling when possible might be nicer > (you'll s...
2018 Nov 14
5
[PATCH nbdkit v3 0/4] build: Replace ./nbdkit with a C program.
v1 was here: https://www.redhat.com/archives/libguestfs/2018-November/msg00147.html v2 was here: https://www.redhat.com/archives/libguestfs/2018-November/msg00152.html v3: - Use optarg != NULL as a sentinel for has_arg. - Moved some variable decls into the inner loop. - Make nbdkit wrapper depend on config.status, so if srcdir or builddir changes then we rebuild the wrapper. It