Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: system() patch for Win32


  • From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
  • Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
  • Subject: Re: system() patch for Win32
  • Date: Thu, 03 Apr 2003 09:43:27 -0500
  • Message-id: <28282(dot)1049381007(at)sss(dot)pgh(dot)pa(dot)us>

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




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group