From: Jeff King Date: Tue, 22 Jul 2008 07:49:05 GMT Subject: Re: [PATCH 2/2] spawn pager via run_command interface Message-ID: <20080722074905.GB3999@sigill.intra.peff.net> In-Reply-To: <20080722073108.GA9714@artemis.madism.org> On Tue, Jul 22, 2008 at 09:31:08AM +0200, Pierre Habouzit wrote: > > I couldn't recall if this initializer style is portable enough for us. > > It was already there wrapped in ifdefs, but perhaps it was only ok > > because the mingw version always uses the same compiler? > > it's not, I asked long time ago, and it's C99, which mingw supports > indeed, and we don't want to require a C99 compiler. OK, then this should be squashed in. diff --git a/pager.c b/pager.c index 7743742..aa0966c 100644 --- a/pager.c +++ b/pager.c @@ -26,13 +26,8 @@ static void pager_preexec(void) #endif static const char *pager_argv[] = { "sh", "-c", NULL, NULL }; -static struct child_process pager_process = { - .argv = pager_argv, - .in = -1, -#ifndef __MINGW32__ - .preexec_cb = pager_preexec, -#endif -}; +static struct child_process pager_process; + static void wait_for_pager(void) { fflush(stdout); @@ -65,6 +60,11 @@ void setup_pager(void) /* spawn the pager */ pager_argv[2] = pager; + pager_process.argv = pager_argv; + pager_process.in = -1; +#ifndef __MINGW32__ + pager_process.preexec_cb = pager_preexec; +#endif if (start_command(&pager_process)) return;