Re: system() patch for Win32 - Mailing list pgsql-patches

From Tom Lane
Subject Re: system() patch for Win32
Date
Msg-id 28282.1049381007@sss.pgh.pa.us
Whole thread Raw
In response to system() patch for Win32  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: system() patch for Win32
List pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Here is a patch to handle 'rm', 'cp', and 'exec' usage by system();
> again very small.

This part seems unnecessarily obscurantist:

> ! #ifndef    WIN32
> ! #define    EXEC    "exec "
> ! #else
> ! #define    EXEC    ""
> ! #endif

> !     sprintf(sys, "%s%s '%s'", EXEC, editorName, fname);

I like the other style (just #ifdef to choose one of two sprintf
commands) better.  It seems easier to understand, as well as less
fragile --- the way you have it here makes it *real* easy to break
the computation of the buffer size for the command string.

            regards, tom lane


pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Win32 defines
Next
From: Tom Lane
Date:
Subject: Re: Win32 defines