mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Changes for MinGW/WIN32:
o allow configure to see include/port/win32 include files o add matching Win32 accept() prototype o allow pg_id to compile with native Win32 API o fix invalide mbvalidate() function calls (existing bug) o allow /scripts to compile with native Win32 API o add win32.c to Win32 compiles (already in *.mak files)
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.23 2003/09/06 01:41:56 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.24 2003/09/07 03:43:53 momjian Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
|
||||
@ -28,10 +28,19 @@ main(int argc, char *argv[])
|
||||
use_real_uid_flag = 0,
|
||||
limit_user_info = 0;
|
||||
const char *username = NULL;
|
||||
|
||||
struct passwd *pw;
|
||||
|
||||
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,13 +56,24 @@ main(int argc, char *argv[])
|
||||
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,7 +86,7 @@ main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
if (username)
|
||||
{
|
||||
pw = getpwnam(username);
|
||||
@ -86,6 +106,15 @@ main(int argc, char *argv[])
|
||||
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);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.12 2003/08/04 02:40:09 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.13 2003/09/07 03:43:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -41,7 +41,6 @@
|
||||
#include "catalog/catversion.h"
|
||||
#include "catalog/pg_control.h"
|
||||
|
||||
|
||||
/******************** stuff copied from xlog.c ********************/
|
||||
|
||||
/* Increment an xlogid/segment pair */
|
||||
@ -81,6 +80,8 @@ static void KillExistingXLOG(void);
|
||||
static void WriteEmptyXLOG(void);
|
||||
static void usage(void);
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
|
||||
|
||||
int
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.84 2003/08/09 01:21:54 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.85 2003/09/07 03:43:53 momjian Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
#include "describe.h"
|
||||
@ -765,7 +765,7 @@ describeOneTableDetails(const char *schemaname,
|
||||
{
|
||||
/* Name */
|
||||
#ifdef WIN32
|
||||
cells[i * cols + 0] = mbvalidate(PQgetvalue(res, i, 0));
|
||||
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,7 +773,7 @@ describeOneTableDetails(const char *schemaname,
|
||||
|
||||
/* Type */
|
||||
#ifdef WIN32
|
||||
cells[i * cols + 1] = mbvalidate(PQgetvalue(res, i, 1));
|
||||
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,7 +797,7 @@ describeOneTableDetails(const char *schemaname,
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
cells[i * cols + 2] = xstrdup(mbvalidate(tmpbuf.data));
|
||||
cells[i * cols + 2] = xstrdup(mbvalidate(tmpbuf.data, myopt.encoding));
|
||||
#else
|
||||
cells[i * cols + 2] = xstrdup(tmpbuf.data);
|
||||
#endif
|
||||
@ -806,7 +806,7 @@ describeOneTableDetails(const char *schemaname,
|
||||
/* Description */
|
||||
if (verbose)
|
||||
#ifdef WIN32
|
||||
cells[i * cols + cols - 1] = mbvalidate(PQgetvalue(res, i, 5));
|
||||
cells[i * cols + cols - 1] = mbvalidate(PQgetvalue(res, i, 5), myopt.encoding);
|
||||
#else
|
||||
cells[i * cols + cols - 1] = PQgetvalue(res, i, 5);
|
||||
#endif
|
||||
|
@ -3,10 +3,13 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/mbprint.c,v 1.10 2003/09/05 02:31:10 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/mbprint.c,v 1.11 2003/09/07 03:43:54 momjian Exp $
|
||||
*/
|
||||
|
||||
#include "postgres_fe.h"
|
||||
#ifndef PGSCRIPTS
|
||||
#include "settings.h"
|
||||
#endif
|
||||
#include "mbprint.h"
|
||||
|
||||
#include "mb/pg_wchar.h"
|
||||
@ -334,7 +337,7 @@ mbvalidate(unsigned char *pwcs, int encoding)
|
||||
return mb_utf_validate(pwcs);
|
||||
else
|
||||
{
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && !defined(PGSCRIPTS)
|
||||
/*
|
||||
* translate characters to DOS console encoding, e.g. needed for
|
||||
* German umlauts
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
# Portions Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/bin/scripts/Makefile,v 1.22 2003/08/08 04:52:21 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/scripts/Makefile,v 1.23 2003/09/07 03:43:55 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -15,7 +15,7 @@ include $(top_builddir)/src/Makefile.global
|
||||
|
||||
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)
|
||||
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)
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/scripts/common.c,v 1.4 2003/08/04 00:43:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/scripts/common.c,v 1.5 2003/09/07 03:43:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -23,6 +23,7 @@
|
||||
const char *
|
||||
get_user_name(const char *progname)
|
||||
{
|
||||
#ifndef WIN32
|
||||
struct passwd *pw;
|
||||
|
||||
pw = getpwuid(getuid());
|
||||
@ -32,6 +33,12 @@ get_user_name(const char *progname)
|
||||
exit(1);
|
||||
}
|
||||
return pw->pw_name;
|
||||
#else
|
||||
static char username[128]; /* remains after function exit */
|
||||
|
||||
GetUserName(username, sizeof(username)-1);
|
||||
return username;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,6 +9,9 @@
|
||||
/* 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
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.92 2003/08/23 04:21:59 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.93 2003/09/07 03:43:57 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -24,6 +24,9 @@ OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
|
||||
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
|
||||
|
Reference in New Issue
Block a user