Index: configure =================================================================== RCS file: /cvsroot/pgsql-server/configure,v retrieving revision 1.292 diff -c -c -r1.292 configure *** configure 1 Sep 2003 23:01:49 -0000 1.292 --- configure 7 Sep 2003 01:53:57 -0000 *************** *** 2370,2375 **** --- 2370,2381 ---- { echo "$as_me:$LINENO: using CFLAGS=$CFLAGS" >&5 echo "$as_me: using CFLAGS=$CFLAGS" >&6;} + # We already have this in Makefile.win32, but configure needs it too + if test "$PORTNAME" = "win32" + then + CPPFLAGS="$CPPFLAGS -Isrc/include/port/win32" + fi + # Check if the compiler still works with the template settings echo "$as_me:$LINENO: checking whether the C compiler still works" >&5 echo $ECHO_N "checking whether the C compiler still works... $ECHO_C" >&6 *************** *** 10810,10828 **** fi echo "$as_me:$LINENO: checking types of arguments for accept()" >&5 echo $ECHO_N "checking types of arguments for accept()... $ECHO_C" >&6 ! if test "${ac_cv_func_accept_arg1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ! if test "${ac_cv_func_accept_arg2+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ! if test "${ac_cv_func_accept_arg3+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ! for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do ! for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do ! for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do ! cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #ifdef HAVE_SYS_TYPES_H --- 10816,10838 ---- fi echo "$as_me:$LINENO: checking types of arguments for accept()" >&5 echo $ECHO_N "checking types of arguments for accept()... $ECHO_C" >&6 ! if test "${ac_cv_func_accept_return+set}" = set; then ! echo $ECHO_N "(cached) $ECHO_C" >&6 ! else ! if test "${ac_cv_func_accept_arg1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ! if test "${ac_cv_func_accept_arg2+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ! if test "${ac_cv_func_accept_arg3+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ! for ac_cv_func_accept_return in 'int' 'unsigned int PASCAL'; do ! for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do ! for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do ! for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do ! cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #ifdef HAVE_SYS_TYPES_H *************** *** 10831,10837 **** #ifdef HAVE_SYS_SOCKET_H #include #endif ! extern int accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" --- 10841,10847 ---- #ifdef HAVE_SYS_SOCKET_H #include #endif ! extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" *************** *** 10858,10870 **** ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ! ac_not_found=no; break 3 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_not_found=yes fi rm -f conftest.$ac_objext conftest.$ac_ext done done done --- 10868,10881 ---- ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ! ac_not_found=no; break 4 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_not_found=yes fi rm -f conftest.$ac_objext conftest.$ac_ext + done done done done *************** *** 10882,10889 **** fi fi ! echo "$as_me:$LINENO: result: $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *" >&5 ! echo "${ECHO_T}$ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *" >&6 cat >>confdefs.h <<_ACEOF #define ACCEPT_TYPE_ARG1 $ac_cv_func_accept_arg1 --- 10893,10907 ---- fi fi ! ! fi ! echo "$as_me:$LINENO: result: $ac_cv_func_accept_return, $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *" >&5 ! echo "${ECHO_T}$ac_cv_func_accept_return, $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *" >&6 ! ! cat >>confdefs.h <<_ACEOF ! #define ACCEPT_TYPE_RETURN $ac_cv_func_accept_return ! _ACEOF ! cat >>confdefs.h <<_ACEOF #define ACCEPT_TYPE_ARG1 $ac_cv_func_accept_arg1 Index: configure.in =================================================================== RCS file: /cvsroot/pgsql-server/configure.in,v retrieving revision 1.283 diff -c -c -r1.283 configure.in *** configure.in 1 Sep 2003 23:01:49 -0000 1.283 --- configure.in 7 Sep 2003 01:53:58 -0000 *************** *** 238,243 **** --- 238,249 ---- fi AC_MSG_NOTICE([using CFLAGS=$CFLAGS]) + # We already have this in Makefile.win32, but configure needs it too + if test "$PORTNAME" = "win32" + then + CPPFLAGS="$CPPFLAGS -Isrc/include/port/win32" + fi + # Check if the compiler still works with the template settings AC_MSG_CHECKING([whether the C compiler still works]) AC_TRY_LINK([], [return 0;], Index: config/ac_func_accept_argtypes.m4 =================================================================== RCS file: /cvsroot/pgsql-server/config/ac_func_accept_argtypes.m4,v retrieving revision 1.4 diff -c -c -r1.4 ac_func_accept_argtypes.m4 *** config/ac_func_accept_argtypes.m4 29 Mar 2002 17:32:53 -0000 1.4 --- config/ac_func_accept_argtypes.m4 7 Sep 2003 01:53:58 -0000 *************** *** 7,15 **** dnl @synopsis AC_FUNC_ACCEPT_ARGTYPES dnl dnl Checks the data types of the three arguments to accept(). Results are ! dnl placed into the symbols ACCEPT_TYPE_ARG[123], consistent with the ! dnl following example: dnl dnl #define ACCEPT_TYPE_ARG1 int dnl #define ACCEPT_TYPE_ARG2 struct sockaddr * dnl #define ACCEPT_TYPE_ARG3 socklen_t --- 7,16 ---- dnl @synopsis AC_FUNC_ACCEPT_ARGTYPES dnl dnl Checks the data types of the three arguments to accept(). Results are ! dnl placed into the symbols ACCEPT_TYPE_RETURN and ACCEPT_TYPE_ARG[123], ! dnl consistent with the following example: dnl + dnl #define ACCEPT_TYPE_RETURN int dnl #define ACCEPT_TYPE_ARG1 int dnl #define ACCEPT_TYPE_ARG2 struct sockaddr * dnl #define ACCEPT_TYPE_ARG3 socklen_t *************** *** 36,59 **** # Solaris 7 and 8 have arg3 as 'void *' (disguised as 'Psocklen_t' # which is *not* 'socklen_t *'). If we detect that, then we assume # 'int' as the result, because that ought to work best. AC_DEFUN([AC_FUNC_ACCEPT_ARGTYPES], [AC_MSG_CHECKING([types of arguments for accept()]) ! AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl ! [AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl ! [AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl ! [for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do ! for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do ! for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do ! AC_TRY_COMPILE( [#ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif ! extern int accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);], ! [], [ac_not_found=no; break 3], [ac_not_found=yes]) done done done --- 37,65 ---- # Solaris 7 and 8 have arg3 as 'void *' (disguised as 'Psocklen_t' # which is *not* 'socklen_t *'). If we detect that, then we assume # 'int' as the result, because that ought to work best. + # + # On Win32, accept() returns 'unsigned int PASCAL' AC_DEFUN([AC_FUNC_ACCEPT_ARGTYPES], [AC_MSG_CHECKING([types of arguments for accept()]) ! AC_CACHE_VAL(ac_cv_func_accept_return,dnl ! [AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl ! [AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl ! [AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl ! [for ac_cv_func_accept_return in 'int' 'unsigned int PASCAL'; do ! for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do ! for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do ! for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do ! AC_TRY_COMPILE( [#ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif ! extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);], ! [], [ac_not_found=no; break 4], [ac_not_found=yes]) ! done done done done *************** *** 63,72 **** if test "$ac_cv_func_accept_arg3" = "void"; then ac_cv_func_accept_arg3=int fi ])dnl AC_CACHE_VAL ])dnl AC_CACHE_VAL ])dnl AC_CACHE_VAL ! AC_MSG_RESULT([$ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *]) AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1, $ac_cv_func_accept_arg1, [Define to the type of arg 1 of 'accept']) AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2, $ac_cv_func_accept_arg2, --- 69,81 ---- if test "$ac_cv_func_accept_arg3" = "void"; then ac_cv_func_accept_arg3=int fi + ])dnl AC_CACHE_VAL ])dnl AC_CACHE_VAL ])dnl AC_CACHE_VAL ])dnl AC_CACHE_VAL ! AC_MSG_RESULT([$ac_cv_func_accept_return, $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *]) ! AC_DEFINE_UNQUOTED(ACCEPT_TYPE_RETURN, $ac_cv_func_accept_return, ! [Define to the return type of 'accept']) AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1, $ac_cv_func_accept_arg1, [Define to the type of arg 1 of 'accept']) AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2, $ac_cv_func_accept_arg2, Index: src/bin/pg_id/pg_id.c =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/pg_id/pg_id.c,v retrieving revision 1.23 diff -c -c -r1.23 pg_id.c *** src/bin/pg_id/pg_id.c 6 Sep 2003 01:41:56 -0000 1.23 --- src/bin/pg_id/pg_id.c 7 Sep 2003 01:54:04 -0000 *************** *** 28,37 **** use_real_uid_flag = 0, limit_user_info = 0; const char *username = NULL; ! struct passwd *pw; ! extern int optind; while ((c = getopt(argc, argv, "nru")) != -1) { --- 28,46 ---- use_real_uid_flag = 0, limit_user_info = 0; const char *username = NULL; ! extern int optind; ! #ifndef WIN32 struct passwd *pw; + #else + struct passwd_win32 + { + int pw_uid; + char pw_name[128]; + } pass_win32; + struct passwd_win32 *pw = &pass_win32; ! pw->pw_uid = 1; ! #endif while ((c = getopt(argc, argv, "nru")) != -1) { *************** *** 47,59 **** --- 56,79 ---- limit_user_info = 1; break; default: + #ifndef WIN32 fprintf(stderr, "Usage: %s [-n] [-r] [-u] [username]\n", argv[0]); + #else + fprintf(stderr, "Usage: %s [-n] [-r] [-u]\n", argv[0]); + #endif exit(1); } } if (argc - optind >= 1) + #ifndef WIN32 username = argv[optind]; + #else + { + fprintf(stderr, "%s: specifying a username is not supported on this platform\n", argv[0]); + exit(1); + } + #endif if (name_only_flag && !limit_user_info) { *************** *** 66,72 **** exit(1); } ! if (username) { pw = getpwnam(username); --- 86,92 ---- exit(1); } ! #ifndef WIN32 if (username) { pw = getpwnam(username); *************** *** 86,91 **** --- 106,120 ---- perror(argv[0]); exit(1); } + #else + if (!use_real_uid_flag) + { + fprintf(stderr, "%s: -r must be used on this platform\n", argv[0]); + exit(1); + } + + GetUserName(pw->pw_name, sizeof(pw->pw_name)-1); + #endif if (!limit_user_info) printf("uid=%d(%s)\n", (int) pw->pw_uid, pw->pw_name); Index: src/bin/pg_resetxlog/pg_resetxlog.c =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/pg_resetxlog/pg_resetxlog.c,v retrieving revision 1.12 diff -c -c -r1.12 pg_resetxlog.c *** src/bin/pg_resetxlog/pg_resetxlog.c 4 Aug 2003 02:40:09 -0000 1.12 --- src/bin/pg_resetxlog/pg_resetxlog.c 7 Sep 2003 01:54:04 -0000 *************** *** 41,47 **** #include "catalog/catversion.h" #include "catalog/pg_control.h" - /******************** stuff copied from xlog.c ********************/ /* Increment an xlogid/segment pair */ --- 41,46 ---- *************** *** 80,85 **** --- 79,86 ---- static void KillExistingXLOG(void); static void WriteEmptyXLOG(void); static void usage(void); + + extern char *optarg; Index: src/bin/psql/describe.c =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/psql/describe.c,v retrieving revision 1.84 diff -c -c -r1.84 describe.c *** src/bin/psql/describe.c 9 Aug 2003 01:21:54 -0000 1.84 --- src/bin/psql/describe.c 7 Sep 2003 01:54:05 -0000 *************** *** 765,771 **** { /* Name */ #ifdef WIN32 ! cells[i * cols + 0] = mbvalidate(PQgetvalue(res, i, 0)); #else cells[i * cols + 0] = PQgetvalue(res, i, 0); /* don't free this * afterwards */ --- 765,771 ---- { /* Name */ #ifdef WIN32 ! cells[i * cols + 0] = mbvalidate(PQgetvalue(res, i, 0), myopt.encoding); #else cells[i * cols + 0] = PQgetvalue(res, i, 0); /* don't free this * afterwards */ *************** *** 773,779 **** /* Type */ #ifdef WIN32 ! cells[i * cols + 1] = mbvalidate(PQgetvalue(res, i, 1)); #else cells[i * cols + 1] = PQgetvalue(res, i, 1); /* don't free this * either */ --- 773,779 ---- /* Type */ #ifdef WIN32 ! cells[i * cols + 1] = mbvalidate(PQgetvalue(res, i, 1), myopt.encoding); #else cells[i * cols + 1] = PQgetvalue(res, i, 1); /* don't free this * either */ *************** *** 797,803 **** } #ifdef WIN32 ! cells[i * cols + 2] = xstrdup(mbvalidate(tmpbuf.data)); #else cells[i * cols + 2] = xstrdup(tmpbuf.data); #endif --- 797,803 ---- } #ifdef WIN32 ! cells[i * cols + 2] = xstrdup(mbvalidate(tmpbuf.data, myopt.encoding)); #else cells[i * cols + 2] = xstrdup(tmpbuf.data); #endif *************** *** 806,812 **** /* Description */ if (verbose) #ifdef WIN32 ! cells[i * cols + cols - 1] = mbvalidate(PQgetvalue(res, i, 5)); #else cells[i * cols + cols - 1] = PQgetvalue(res, i, 5); #endif --- 806,812 ---- /* Description */ if (verbose) #ifdef WIN32 ! cells[i * cols + cols - 1] = mbvalidate(PQgetvalue(res, i, 5), myopt.encoding); #else cells[i * cols + cols - 1] = PQgetvalue(res, i, 5); #endif Index: src/bin/psql/mbprint.c =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/psql/mbprint.c,v retrieving revision 1.10 diff -c -c -r1.10 mbprint.c *** src/bin/psql/mbprint.c 5 Sep 2003 02:31:10 -0000 1.10 --- src/bin/psql/mbprint.c 7 Sep 2003 01:54:07 -0000 *************** *** 7,12 **** --- 7,15 ---- */ #include "postgres_fe.h" + #ifndef PGSCRIPTS + #include "settings.h" + #endif #include "mbprint.h" #include "mb/pg_wchar.h" *************** *** 334,340 **** return mb_utf_validate(pwcs); else { ! #ifdef WIN32 /* * translate characters to DOS console encoding, e.g. needed for * German umlauts --- 337,343 ---- return mb_utf_validate(pwcs); else { ! #if defined(WIN32) && !defined(PGSCRIPTS) /* * translate characters to DOS console encoding, e.g. needed for * German umlauts Index: src/bin/scripts/Makefile =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/scripts/Makefile,v retrieving revision 1.22 diff -c -c -r1.22 Makefile *** src/bin/scripts/Makefile 8 Aug 2003 04:52:21 -0000 1.22 --- src/bin/scripts/Makefile 7 Sep 2003 01:54:08 -0000 *************** *** 15,21 **** PROGRAMS = createdb createlang createuser dropdb droplang dropuser clusterdb vacuumdb ! override CPPFLAGS := -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir) $(CPPFLAGS) all: submake-libpq submake-backend $(PROGRAMS) --- 15,21 ---- PROGRAMS = createdb createlang createuser dropdb droplang dropuser clusterdb vacuumdb ! override CPPFLAGS := -DPGSCRIPTS -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir) $(CPPFLAGS) all: submake-libpq submake-backend $(PROGRAMS) Index: src/bin/scripts/common.c =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/scripts/common.c,v retrieving revision 1.4 diff -c -c -r1.4 common.c *** src/bin/scripts/common.c 4 Aug 2003 00:43:29 -0000 1.4 --- src/bin/scripts/common.c 7 Sep 2003 01:54:08 -0000 *************** *** 23,28 **** --- 23,29 ---- const char * get_user_name(const char *progname) { + #ifndef WIN32 struct passwd *pw; pw = getpwuid(getuid()); *************** *** 32,37 **** --- 33,44 ---- exit(1); } return pw->pw_name; + #else + static char username[128]; /* remains after function exit */ + + GetUserName(username, sizeof(username)-1); + return username; + #endif } Index: src/include/pg_config.h.in =================================================================== RCS file: /cvsroot/pgsql-server/src/include/pg_config.h.in,v retrieving revision 1.61 diff -c -c -r1.61 pg_config.h.in *** src/include/pg_config.h.in 16 Aug 2003 15:35:51 -0000 1.61 --- src/include/pg_config.h.in 7 Sep 2003 01:54:08 -0000 *************** *** 9,14 **** --- 9,17 ---- /* Define to the type of arg 3 of 'accept' */ #undef ACCEPT_TYPE_ARG3 + /* Define to the return type of 'accept' */ + #undef ACCEPT_TYPE_RETURN + /* The alignment requirement of a `double'. */ #undef ALIGNOF_DOUBLE Index: src/interfaces/libpq/Makefile =================================================================== RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/Makefile,v retrieving revision 1.92 diff -c -c -r1.92 Makefile *** src/interfaces/libpq/Makefile 23 Aug 2003 04:21:59 -0000 1.92 --- src/interfaces/libpq/Makefile 7 Sep 2003 01:54:09 -0000 *************** *** 24,29 **** --- 24,32 ---- fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \ dllist.o md5.o ip.o wchar.o encnames.o \ $(filter crypt.o getaddrinfo.o inet_aton.o snprintf.o strerror.o path.o thread.o, $(LIBOBJS)) + ifeq ($(PORTNAME), win32) + OBJS+=win32.o + endif # Add libraries that libpq depends (or might depend) on into the