search for: print_command

Displaying 11 results from an estimated 11 matches for "print_command".

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.
...a_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) > + fprintf (stderr, "%s", cmd[0]); > + for (i = 1; i < len && cmd[i] != NULL; ++i) Is the 'i < len' check wasted effort, given that 'cmd[i] != NULL' is sane after end_passthru(), and...
2018 Nov 13
0
[PATCH 2/2] build: Replace ./nbdkit with a C program.
...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"); +} + +int +main (int argc, char *argv[]) +{ + int c; + int long...
2018 Nov 14
0
[PATCH nbdkit v2 2/2] build: Replace ./nbdkit with a C program.
...ormat (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"); +} + +int +main (int argc, char *argv[]) +{ + int c; + int long...
2019 Mar 18
2
[PATCH nbdkit] wrapper: Set MALLOC_CHECK=1 and MALLOC_PERTURB_ (randomly).
...{ bool verbose = false; char *s; + time_t t; + unsigned tu; + char ts[32]; /* If NBDKIT_VALGRIND=1 is set in the environment, then we run the * program under valgrind. This is used by the tests. Similarly if @@ -250,6 +254,19 @@ main (int argc, char *argv[]) if (verbose) print_command (); + /* This is a cheap way to find some use-after-free and uninitialized + * read problems when using glibc, and doesn't affect normal + * operation or other libc. We don't overwrite existing values so + * this can be disabled or overridden at runtime. + */ + setenv ("MA...
2020 Aug 20
0
[PATCH nbdkit 12/13] wrapper: Port the wrapper to run on Windows.
...x c27afae0..fe750936 100644 --- a/wrapper.c +++ b/wrapper.c @@ -72,6 +72,7 @@ #include <time.h> #include "options.h" +#include "windows-compat.h" #include "utils.h" /* Construct an array of parameters passed through to real nbdkit. */ @@ -131,6 +132,45 @@ print_command (void) fputc ('\n', stderr); } +#ifdef WIN32 +/* Windows behaviour of _spawnvp is completely retarded: + * https://stackoverflow.com/questions/4146980/how-to-avoid-space-splitting-and-quote-removal-with-spawnvp + */ +static const char * +quote_string_for_spawn (const char *str) +{ +...
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
2004 Feb 16
2
debian unstable : mutt polling imap mailboxes
...g # if something is tagged, run commands on tagged msgs. set fast_reply # do not ask for to, subject,... when replying set index_format="%4C %Z %[!%d/%m] %-17.17F (%3l) %s" set pager_format="%S [%C] %n (%l) %s" set folder_format="%F %d %8s %N %f" set print_command="enscript -2r -o /tmp/email.ps -Email" # this does not seem to work atm #set query_command="lbdbq %s" # Need this if using cygwin #set sendmail = "/usr/sbin/ssmtp.exe" send-hook . 'my_hdr From: Kai Hendry <hendry at cs.helsinki.fi>' #send-hook ...
2018 Nov 14
0
Re: [PATCH 2/2] build: Replace ./nbdkit with a C program.
...gt; >+ > >+ /* 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 still rewrite './nbdkit -vf' into '/path/to/sr...
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
2020 Aug 20
15
[PATCH nbdkit 0/13] Port to Windows without using a separate library.
Also available here: https://github.com/rwmjones/nbdkit/tree/2020-windows-mingw-nolib After a lot of work I have made the port to Windows work without using a separate library. Instead, on Windows only, we build an "import library" (library of stubs) which resolves references to nbdkit_* functions in the main program and fixes up the plugin, basically the first technique outlined in