system() patch for Win32
Here is a patch to handle 'rm', 'cp', and 'exec' usage by system();
again very small.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachments:
/pgpatches/win32/systemtext/plainDownload+18-10
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
OK, I have modified the use of "exec" to be more local to the snprintf.
---------------------------------------------------------------------------
Tom Lane wrote:
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
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073