Re: system() patch for Win32

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: system() patch for Win32
Date: 2003-04-04 20:39:21
Message-ID: 200304042039.h34KdLp28712@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


OK, I have modified the use of "exec" to be more local to the snprintf.

---------------------------------------------------------------------------

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 2.4 KB

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-04-04 20:48:28 Re: Win32 defines
Previous Message Bruce Momjian 2003-04-04 20:13:49 Re: Win32 path patch