Commit a0bf2503 authored by Bruce Momjian's avatar Bruce Momjian

The attached patch fixes a number of issues related to compiling the

client
utilities (libpq.dll and psql.exe) for win32 (missing defines,
adjustments to
includes, pedantic casting, non-existent functions) per:
   http://developer.postgresql.org/docs/postgres/install-win32.html.

It compiles cleanly under Windows 2000 using Visual Studio .net. Also
compiles clean and passes all regression tests (regular and contrib)
under Linux.

In addition to a review by the usual suspects, it would be very
desirable for  someone well versed in the peculiarities of win32 to take
a look.

Joe Conway
parent d4eae725
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/md5.c,v 1.18 2002/09/04 20:31:19 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/md5.c,v 1.19 2002/10/03 17:09:41 momjian Exp $
*/ */
...@@ -26,10 +26,19 @@ ...@@ -26,10 +26,19 @@
* can be compiled stand-alone. * can be compiled stand-alone.
*/ */
#ifndef MD5_ODBC #if ! defined(MD5_ODBC) && ! defined(FRONTEND)
#include "postgres.h" #include "postgres.h"
#include "libpq/crypt.h" #include "libpq/crypt.h"
#else #endif
#ifdef FRONTEND
#include "postgres_fe.h"
#ifndef WIN32
#include "libpq/crypt.h"
#endif /* WIN32 */
#endif /* FRONTEND */
#ifdef MD5_ODBC
#include "md5.h" #include "md5.h"
#endif #endif
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000-2002 by PostgreSQL Global Development Group * Copyright 2000-2002 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.81 2002/09/22 20:57:21 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.82 2002/10/03 17:09:41 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "command.h" #include "command.h"
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <win32.h> #include <win32.h>
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <direct.h>
#endif #endif
#include "libpq-fe.h" #include "libpq-fe.h"
...@@ -1163,7 +1164,7 @@ scan_option(char **string, enum option_type type, char *quote, bool semicolon) ...@@ -1163,7 +1164,7 @@ scan_option(char **string, enum option_type type, char *quote, bool semicolon)
return NULL; return NULL;
} }
if (i < token_len - 1) if (i < (int) token_len - 1)
return_val[i + 1] = '\0'; return_val[i + 1] = '\0';
} }
...@@ -1240,7 +1241,7 @@ unescape(const unsigned char *source, size_t len) ...@@ -1240,7 +1241,7 @@ unescape(const unsigned char *source, size_t len)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
for (p = source; p - source < len && *p; p += PQmblen(p, pset.encoding)) for (p = source; p - source < (int) len && *p; p += PQmblen(p, pset.encoding))
{ {
if (esc) if (esc)
{ {
...@@ -1278,7 +1279,7 @@ unescape(const unsigned char *source, size_t len) ...@@ -1278,7 +1279,7 @@ unescape(const unsigned char *source, size_t len)
char *end; char *end;
l = strtol(p, &end, 0); l = strtol(p, &end, 0);
c = l; c = (char) l;
p = end - 1; p = end - 1;
break; break;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.45 2002/09/14 19:46:01 tgl Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.46 2002/10/03 17:09:41 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -11,17 +11,18 @@ ...@@ -11,17 +11,18 @@
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <sys/time.h>
#ifndef HAVE_STRDUP #ifndef HAVE_STRDUP
#include <strdup.h> #include <strdup.h>
#endif #endif
#include <signal.h> #include <signal.h>
#ifndef WIN32 #ifndef WIN32
#include <sys/time.h>
#include <unistd.h> /* for write() */ #include <unistd.h> /* for write() */
#include <setjmp.h> #include <setjmp.h>
#else #else
#include <io.h> /* for _write() */ #include <io.h> /* for _write() */
#include <win32.h> #include <win32.h>
#include <sys/timeb.h> /* for _ftime() */
#endif #endif
#include "libpq-fe.h" #include "libpq-fe.h"
...@@ -295,9 +296,13 @@ SendQuery(const char *query) ...@@ -295,9 +296,13 @@ SendQuery(const char *query)
bool success = false; bool success = false;
PGresult *results; PGresult *results;
PGnotify *notify; PGnotify *notify;
#ifndef WIN32
struct timeval before, struct timeval before,
after; after;
struct timezone tz; #else
struct _timeb before,
after;
#endif
if (!pset.db) if (!pset.db)
{ {
...@@ -327,11 +332,21 @@ SendQuery(const char *query) ...@@ -327,11 +332,21 @@ SendQuery(const char *query)
} }
cancelConn = pset.db; cancelConn = pset.db;
#ifndef WIN32
if (pset.timing)
gettimeofday(&before, NULL);
results = PQexec(pset.db, query);
if (pset.timing)
gettimeofday(&after, NULL);
#else
if (pset.timing) if (pset.timing)
gettimeofday(&before, &tz); _ftime(&before);
results = PQexec(pset.db, query); results = PQexec(pset.db, query);
if (pset.timing) if (pset.timing)
gettimeofday(&after, &tz); _ftime(&after);
#endif
if (PQresultStatus(results) == PGRES_COPY_IN) if (PQresultStatus(results) == PGRES_COPY_IN)
copy_in_state = true; copy_in_state = true;
/* keep cancel connection for copy out state */ /* keep cancel connection for copy out state */
...@@ -463,8 +478,13 @@ SendQuery(const char *query) ...@@ -463,8 +478,13 @@ SendQuery(const char *query)
/* Possible microtiming output */ /* Possible microtiming output */
if (pset.timing && success) if (pset.timing && success)
#ifndef WIN32
printf(gettext("Time: %.2f ms\n"), printf(gettext("Time: %.2f ms\n"),
((after.tv_sec - before.tv_sec) * 1000000.0 + after.tv_usec - before.tv_usec) / 1000.0); ((after.tv_sec - before.tv_sec) * 1000000.0 + after.tv_usec - before.tv_usec) / 1000.0);
#else
printf(gettext("Time: %.2f ms\n"),
((after.time - before.time) * 1000.0 + after.millitm - before.millitm));
#endif
return success; return success;
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.25 2002/09/22 20:57:21 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.26 2002/10/03 17:09:41 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "copy.h" #include "copy.h"
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#ifdef WIN32 #ifdef WIN32
#define strcasecmp(x,y) stricmp(x,y) #define strcasecmp(x,y) stricmp(x,y)
#define __S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
#define S_ISDIR(mode) __S_ISTYPE((mode), S_IFDIR)
#endif #endif
bool copy_in_state; bool copy_in_state;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000-2002 by PostgreSQL Global Development Group * Copyright 2000-2002 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.21 2002/09/04 20:31:36 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.22 2002/10/03 17:09:41 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "large_obj.h" #include "large_obj.h"
...@@ -196,7 +196,7 @@ do_lo_import(const char *filename_arg, const char *comment_arg) ...@@ -196,7 +196,7 @@ do_lo_import(const char *filename_arg, const char *comment_arg)
{ {
char *cmdbuf; char *cmdbuf;
char *bufptr; char *bufptr;
int slen = strlen(comment_arg); size_t slen = strlen(comment_arg);
cmdbuf = malloc(slen * 2 + 256); cmdbuf = malloc(slen * 2 + 256);
if (!cmdbuf) if (!cmdbuf)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/mbprint.c,v 1.4 2002/08/27 20:16:48 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/mbprint.c,v 1.5 2002/10/03 17:09:42 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -202,7 +202,7 @@ mb_utf_wcswidth(unsigned char *pwcs, size_t len) ...@@ -202,7 +202,7 @@ mb_utf_wcswidth(unsigned char *pwcs, size_t len)
for (; *pwcs && len > 0; pwcs += l) for (; *pwcs && len > 0; pwcs += l)
{ {
l = pg_utf_mblen(pwcs); l = pg_utf_mblen(pwcs);
if ((len < l) || ((w = ucs_wcwidth(utf2ucs(pwcs))) < 0)) if ((len < (size_t) l) || ((w = ucs_wcwidth(utf2ucs(pwcs))) < 0))
return width; return width;
len -= l; len -= l;
width += w; width += w;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.31 2002/09/01 23:30:46 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/print.c,v 1.32 2002/10/03 17:09:42 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "print.h" #include "print.h"
...@@ -282,7 +282,7 @@ print_aligned_text(const char *title, const char *const * headers, ...@@ -282,7 +282,7 @@ print_aligned_text(const char *title, const char *const * headers,
{ {
int tlen; int tlen;
if ((tlen = pg_wcswidth((unsigned char *) title, strlen(title))) >= total_w) if ((unsigned int) (tlen = pg_wcswidth((unsigned char *) title, strlen(title))) >= total_w)
fprintf(fout, "%s\n", title); fprintf(fout, "%s\n", title);
else else
fprintf(fout, "%-*s%s\n", (int) (total_w - tlen) / 2, "", title); fprintf(fout, "%-*s%s\n", (int) (total_w - tlen) / 2, "", title);
...@@ -1184,8 +1184,8 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout) ...@@ -1184,8 +1184,8 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout)
footers ? (const char *const *) footers : (const char *const *) (opt->footers), footers ? (const char *const *) footers : (const char *const *) (opt->footers),
align, &opt->topt, fout); align, &opt->topt, fout);
free(headers); free((void *) headers);
free(cells); free((void *) cells);
if (footers) if (footers)
{ {
free(footers[0]); free(footers[0]);
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#define MAXPGPATH 1024 #define MAXPGPATH 1024
#define INDEX_MAX_KEYS 32
#define HAVE_ATEXIT #define HAVE_ATEXIT
#define HAVE_MEMMOVE #define HAVE_MEMMOVE
...@@ -50,4 +52,8 @@ ...@@ -50,4 +52,8 @@
#endif #endif
#ifndef __CYGWIN__
#include <windows.h>
#endif
#endif /* pg_config_h_win32__ */ #endif /* pg_config_h_win32__ */
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.205 2002/09/22 20:57:21 petere Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.206 2002/10/03 17:09:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#include "libpq-fe.h" #include "libpq-fe.h"
#include "libpq-int.h" #include "libpq-int.h"
...@@ -1053,10 +1052,10 @@ connectDBComplete(PGconn *conn) ...@@ -1053,10 +1052,10 @@ connectDBComplete(PGconn *conn)
{ {
PostgresPollingStatusType flag = PGRES_POLLING_WRITING; PostgresPollingStatusType flag = PGRES_POLLING_WRITING;
struct timeval remains, time_t finish_time = 0,
*rp = NULL, current_time;
finish_time, struct timeval remains,
start_time; *rp = NULL;
if (conn == NULL || conn->status == CONNECTION_BAD) if (conn == NULL || conn->status == CONNECTION_BAD)
return 0; return 0;
...@@ -1074,19 +1073,13 @@ connectDBComplete(PGconn *conn) ...@@ -1074,19 +1073,13 @@ connectDBComplete(PGconn *conn)
} }
remains.tv_usec = 0; remains.tv_usec = 0;
rp = &remains; rp = &remains;
/* calculate the finish time based on start + timeout */
finish_time = time((time_t *) NULL) + remains.tv_sec;
} }
while (rp == NULL || remains.tv_sec > 0 || remains.tv_usec > 0) while (rp == NULL || remains.tv_sec > 0 || remains.tv_usec > 0)
{ {
/*
* If connecting timeout is set, get current time.
*/
if (rp != NULL && gettimeofday(&start_time, NULL) == -1)
{
conn->status = CONNECTION_BAD;
return 0;
}
/* /*
* Wait, if necessary. Note that the initial state (just after * Wait, if necessary. Note that the initial state (just after
* PQconnectStart) is to wait for the socket to select for * PQconnectStart) is to wait for the socket to select for
...@@ -1128,26 +1121,18 @@ connectDBComplete(PGconn *conn) ...@@ -1128,26 +1121,18 @@ connectDBComplete(PGconn *conn)
flag = PQconnectPoll(conn); flag = PQconnectPoll(conn);
/* /*
* If connecting timeout is set, calculate remain time. * If connecting timeout is set, calculate remaining time.
*/ */
if (rp != NULL) if (rp != NULL)
{ {
if (gettimeofday(&finish_time, NULL) == -1) if (time(&current_time) == -1)
{ {
conn->status = CONNECTION_BAD; conn->status = CONNECTION_BAD;
return 0; return 0;
} }
if ((finish_time.tv_usec -= start_time.tv_usec) < 0)
{ remains.tv_sec = finish_time - current_time;
remains.tv_sec++; remains.tv_usec = 0;
finish_time.tv_usec += 1000000;
}
if ((remains.tv_usec -= finish_time.tv_usec) < 0)
{
remains.tv_sec--;
remains.tv_usec += 1000000;
}
remains.tv_sec -= finish_time.tv_sec - start_time.tv_sec;
} }
} }
conn->status = CONNECTION_BAD; conn->status = CONNECTION_BAD;
...@@ -2946,6 +2931,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username) ...@@ -2946,6 +2931,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
return NULL; return NULL;
} }
#ifndef WIN32
/* If password file is insecure, alert the user and ignore it. */ /* If password file is insecure, alert the user and ignore it. */
if (stat_buf.st_mode & (S_IRWXG | S_IRWXO)) if (stat_buf.st_mode & (S_IRWXG | S_IRWXO))
{ {
...@@ -2955,6 +2941,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username) ...@@ -2955,6 +2941,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
free(pgpassfile); free(pgpassfile);
return NULL; return NULL;
} }
#endif
fp = fopen(pgpassfile, "r"); fp = fopen(pgpassfile, "r");
free(pgpassfile); free(pgpassfile);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.79 2002/09/04 20:31:47 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.80 2002/10/03 17:09:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -150,9 +150,9 @@ pqPutBytes(const char *s, size_t nbytes, PGconn *conn) ...@@ -150,9 +150,9 @@ pqPutBytes(const char *s, size_t nbytes, PGconn *conn)
* try to grow the buffer. FIXME: The new size could be * try to grow the buffer. FIXME: The new size could be
* chosen more intelligently. * chosen more intelligently.
*/ */
size_t buflen = conn->outCount + nbytes; size_t buflen = (size_t) conn->outCount + nbytes;
if (buflen > conn->outBufSize) if (buflen > (size_t) conn->outBufSize)
{ {
char *newbuf = realloc(conn->outBuffer, buflen); char *newbuf = realloc(conn->outBuffer, buflen);
...@@ -240,7 +240,7 @@ pqPuts(const char *s, PGconn *conn) ...@@ -240,7 +240,7 @@ pqPuts(const char *s, PGconn *conn)
int int
pqGetnchar(char *s, size_t len, PGconn *conn) pqGetnchar(char *s, size_t len, PGconn *conn)
{ {
if (len < 0 || len > conn->inEnd - conn->inCursor) if (len < 0 || len > (size_t) (conn->inEnd - conn->inCursor))
return EOF; return EOF;
memcpy(s, conn->inBuffer + conn->inCursor, len); memcpy(s, conn->inBuffer + conn->inCursor, len);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* didn't really belong there. * didn't really belong there.
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.46 2002/08/29 07:22:30 ishii Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.47 2002/10/03 17:09:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -299,7 +299,7 @@ PQprint(FILE *fout, ...@@ -299,7 +299,7 @@ PQprint(FILE *fout,
(PQntuples(res) == 1) ? "" : "s"); (PQntuples(res) == 1) ? "" : "s");
free(fieldMax); free(fieldMax);
free(fieldNotNum); free(fieldNotNum);
free(fieldNames); free((void *) fieldNames);
if (usePipe) if (usePipe)
{ {
#ifdef WIN32 #ifdef WIN32
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: libpq-int.h,v 1.57 2002/09/04 20:31:47 momjian Exp $ * $Id: libpq-int.h,v 1.58 2002/10/03 17:09:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -21,8 +21,10 @@ ...@@ -21,8 +21,10 @@
#define LIBPQ_INT_H #define LIBPQ_INT_H
#include <time.h> #include <time.h>
#include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#ifndef WIN32
#include <sys/time.h>
#endif
#if defined(WIN32) && (!defined(ssize_t)) #if defined(WIN32) && (!defined(ssize_t))
typedef int ssize_t; /* ssize_t doesn't exist in VC (atleast typedef int ssize_t; /* ssize_t doesn't exist in VC (atleast
......
LIBRARY LIBPQ LIBRARY LIBPQ
DESCRIPTION "Postgres Client Access Library"
EXPORTS EXPORTS
PQconnectdb @ 1 PQconnectdb @ 1
PQsetdbLogin @ 2 PQsetdbLogin @ 2
...@@ -90,3 +89,7 @@ EXPORTS ...@@ -90,3 +89,7 @@ EXPORTS
PQfreeNotify @ 87 PQfreeNotify @ 87
PQescapeString @ 88 PQescapeString @ 88
PQescapeBytea @ 89 PQescapeBytea @ 89
printfPQExpBuffer @ 90
appendPQExpBuffer @ 91
pg_encoding_to_char @ 92
pg_utf_mblen @ 93
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/interfaces/libpq/pqexpbuffer.c,v 1.13 2002/06/20 20:29:54 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/pqexpbuffer.c,v 1.14 2002/10/03 17:09:42 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -192,7 +192,7 @@ printfPQExpBuffer(PQExpBuffer str, const char *fmt,...) ...@@ -192,7 +192,7 @@ printfPQExpBuffer(PQExpBuffer str, const char *fmt,...)
* actually stored, but at least one returns -1 on failure. Be * actually stored, but at least one returns -1 on failure. Be
* conservative about believing whether the print worked. * conservative about believing whether the print worked.
*/ */
if (nprinted >= 0 && nprinted < avail - 1) if (nprinted >= 0 && nprinted < (int) avail - 1)
{ {
/* Success. Note nprinted does not include trailing null. */ /* Success. Note nprinted does not include trailing null. */
str->len += nprinted; str->len += nprinted;
...@@ -240,7 +240,7 @@ appendPQExpBuffer(PQExpBuffer str, const char *fmt,...) ...@@ -240,7 +240,7 @@ appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
* actually stored, but at least one returns -1 on failure. Be * actually stored, but at least one returns -1 on failure. Be
* conservative about believing whether the print worked. * conservative about believing whether the print worked.
*/ */
if (nprinted >= 0 && nprinted < avail - 1) if (nprinted >= 0 && nprinted < (int) avail - 1)
{ {
/* Success. Note nprinted does not include trailing null. */ /* Success. Note nprinted does not include trailing null. */
str->len += nprinted; str->len += nprinted;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
/* /*
* crypt not available (yet) * crypt not available (yet)
*/ */
#define crypt(a,b) (a) #define crypt(a,b) ((char *) a)
#undef EAGAIN /* doesn't apply on sockets */ #undef EAGAIN /* doesn't apply on sockets */
#undef EINTR #undef EINTR
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Makefile for utils # Makefile for utils
# #
# $Header: /cvsroot/pgsql/src/utils/Attic/Makefile,v 1.14 2002/07/27 20:10:05 petere Exp $ # $Header: /cvsroot/pgsql/src/utils/Attic/Makefile,v 1.15 2002/10/03 17:09:42 momjian Exp $
# #
# dllinit.o is only built on Win32 platform. # dllinit.o is only built on Win32 platform.
# #
...@@ -15,4 +15,4 @@ include $(top_builddir)/src/Makefile.global ...@@ -15,4 +15,4 @@ include $(top_builddir)/src/Makefile.global
all: all:
clean distclean maintainer-clean: clean distclean maintainer-clean:
rm -f dllinit.o rm -f dllinit.o getopt.o
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment