4
4
*
5
5
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
6
6
*
7
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.34 2004/10/12 21:54:43 petere Exp $
7
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.35 2004/10/13 10:35:05 momjian Exp $
8
8
*
9
9
*-------------------------------------------------------------------------
10
10
*/
21
21
#include "libpq/pqsignal.h"
22
22
#include "getopt_long.h"
23
23
24
+ #if defined(__CYGWIN__ )
25
+ #include <windows.h>
26
+ #endif
27
+
24
28
#ifndef HAVE_OPTRESET
25
29
int optreset ;
26
30
#endif
@@ -95,7 +99,7 @@ static void do_reload(void);
95
99
static void do_status (void );
96
100
static void do_kill (pgpid_t pid );
97
101
98
- #ifdef WIN32
102
+ #if defined( WIN32 ) || defined( __CYGWIN__ )
99
103
static bool pgwin32_IsInstalled (SC_HANDLE );
100
104
static char * pgwin32_CommandLine (bool );
101
105
static void pgwin32_doRegister ();
@@ -116,7 +120,7 @@ static char pid_file[MAXPGPATH];
116
120
static char conf_file [MAXPGPATH ];
117
121
118
122
119
- #ifdef WIN32
123
+ #if defined( WIN32 ) || defined( __CYGWIN__ )
120
124
static void
121
125
write_eventlog (int level , const char * line )
122
126
{
@@ -154,7 +158,7 @@ write_stderr(const char *fmt,...)
154
158
va_list ap ;
155
159
156
160
va_start (ap , fmt );
157
- #ifndef WIN32
161
+ #if !defined( WIN32 ) && !defined( __CYGWIN__ )
158
162
/* On Unix, we just fprintf to stderr */
159
163
vfprintf (stderr , fmt , ap );
160
164
#else
@@ -318,15 +322,15 @@ start_postmaster(void)
318
322
* http://dev.remotenetworktechnology.com/cmd/cmdfaq.htm
319
323
*/
320
324
if (log_file != NULL )
321
- #ifndef WIN32
325
+ #if !defined( WIN32 ) && !defined( __CYGWIN__ )
322
326
snprintf (cmd , MAXPGPATH , "%s\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1 &%s" ,
323
327
#else
324
328
snprintf (cmd , MAXPGPATH , "%sSTART /B \"\" \"%s\" %s%s < \"%s\" >> \"%s\" 2>&1%s" ,
325
329
#endif
326
330
SYSTEMQUOTE , postgres_path , pgdata_opt , post_opts ,
327
331
DEVNULL , log_file , SYSTEMQUOTE );
328
332
else
329
- #ifndef WIN32
333
+ #if !defined( WIN32 ) && !defined( __CYGWIN__ )
330
334
snprintf (cmd , MAXPGPATH , "%s\"%s\" %s%s < \"%s\" 2>&1 &%s" ,
331
335
#else
332
336
snprintf (cmd , MAXPGPATH , "%sSTART /B \"\" \"%s\" %s%s < \"%s\" 2>&1%s" ,
@@ -807,7 +811,7 @@ do_kill(pgpid_t pid)
807
811
}
808
812
}
809
813
810
- #ifdef WIN32
814
+ #if defined( WIN32 ) || defined( __CYGWIN__ )
811
815
812
816
static bool
813
817
pgwin32_IsInstalled (SC_HANDLE hSCM )
@@ -1085,14 +1089,14 @@ do_help(void)
1085
1089
printf (_ (" %s reload [-D DATADIR] [-s]\n" ), progname );
1086
1090
printf (_ (" %s status [-D DATADIR]\n" ), progname );
1087
1091
printf (_ (" %s kill SIGNALNAME PROCESSID\n" ), progname );
1088
- #ifdef WIN32
1092
+ #if defined( WIN32 ) || defined( __CYGWIN__ )
1089
1093
printf (_ (" %s register [-N SERVICENAME] [-U USERNAME] [-P PASSWORD] [-D DATADIR] [-w] [-o \"OPTIONS\"]\n" ), progname );
1090
1094
printf (_ (" %s unregister [-N SERVICENAME]\n" ), progname );
1091
1095
#endif
1092
1096
printf (_ ("Common options:\n" ));
1093
1097
printf (_ (" -D, --pgdata DATADIR location of the database storage area\n" ));
1094
1098
printf (_ (" -s, --silent only print errors, no informational messages\n" ));
1095
- #ifdef WIN32
1099
+ #if defined( WIN32 ) || defined( __CYGWIN__ )
1096
1100
printf (_ (" -N service name with which to register PostgreSQL server\n" ));
1097
1101
printf (_ (" -P password of account to register PostgreSQL server\n" ));
1098
1102
printf (_ (" -U user name of account to register PostgreSQL server\n" ));
@@ -1201,7 +1205,7 @@ main(int argc, char **argv)
1201
1205
int c ;
1202
1206
pgpid_t killproc = 0 ;
1203
1207
1204
- #ifdef WIN32
1208
+ #if defined( WIN32 ) || defined( __CYGWIN__ )
1205
1209
setvbuf (stderr , NULL , _IONBF , 0 );
1206
1210
#endif
1207
1211
@@ -1348,7 +1352,7 @@ main(int argc, char **argv)
1348
1352
set_sig (argv [++ optind ]);
1349
1353
killproc = atol (argv [++ optind ]);
1350
1354
}
1351
- #ifdef WIN32
1355
+ #if defined( WIN32 ) || defined( __CYGWIN__ )
1352
1356
else if (strcmp (argv [optind ], "register") == 0 )
1353
1357
ctl_command = REGISTER_COMMAND ;
1354
1358
else if (strcmp (argv [optind ], "unregister ") == 0 )
@@ -1438,7 +1442,7 @@ main(int argc, char **argv)
1438
1442
case KILL_COMMAND :
1439
1443
do_kill (killproc );
1440
1444
break ;
1441
- #ifdef WIN32
1445
+ #if defined( WIN32 ) || defined( __CYGWIN__ )
1442
1446
case REGISTER_COMMAND :
1443
1447
pgwin32_doRegister ();
1444
1448
break ;
0 commit comments