1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-03 09:13:20 +03:00

Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.

This commit is contained in:
Bruce Momjian
1997-09-08 02:41:22 +00:00
parent a90f12fd9d
commit 319dbfa736
632 changed files with 28301 additions and 28220 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.15 1997/09/07 04:42:09 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.16 1997/09/08 02:23:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,7 +72,7 @@
#include <libpq/hba.h>
#include <libpq/password.h>
static int be_getauthsvc(MsgType msgtype);
static int be_getauthsvc(MsgType msgtype);
/*----------------------------------------------------------------
* common definitions for generic fe/be routines
@@ -81,9 +81,9 @@ static int be_getauthsvc(MsgType msgtype);
struct authsvc
{
char name[16]; /* service nickname (for command line) */
MsgType msgtype; /* startup packet header type */
int allowed; /* initially allowed (before command line
char name[16]; /* service nickname (for command line) */
MsgType msgtype; /* startup packet header type */
int allowed; /* initially allowed (before command line
* option parsing)? */
};
@@ -99,10 +99,10 @@ struct authsvc
*/
#if defined(HBA)
static int useHostBasedAuth = 1;
static int useHostBasedAuth = 1;
#else
static int useHostBasedAuth = 0;
static int useHostBasedAuth = 0;
#endif
@@ -125,7 +125,7 @@ static struct authsvc authsvcs[] = {
{"password", STARTUP_PASSWORD_MSG, 1}
};
static n_authsvcs = sizeof(authsvcs) / sizeof(struct authsvc);
static n_authsvcs = sizeof(authsvcs) / sizeof(struct authsvc);
#ifdef KRB4
/* This has to be ifdef'd out because krb.h does exist. This needs
@@ -157,13 +157,13 @@ pg_krb4_recvauth(int sock,
struct sockaddr_in * raddr,
char *username)
{
long krbopts = 0;/* one-way authentication */
KTEXT_ST clttkt;
char instance[INST_SZ];
AUTH_DAT auth_data;
Key_schedule key_sched;
char version[KRB_SENDAUTH_VLEN];
int status;
long krbopts = 0; /* one-way authentication */
KTEXT_ST clttkt;
char instance[INST_SZ];
AUTH_DAT auth_data;
Key_schedule key_sched;
char version[KRB_SENDAUTH_VLEN];
int status;
strcpy(instance, "*"); /* don't care, but arg gets expanded
* anyway */
@@ -255,10 +255,10 @@ pg_krb4_recvauth(int sock,
* krb5_an_to_ln, except that it punts if multiple components are found,
* and we can't afford to punt.
*/
static char *
static char *
pg_an_to_ln(char *aname)
{
char *p;
char *p;
if ((p = strchr(aname, '/')) || (p = strchr(aname, '@')))
*p = '\0';
@@ -297,16 +297,16 @@ pg_krb5_recvauth(int sock,
struct sockaddr_in * raddr,
char *username)
{
char servbuf[MAXHOSTNAMELEN + 1 +
sizeof(PG_KRB_SRVNAM)];
char *hostp,
*kusername = (char *) NULL;
char servbuf[MAXHOSTNAMELEN + 1 +
sizeof(PG_KRB_SRVNAM)];
char *hostp,
*kusername = (char *) NULL;
krb5_error_code code;
krb5_principal client,
server;
krb5_address sender_addr;
krb5_principal client,
server;
krb5_address sender_addr;
krb5_rdreq_key_proc keyproc = (krb5_rdreq_key_proc) NULL;
krb5_pointer keyprocarg = (krb5_pointer) NULL;
krb5_pointer keyprocarg = (krb5_pointer) NULL;
/*
* Set up server side -- since we have no ticket file to make this
@@ -426,9 +426,9 @@ pg_krb5_recvauth(int sock,
static int
pg_password_recvauth(Port * port, char *database, char *DataDir)
{
PacketBuf buf;
char *user,
*password;
PacketBuf buf;
char *user,
*password;
if (PacketReceive(port, &buf, BLOCKING) != STATUS_OK)
{
@@ -451,7 +451,7 @@ pg_password_recvauth(Port * port, char *database, char *DataDir)
int
be_recvauth(MsgType msgtype_arg, Port * port, char *username, StartupInfo * sp)
{
MsgType msgtype;
MsgType msgtype;
/*
* A message type of STARTUP_MSG (which once upon a time was the only
@@ -489,93 +489,93 @@ be_recvauth(MsgType msgtype_arg, Port * port, char *username, StartupInfo * sp)
switch (msgtype)
{
case STARTUP_KRB4_MSG:
if (!be_getauthsvc(msgtype))
{
sprintf(PQerrormsg,
"be_recvauth: krb4 authentication disallowed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
if (pg_krb4_recvauth(port->sock, &port->laddr, &port->raddr,
username) != STATUS_OK)
{
sprintf(PQerrormsg,
"be_recvauth: krb4 authentication failed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
break;
case STARTUP_KRB5_MSG:
if (!be_getauthsvc(msgtype))
{
sprintf(PQerrormsg,
"be_recvauth: krb5 authentication disallowed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
if (pg_krb5_recvauth(port->sock, &port->laddr, &port->raddr,
username) != STATUS_OK)
{
sprintf(PQerrormsg,
"be_recvauth: krb5 authentication failed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
break;
case STARTUP_UNAUTH_MSG:
if (!be_getauthsvc(msgtype))
{
sprintf(PQerrormsg,
"be_recvauth: "
"unauthenticated connections disallowed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
break;
case STARTUP_HBA_MSG:
if (hba_recvauth(port, sp->database, sp->user, DataDir) != STATUS_OK)
{
sprintf(PQerrormsg,
"be_recvauth: host-based authentication failed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
break;
case STARTUP_PASSWORD_MSG:
if (!be_getauthsvc(msgtype))
{
sprintf(PQerrormsg,
"be_recvauth: "
"plaintext password authentication disallowed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
if (pg_password_recvauth(port, sp->database, DataDir) != STATUS_OK)
{
case STARTUP_KRB4_MSG:
if (!be_getauthsvc(msgtype))
{
sprintf(PQerrormsg,
"be_recvauth: krb4 authentication disallowed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
if (pg_krb4_recvauth(port->sock, &port->laddr, &port->raddr,
username) != STATUS_OK)
{
sprintf(PQerrormsg,
"be_recvauth: krb4 authentication failed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
break;
case STARTUP_KRB5_MSG:
if (!be_getauthsvc(msgtype))
{
sprintf(PQerrormsg,
"be_recvauth: krb5 authentication disallowed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
if (pg_krb5_recvauth(port->sock, &port->laddr, &port->raddr,
username) != STATUS_OK)
{
sprintf(PQerrormsg,
"be_recvauth: krb5 authentication failed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
break;
case STARTUP_UNAUTH_MSG:
if (!be_getauthsvc(msgtype))
{
sprintf(PQerrormsg,
"be_recvauth: "
"unauthenticated connections disallowed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
break;
case STARTUP_HBA_MSG:
if (hba_recvauth(port, sp->database, sp->user, DataDir) != STATUS_OK)
{
sprintf(PQerrormsg,
"be_recvauth: host-based authentication failed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
break;
case STARTUP_PASSWORD_MSG:
if (!be_getauthsvc(msgtype))
{
sprintf(PQerrormsg,
"be_recvauth: "
"plaintext password authentication disallowed\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
if (pg_password_recvauth(port, sp->database, DataDir) != STATUS_OK)
{
/*
* pg_password_recvauth or lower-level routines have already
* set
*/
/* the error message */
/*
* pg_password_recvauth or lower-level routines have
* already set
*/
/* the error message */
return (STATUS_ERROR);
}
break;
default:
sprintf(PQerrormsg,
"be_recvauth: unrecognized message type: %d\n",
msgtype);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
break;
default:
sprintf(PQerrormsg,
"be_recvauth: unrecognized message type: %d\n",
msgtype);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
}
return (STATUS_OK);
}
@@ -596,9 +596,9 @@ be_recvauth(MsgType msgtype_arg, Port * port, char *username, StartupInfo * sp)
void
be_setauthsvc(char *name)
{
int i,
j;
int turnon = 1;
int i,
j;
int turnon = 1;
if (!name)
return;
@@ -631,7 +631,7 @@ be_setauthsvc(char *name)
static int
be_getauthsvc(MsgType msgtype)
{
int i;
int i;
for (i = 0; i < n_authsvcs; ++i)
if (msgtype == authsvcs[i].msgtype)

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.6 1997/09/07 04:42:12 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.7 1997/09/08 02:23:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,7 +51,7 @@
* backend portal stack for recursive PQexec calls
* ----------------
*/
static Dllist *be_portalstack;
static Dllist *be_portalstack;
/* ----------------
* be_portalinit - initialize backend portal administration
@@ -84,11 +84,11 @@ be_portalpush(PortalEntry * entry)
* used by PQexec()
* ----------------
*/
PortalEntry *
PortalEntry *
be_portalpop(void)
{
PortalEntry *p;
Dlelem *elt;
PortalEntry *p;
Dlelem *elt;
elt = DLRemTail(be_portalstack);
@@ -105,10 +105,10 @@ be_portalpop(void)
* used by be_printtup()
* ----------------
*/
PortalEntry *
PortalEntry *
be_currentportal(void)
{
Dlelem *elt;
Dlelem *elt;
elt = DLGetTail(be_portalstack);
return (elt ? (PortalEntry *) DLE_VAL(elt) : NULL);
@@ -126,14 +126,14 @@ be_currentportal(void)
* ----------------
*/
static Oid be_portaloid;
static u_int be_portalcnt = 0;
static Oid be_portaloid;
static u_int be_portalcnt = 0;
PortalEntry *
PortalEntry *
be_newportal(void)
{
PortalEntry *entry;
char buf[PortalNameLength];
PortalEntry *entry;
char buf[PortalNameLength];
/* ----------------
* generate a new name
@@ -170,9 +170,9 @@ be_typeinit(PortalEntry * entry,
TupleDesc tupDesc,
int natts)
{
PortalBuffer *portal;
GroupBuffer *group;
int i;
PortalBuffer *portal;
GroupBuffer *group;
int i;
AttributeTupleForm *attrs = tupDesc->attrs;
/* ----------------
@@ -212,19 +212,19 @@ be_typeinit(PortalEntry * entry,
void
be_printtup(HeapTuple tuple, TupleDesc typeinfo)
{
int i;
char *attr;
bool isnull;
Oid typoutput;
int i;
char *attr;
bool isnull;
Oid typoutput;
PortalEntry *entry = NULL;
PortalBuffer *portal = NULL;
GroupBuffer *group = NULL;
TupleBlock *tuples = NULL;
char **values;
int *lengths;
PortalEntry *entry = NULL;
PortalBuffer *portal = NULL;
GroupBuffer *group = NULL;
TupleBlock *tuples = NULL;
char **values;
int *lengths;
MemoryContext savecxt;
MemoryContext savecxt;
/* ----------------
* get the current portal and group

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.13 1997/09/07 04:42:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.14 1997/09/08 02:23:10 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
@@ -49,8 +49,8 @@ static LargeObjectDesc *cookies[MAX_LOBJ_FDS];
static GlobalMemory fscxt = NULL;
static int newLOfd(LargeObjectDesc * lobjCookie);
static void deleteLOfd(int fd);
static int newLOfd(LargeObjectDesc * lobjCookie);
static void deleteLOfd(int fd);
/*****************************************************************************
@@ -61,8 +61,8 @@ int
lo_open(Oid lobjId, int mode)
{
LargeObjectDesc *lobjDesc;
int fd;
MemoryContext currentContext;
int fd;
MemoryContext currentContext;
#if FSDB
elog(NOTICE, "LOopen(%d,%d)", lobjId, mode);
@@ -96,7 +96,7 @@ lo_open(Oid lobjId, int mode)
int
lo_close(int fd)
{
MemoryContext currentContext;
MemoryContext currentContext;
if (fd >= MAX_LOBJ_FDS)
{
@@ -145,8 +145,8 @@ lo_write(int fd, char *buf, int len)
int
lo_lseek(int fd, int offset, int whence)
{
MemoryContext currentContext;
int ret;
MemoryContext currentContext;
int ret;
if (fd >= MAX_LOBJ_FDS)
{
@@ -167,8 +167,8 @@ Oid
lo_creat(int mode)
{
LargeObjectDesc *lobjDesc;
MemoryContext currentContext;
Oid lobjId;
MemoryContext currentContext;
Oid lobjId;
if (fscxt == NULL)
{
@@ -225,7 +225,7 @@ struct varlena *
loread(int fd, int len)
{
struct varlena *retval;
int totalread = 0;
int totalread = 0;
retval = (struct varlena *) palloc(sizeof(int32) + len);
totalread = lo_read(fd, VARDATA(retval), len);
@@ -237,8 +237,8 @@ loread(int fd, int len)
int
lowrite(int fd, struct varlena * wbuf)
{
int totalwritten;
int bytestowrite;
int totalwritten;
int bytestowrite;
bytestowrite = VARSIZE(wbuf) - sizeof(int32);
totalwritten = lo_write(fd, VARDATA(wbuf), bytestowrite);
@@ -256,15 +256,15 @@ lowrite(int fd, struct varlena * wbuf)
Oid
lo_import(text * filename)
{
int fd;
int nbytes,
tmp;
int fd;
int nbytes,
tmp;
#define BUFSIZE 1024
char buf[BUFSIZE];
char fnamebuf[8192];
char buf[BUFSIZE];
char fnamebuf[8192];
LargeObjectDesc *lobj;
Oid lobjOid;
Oid lobjOid;
/*
* open the file to be read in
@@ -319,15 +319,15 @@ lo_import(text * filename)
int4
lo_export(Oid lobjId, text * filename)
{
int fd;
int nbytes,
tmp;
int fd;
int nbytes,
tmp;
#define BUFSIZE 1024
char buf[BUFSIZE];
char fnamebuf[8192];
char buf[BUFSIZE];
char fnamebuf[8192];
LargeObjectDesc *lobj;
mode_t oumask;
mode_t oumask;
/*
* create an inversion "object"
@@ -379,7 +379,7 @@ lo_export(Oid lobjId, text * filename)
static int
newLOfd(LargeObjectDesc * lobjCookie)
{
int i;
int i;
for (i = 0; i < MAX_LOBJ_FDS; i++)
{

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.5 1997/09/07 04:42:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.6 1997/09/08 02:23:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,7 +37,7 @@
#include <string.h>
#endif
static char *strmake(char *str, int len);
static char *strmake(char *str, int len);
/* ----------------------------------------------------------------
* PQ interface routines
@@ -58,7 +58,7 @@ static char *strmake(char *str, int len);
* This code scavanged from HandleFunctionRequest() in tcop/fastpath.h
* ----------------
*/
char *
char *
PQfn(int fnid,
int *result_buf, /* can't use void, dec compiler barfs */
int result_len,
@@ -66,9 +66,9 @@ PQfn(int fnid,
PQArgBlock * args,
int nargs)
{
char *retval; /* XXX - should be datum, maybe ? */
char *arg[8];
int i;
char *retval; /* XXX - should be datum, maybe ? */
char *arg[8];
int i;
/* ----------------
* fill args[] array
@@ -129,11 +129,11 @@ PQfn(int fnid,
* returns because the system longjmp's back to the main loop.
* ----------------
*/
char *
char *
PQexec(char *query)
{
PortalEntry *entry = NULL;
char *result = NULL;
PortalEntry *entry = NULL;
char *result = NULL;
/* ----------------
* create a new portal and put it on top of the portal stack.
@@ -158,7 +158,7 @@ PQexec(char *query)
result = entry->result;
if (result == NULL)
{
char *PQE = "Cnull PQexec result";
char *PQE = "Cnull PQexec result";
result = pstrdup(PQE);
}
@@ -191,9 +191,9 @@ PQexec(char *query)
int
pqtest_PQexec(char *q)
{
PortalBuffer *a;
char *res;
int t;
PortalBuffer *a;
char *res;
int t;
/* ----------------
* execute the postgres query
@@ -208,19 +208,19 @@ pqtest_PQexec(char *q)
t = 0;
switch (res[0])
{
case 'P':
a = PQparray(&res[1]);
if (a == NULL)
elog(WARN, "pqtest_PQexec: PQparray could not find portal %s",
res);
case 'P':
a = PQparray(&res[1]);
if (a == NULL)
elog(WARN, "pqtest_PQexec: PQparray could not find portal %s",
res);
t = PQntuples(a);
break;
case 'C':
break;
default:
elog(NOTICE, "pqtest_PQexec: PQexec(%s) returns %s", q, res);
break;
t = PQntuples(a);
break;
case 'C':
break;
default:
elog(NOTICE, "pqtest_PQexec: PQexec(%s) returns %s", q, res);
break;
}
return t;
@@ -230,10 +230,10 @@ pqtest_PQexec(char *q)
* utilities for pqtest_PQfn()
* ----------------
*/
static char *
static char *
strmake(char *str, int len)
{
char *newstr;
char *newstr;
if (str == NULL)
return NULL;
@@ -249,18 +249,18 @@ strmake(char *str, int len)
#define SKIP 0
#define SCAN 1
static char spacestr[] = " ";
static char spacestr[] = " ";
static int
strparse(char *s, char **fields, int *offsets, int maxfields)
{
int len = strlen(s);
char *cp = s,
*end = cp + len,
*ep;
int parsed = 0;
int mode = SKIP,
i = 0;
int len = strlen(s);
char *cp = s,
*end = cp + len,
*ep;
int parsed = 0;
int mode = SKIP,
i = 0;
if (*(end - 1) == '\n')
end--;
@@ -318,16 +318,16 @@ strparse(char *s, char **fields, int *offsets, int maxfields)
int
pqtest_PQfn(char *q)
{
int k,
j,
i,
v,
f,
offsets;
char *fields[8];
PQArgBlock pqargs[7];
int res;
char *pqres;
int k,
j,
i,
v,
f,
offsets;
char *fields[8];
PQArgBlock pqargs[7];
int res;
char *pqres;
/* ----------------
* parse q into fields
@@ -403,7 +403,7 @@ pqtest_PQfn(char *q)
int32
pqtest(struct varlena * vlena)
{
char *q;
char *q;
/* ----------------
* get the query
@@ -415,12 +415,12 @@ pqtest(struct varlena * vlena)
switch (q[0])
{
case '%':
return pqtest_PQfn(&q[1]);
break;
default:
return pqtest_PQexec(q);
break;
case '%':
return pqtest_PQfn(&q[1]);
break;
default:
return pqtest_PQexec(q);
break;
}
return (0);
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.20 1997/09/07 04:42:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.21 1997/09/08 02:23:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,7 @@
/* Some standard C libraries, including GNU, have an isblank() function.
Others, including Solaris, do not. So we have our own.
*/
static bool
static bool
isblank(const char c)
{
return (c == ' ' || c == 9 /* tab */ );
@@ -53,8 +53,8 @@ next_token(FILE * fp, char *buf, const int bufsz)
string as *buf and position file to beginning of next line or EOF,
whichever comes first.
--------------------------------------------------------------------------*/
int c;
char *eb = buf + (bufsz - 1);
int c;
char *eb = buf + (bufsz - 1);
/* Move over inital token-delimiting blanks */
while (isblank(c = getc(fp)));
@@ -87,7 +87,7 @@ next_token(FILE * fp, char *buf, const int bufsz)
static void
read_through_eol(FILE * file)
{
int c;
int c;
do
c = getc(file);
@@ -105,9 +105,9 @@ read_hba_entry2(FILE * file, enum Userauth * userauth_p, char usermap_name[],
and return the interpretation of it as *userauth_p, usermap_name, and
*error_p.
---------------------------------------------------------------------------*/
char buf[MAX_TOKEN];
char buf[MAX_TOKEN];
bool userauth_valid;
bool userauth_valid;
/* Get authentication type token. */
next_token(file, buf, sizeof(buf));
@@ -197,7 +197,7 @@ process_hba_record(FILE * file,
return *error_p true, after issuing a message to stderr. If no error,
leave *error_p as it was.
---------------------------------------------------------------------------*/
char buf[MAX_TOKEN]; /* A token from the record */
char buf[MAX_TOKEN]; /* A token from the record */
/* Read the record type field */
next_token(file, buf, sizeof(buf));
@@ -233,14 +233,14 @@ process_hba_record(FILE * file,
*matches_p = false;
else
{
int valid; /* Field is valid dotted
int valid; /* Field is valid dotted
* decimal */
/*
* Remember the IP address field and go get mask
* field
*/
struct in_addr file_ip_addr; /* IP address field
struct in_addr file_ip_addr; /* IP address field
* value */
valid = inet_aton(buf, &file_ip_addr);
@@ -257,7 +257,7 @@ process_hba_record(FILE * file,
*matches_p = false;
else
{
struct in_addr mask;
struct in_addr mask;
/*
* Got mask. Now see if this record is
@@ -320,13 +320,13 @@ process_open_config_file(FILE * file,
This function does the same thing as find_hba_entry, only with
the config file already open on stream descriptor "file".
----------------------------------------------------------------------------*/
bool found_entry;
bool found_entry;
/* We've processed a record that applies to our connection */
bool error;
bool error;
/* Said record has invalid syntax. */
bool eof; /* We've reached the end of the file we're
bool eof; /* We've reached the end of the file we're
* reading */
found_entry = false; /* initial value */
@@ -336,7 +336,7 @@ process_open_config_file(FILE * file,
{
/* Process a line from the config file */
int c; /* a character read from the file */
int c; /* a character read from the file */
c = getc(file);
ungetc(c, file);
@@ -392,11 +392,11 @@ find_hba_entry(const char DataDir[], const struct in_addr ip_addr,
system.
---------------------------------------------------------------------------*/
int fd;
int fd;
FILE *file; /* The config file we have to read */
FILE *file; /* The config file we have to read */
char *old_conf_file;
char *old_conf_file;
/* The name of old config file that better not exist. */
@@ -423,8 +423,8 @@ find_hba_entry(const char DataDir[], const struct in_addr ip_addr,
}
else
{
char *conf_file; /* The name of the config file we
* have to read */
char *conf_file; /* The name of the config file we have to
* read */
/* put together the full pathname to the config file */
conf_file = (char *) malloc((strlen(DataDir) +
@@ -469,7 +469,7 @@ interpret_ident_response(char ident_response[],
*error_p == false and the username as ident_username[]. If it's anything
else, return *error_p == true and ident_username[] undefined.
----------------------------------------------------------------------------*/
char *cursor; /* Cursor into ident_response[] */
char *cursor; /* Cursor into ident_response[] */
cursor = &ident_response[0];
@@ -491,8 +491,8 @@ interpret_ident_response(char ident_response[],
else
{
/* We're positioned to colon before response type field */
char response_type[80];
int i; /* Index into response_type[] */
char response_type[80];
int i; /* Index into response_type[] */
cursor++; /* Go over colon */
while (isblank(*cursor))
@@ -526,8 +526,7 @@ interpret_ident_response(char ident_response[],
*error_p = true;
else
{
int i; /* Index into
* ident_username[] */
int i; /* Index into ident_username[] */
cursor++; /* Go over colon */
while (isblank(*cursor))
@@ -564,11 +563,11 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
*ident_failed == true (and ident_username[] undefined).
----------------------------------------------------------------------------*/
int sock_fd;
int sock_fd;
/* File descriptor for socket on which we talk to Ident */
int rc; /* Return code from a locally called
int rc; /* Return code from a locally called
* function */
sock_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
@@ -608,7 +607,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
}
else
{
char ident_query[80];
char ident_query[80];
/* The query we send to the Ident server */
sprintf(ident_query, "%d,%d\n",
@@ -628,7 +627,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
}
else
{
char ident_response[80 + IDENT_USERNAME_MAX];
char ident_response[80 + IDENT_USERNAME_MAX];
rc = recv(sock_fd, ident_response, sizeof(ident_response) - 1, 0);
if (rc < 0)
@@ -647,8 +646,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
}
else
{
bool error; /* response from Ident is
* garbage. */
bool error; /* response from Ident is garbage. */
ident_response[rc] = '\0';
interpret_ident_response(ident_response, &error, ident_username);
@@ -674,7 +672,7 @@ parse_map_record(FILE * file,
ones.
---------------------------------------------------------------------------*/
char buf[MAX_TOKEN];
char buf[MAX_TOKEN];
/* A token read from the file */
@@ -714,9 +712,9 @@ verify_against_open_usermap(FILE * file,
This function does the same thing as verify_against_usermap,
only with the config file already open on stream descriptor "file".
---------------------------------------------------------------------------*/
bool match; /* We found a matching entry in the map
bool match; /* We found a matching entry in the map
* file */
bool eof; /* We've reached the end of the file we're
bool eof; /* We've reached the end of the file we're
* reading */
match = false; /* initial value */
@@ -725,7 +723,7 @@ verify_against_open_usermap(FILE * file,
{
/* Process a line from the map file */
int c; /* a character read from the file */
int c; /* a character read from the file */
c = getc(file);
ungetc(c, file);
@@ -738,9 +736,9 @@ verify_against_open_usermap(FILE * file,
else
{
/* The following are fields read from a record of the file */
char file_map[MAX_TOKEN + 1];
char file_pguser[MAX_TOKEN + 1];
char file_iuser[MAX_TOKEN + 1];
char file_map[MAX_TOKEN + 1];
char file_pguser[MAX_TOKEN + 1];
char file_iuser[MAX_TOKEN + 1];
parse_map_record(file, file_map, file_pguser, file_iuser);
if (strcmp(file_map, usermap_name) == 0 &&
@@ -795,10 +793,10 @@ verify_against_usermap(const char DataDir[],
}
else
{
FILE *file; /* The map file we have to read */
FILE *file; /* The map file we have to read */
char *map_file; /* The name of the map file we
* have to read */
char *map_file; /* The name of the map file we have to
* read */
/* put together the full pathname to the map file */
map_file = (char *) malloc((strlen(DataDir) +
@@ -850,10 +848,10 @@ authident(const char DataDir[],
Return *authentic_p true iff yes.
---------------------------------------------------------------------------*/
bool ident_failed;
bool ident_failed;
/* We were unable to get ident to give us a username */
char ident_username[IDENT_USERNAME_MAX + 1];
char ident_username[IDENT_USERNAME_MAX + 1];
/* The username returned by ident */
@@ -865,7 +863,7 @@ authident(const char DataDir[],
*authentic_p = false;
else
{
bool checks_out;
bool checks_out;
verify_against_usermap(DataDir,
postgres_username, ident_username, usermap_name,
@@ -888,25 +886,25 @@ hba_recvauth(const Port * port, const char database[], const char user[],
allowed to act as user "user" and access database "database". Return
STATUS_OK if yes; STATUS_ERROR if not.
----------------------------------------------------------------------------*/
bool host_ok;
bool host_ok;
/*
* There's an entry for this database and remote host in the pg_hba
* file
*/
char usermap_name[USERMAP_NAME_SIZE + 1];
char usermap_name[USERMAP_NAME_SIZE + 1];
/*
* The name of the map pg_hba specifies for this connection (or
* special value "SAMEUSER")
*/
enum Userauth userauth;
enum Userauth userauth;
/*
* The type of user authentication pg_hba specifies for this
* connection
*/
int retvalue;
int retvalue;
/* Our eventual return value */
@@ -922,31 +920,31 @@ hba_recvauth(const Port * port, const char database[], const char user[],
{
switch (userauth)
{
case Trust:
retvalue = STATUS_OK;
break;
case Ident:
{
case Trust:
retvalue = STATUS_OK;
break;
case Ident:
{
/*
* Here's where we need to call up ident and authenticate
* the user
*/
/*
* Here's where we need to call up ident and
* authenticate the user
*/
bool authentic; /* He is who he says he
bool authentic; /* He is who he says he
* is. */
authident(DataDir, *port, user, usermap_name, &authentic);
authident(DataDir, *port, user, usermap_name, &authentic);
if (authentic)
retvalue = STATUS_OK;
else
retvalue = STATUS_ERROR;
}
break;
default:
retvalue = STATUS_ERROR;
Assert(false);
if (authentic)
retvalue = STATUS_OK;
else
retvalue = STATUS_ERROR;
}
break;
default:
retvalue = STATUS_ERROR;
Assert(false);
}
}
return (retvalue);

View File

@@ -13,18 +13,18 @@ int
verify_password(char *user, char *password, Port * port,
char *database, char *DataDir)
{
bool host_ok;
enum Userauth userauth;
char pw_file_name[PWFILE_NAME_SIZE + 1];
bool host_ok;
enum Userauth userauth;
char pw_file_name[PWFILE_NAME_SIZE + 1];
char *pw_file_fullname;
FILE *pw_file;
char *pw_file_fullname;
FILE *pw_file;
char pw_file_line[255];
char *p,
*test_user,
*test_pw;
char salt[3];
char pw_file_line[255];
char *p,
*test_user,
*test_pw;
char salt[3];
find_hba_entry(DataDir, port->raddr.sin_addr, database,
&host_ok, &userauth, pw_file_name, true);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.7 1997/09/07 04:42:23 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.8 1997/09/08 02:23:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -111,8 +111,8 @@ valid_pointer(char *msg, void *ptr)
int
PQnportals(int rule_p)
{
int i,
n = 0;
int i,
n = 0;
for (i = 0; i < portals_array_size; ++i)
{
@@ -142,8 +142,8 @@ PQnportals(int rule_p)
void
PQpnames(char **pnames, int rule_p)
{
int i,
cur_pname = 0;
int i,
cur_pname = 0;
if (!valid_pointer("PQpnames: invalid name buffer", pnames))
return;
@@ -165,10 +165,10 @@ PQpnames(char **pnames, int rule_p)
* PQparray - Return the portal buffer given a portal name
* --------------------------------
*/
PortalBuffer *
PortalBuffer *
PQparray(char *pname)
{
int i;
int i;
if (!valid_pointer("PQparray: invalid name buffer", pname))
return NULL;
@@ -230,7 +230,7 @@ PQngroups(PortalBuffer * portal)
int
PQntuplesGroup(PortalBuffer * portal, int group_index)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQntuplesGroup: invalid portal pointer", portal) ||
!in_range("PQntuplesGroup: group index",
@@ -256,7 +256,7 @@ PQninstancesGroup(PortalBuffer * portal, int group_index)
int
PQnfieldsGroup(PortalBuffer * portal, int group_index)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQnfieldsGroup: invalid portal pointer", portal) ||
!in_range("PQnfieldsGroup: group index",
@@ -276,7 +276,7 @@ PQnfieldsGroup(PortalBuffer * portal, int group_index)
int
PQfnumberGroup(PortalBuffer * portal, int group_index, char *field_name)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQfnumberGroup: invalid portal pointer", portal) ||
!valid_pointer("PQfnumberGroup: invalid field name pointer",
@@ -295,10 +295,10 @@ PQfnumberGroup(PortalBuffer * portal, int group_index, char *field_name)
* the group index and field index.
* --------------------------------
*/
char *
char *
PQfnameGroup(PortalBuffer * portal, int group_index, int field_number)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQfnameGroup: invalid portal pointer", portal) ||
!in_range("PQfnameGroup: group index",
@@ -320,7 +320,7 @@ PQfnameGroup(PortalBuffer * portal, int group_index, int field_number)
int
PQftypeGroup(PortalBuffer * portal, int group_index, int field_number)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQftypeGroup: invalid portal pointer", portal) ||
!in_range("PQftypeGroup: group index",
@@ -341,7 +341,7 @@ PQftypeGroup(PortalBuffer * portal, int group_index, int field_number)
int
PQfsizeGroup(PortalBuffer * portal, int group_index, int field_number)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQfsizeGroup: invalid portal pointer", portal) ||
!in_range("PQfsizeGroup: tuple index",
@@ -359,11 +359,11 @@ PQfsizeGroup(PortalBuffer * portal, int group_index, int field_number)
* PQgroup - Return the tuple group that a particular tuple is in
* --------------------------------
*/
GroupBuffer *
GroupBuffer *
PQgroup(PortalBuffer * portal, int tuple_index)
{
GroupBuffer *gbp;
int tuple_count = 0;
GroupBuffer *gbp;
int tuple_count = 0;
if (!valid_pointer("PQgroup: invalid portal pointer", portal) ||
!in_range("PQgroup: tuple index",
@@ -388,9 +388,9 @@ PQgroup(PortalBuffer * portal, int tuple_index)
int
PQgetgroup(PortalBuffer * portal, int tuple_index)
{
GroupBuffer *gbp;
int tuple_count = 0,
group_count = 0;
GroupBuffer *gbp;
int tuple_count = 0,
group_count = 0;
if (!valid_pointer("PQgetgroup: invalid portal pointer", portal) ||
!in_range("PQgetgroup: tuple index",
@@ -414,7 +414,7 @@ PQgetgroup(PortalBuffer * portal, int tuple_index)
int
PQnfields(PortalBuffer * portal, int tuple_index)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQnfields: invalid portal pointer", portal) ||
!in_range("PQnfields: tuple index",
@@ -434,7 +434,7 @@ PQnfields(PortalBuffer * portal, int tuple_index)
int
PQfnumber(PortalBuffer * portal, int tuple_index, char *field_name)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQfnumber: invalid portal pointer", portal) ||
!valid_pointer("PQfnumber: invalid field name pointer", field_name) ||
@@ -451,10 +451,10 @@ PQfnumber(PortalBuffer * portal, int tuple_index, char *field_name)
* PQfname - Return the name of a field
* --------------------------------
*/
char *
char *
PQfname(PortalBuffer * portal, int tuple_index, int field_number)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQfname: invalid portal pointer", portal) ||
!in_range("PQfname: tuple index",
@@ -475,7 +475,7 @@ PQfname(PortalBuffer * portal, int tuple_index, int field_number)
int
PQftype(PortalBuffer * portal, int tuple_index, int field_number)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQftype: invalid portal pointer", portal) ||
!in_range("PQfname: tuple index",
@@ -495,7 +495,7 @@ PQftype(PortalBuffer * portal, int tuple_index, int field_number)
int
PQfsize(PortalBuffer * portal, int tuple_index, int field_number)
{
GroupBuffer *gbp;
GroupBuffer *gbp;
if (!valid_pointer("PQfsize: invalid portal pointer", portal) ||
!in_range("PQfsize: tuple index",
@@ -518,8 +518,8 @@ PQfsize(PortalBuffer * portal, int tuple_index, int field_number)
int
PQsametype(PortalBuffer * portal, int tuple_index1, int tuple_index2)
{
GroupBuffer *gbp1,
*gbp2;
GroupBuffer *gbp1,
*gbp2;
if (!valid_pointer("PQsametype: invalid portal pointer", portal) ||
!in_range("PQsametype: tuple index 1",
@@ -540,9 +540,9 @@ PQGetTupleBlock(PortalBuffer * portal,
int tuple_index,
int *tuple_offset)
{
GroupBuffer *gbp;
TupleBlock *tbp;
int tuple_count = 0;
GroupBuffer *gbp;
TupleBlock *tbp;
int tuple_count = 0;
if (!valid_pointer("PQGetTupleBlock: invalid portal pointer", portal) ||
!valid_pointer("PQGetTupleBlock: invalid offset pointer",
@@ -578,13 +578,13 @@ PQGetTupleBlock(PortalBuffer * portal,
* PQgetvalue - Return an attribute (field) value
* --------------------------------
*/
char *
char *
PQgetvalue(PortalBuffer * portal,
int tuple_index,
int field_number)
{
TupleBlock *tbp;
int tuple_offset;
TupleBlock *tbp;
int tuple_offset;
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp)
@@ -598,15 +598,15 @@ PQgetvalue(PortalBuffer * portal,
* a copy. The CALLER is responsible for free'ing the data returned.
* --------------------------------
*/
char *
char *
PQgetAttr(PortalBuffer * portal,
int tuple_index,
int field_number)
{
TupleBlock *tbp;
int tuple_offset;
int len;
char *result = NULL;
TupleBlock *tbp;
int tuple_offset;
int len;
char *result = NULL;
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp)
@@ -631,8 +631,8 @@ PQgetlength(PortalBuffer * portal,
int tuple_index,
int field_number)
{
TupleBlock *tbp;
int tuple_offset;
TupleBlock *tbp;
int tuple_offset;
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp)
@@ -657,15 +657,15 @@ PQclear(char *pname)
* This is going away with pending rewrite of comm. code...
*/
/* static SLList pqNotifyList;*/
static Dllist *pqNotifyList = NULL;
static Dllist *pqNotifyList = NULL;
/* remove invalid notifies before returning */
void
PQcleanNotify()
{
Dlelem *e,
*next;
PQNotifyList *p;
Dlelem *e,
*next;
PQNotifyList *p;
e = DLGetHead(pqNotifyList);
@@ -686,8 +686,8 @@ PQcleanNotify()
void
PQnotifies_init()
{
Dlelem *e;
PQNotifyList *p;
Dlelem *e;
PQNotifyList *p;
if (pqNotifyList == NULL)
{
@@ -705,10 +705,10 @@ PQnotifies_init()
}
}
PQNotifyList *
PQNotifyList *
PQnotifies()
{
Dlelem *e;
Dlelem *e;
PQcleanNotify();
e = DLGetHead(pqNotifyList);
@@ -724,7 +724,7 @@ PQremoveNotify(PQNotifyList * nPtr)
void
PQappendNotify(char *relname, int pid)
{
PQNotifyList *p;
PQNotifyList *p;
if (pqNotifyList == NULL)
pqNotifyList = DLNewList();

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.5 1997/09/07 04:42:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.6 1997/09/08 02:23:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,8 +55,8 @@
#include <libpq/libpq.h> /* where the declarations go */
#include <utils/exc.h>
PortalEntry **portals = (PortalEntry **) NULL;
size_t portals_array_size = 0;
PortalEntry **portals = (PortalEntry **) NULL;
size_t portals_array_size = 0;
/* portals array memory is malloc'd instead of using MemoryContexts */
/* since it will be used by both front and backend programs*/
@@ -72,9 +72,9 @@ size_t portals_array_size = 0;
static void
portals_realloc(size_t size)
{
size_t oldsize;
int i;
PortalEntry **newp;
size_t oldsize;
int i;
PortalEntry **newp;
oldsize = portals_array_size;
@@ -106,7 +106,7 @@ portals_realloc(size_t size)
caddr_t
pbuf_alloc(size_t size)
{
caddr_t addr;
caddr_t addr;
if (size <= 0)
libpq_raise(&MemoryError, form("Invalid argument to pbuf_alloc()."));
@@ -139,10 +139,10 @@ pbuf_free(caddr_t pointer)
* pbuf_addPortal - Allocate a new portal buffer
* --------------------------------
*/
PortalBuffer *
PortalBuffer *
pbuf_addPortal()
{
PortalBuffer *portal;
PortalBuffer *portal;
portal = (PortalBuffer *)
pbuf_alloc(sizeof(PortalBuffer));
@@ -159,11 +159,11 @@ pbuf_addPortal()
* pbuf_addGroup - Add a new tuple group to the portal
* --------------------------------
*/
GroupBuffer *
GroupBuffer *
pbuf_addGroup(PortalBuffer * portal)
{
GroupBuffer *group,
*group1;
GroupBuffer *group,
*group1;
group = (GroupBuffer *)
pbuf_alloc(sizeof(GroupBuffer));
@@ -191,10 +191,10 @@ pbuf_addGroup(PortalBuffer * portal)
* pbuf_addTypes - Allocate n type blocks
* --------------------------------
*/
TypeBlock *
TypeBlock *
pbuf_addTypes(int n)
{
TypeBlock *types;
TypeBlock *types;
types = (TypeBlock *)
pbuf_alloc(n * sizeof(TypeBlock));
@@ -206,10 +206,10 @@ pbuf_addTypes(int n)
* pbuf_addTuples - Allocate a tuple block
* --------------------------------
*/
TupleBlock *
TupleBlock *
pbuf_addTuples()
{
TupleBlock *tuples;
TupleBlock *tuples;
tuples = (TupleBlock *)
pbuf_alloc(sizeof(TupleBlock));
@@ -224,7 +224,7 @@ pbuf_addTuples()
* pbuf_addTuple - Allocate a tuple of n fields (attributes)
* --------------------------------
*/
char **
char **
pbuf_addTuple(int n)
{
return (char **)
@@ -235,7 +235,7 @@ pbuf_addTuple(int n)
* pbuf_addTupleValueLengths - Allocate a tuple of n lengths (attributes)
* --------------------------------
*/
int *
int *
pbuf_addTupleValueLengths(int n)
{
return (int *)
@@ -246,7 +246,7 @@ pbuf_addTupleValueLengths(int n)
* pbuf_addValues - Allocate n bytes for a value
* --------------------------------
*/
char *
char *
pbuf_addValues(int n)
{
return
@@ -257,7 +257,7 @@ pbuf_addValues(int n)
* pbuf_addEntry - Allocate a portal entry
* --------------------------------
*/
PortalEntry *
PortalEntry *
pbuf_addEntry()
{
return (PortalEntry *)
@@ -299,8 +299,8 @@ pbuf_freeTuples(TupleBlock * tuples,
int no_tuples,
int no_fields)
{
int i,
j;
int i,
j;
if (no_tuples > TupleBlockSize)
{
@@ -363,7 +363,7 @@ pbuf_freePortal(PortalBuffer * portal)
int
pbuf_getIndex(char *pname)
{
int i;
int i;
if (portals)
{
@@ -391,10 +391,10 @@ pbuf_setportalinfo(PortalEntry * entry, char *pname)
* pbuf_setup - Set up a portal for dumping data
* --------------------------------
*/
PortalEntry *
PortalEntry *
pbuf_setup(char *pname)
{
int i;
int i;
if (!portals) /* the portals array has not been
* allocated yet */
@@ -435,7 +435,7 @@ pbuf_setup(char *pname)
void
pbuf_close(char *pname)
{
int i;
int i;
if ((i = pbuf_getIndex(pname)) == -1)
libpq_raise(&PortalError, form("Portal %s does not exist.", pname));
@@ -448,11 +448,11 @@ pbuf_close(char *pname)
* pbuf_findGroup - Return the group given the group_index
* --------------------------------
*/
GroupBuffer *
GroupBuffer *
pbuf_findGroup(PortalBuffer * portal,
int group_index)
{
GroupBuffer *group;
GroupBuffer *group;
group = portal->groups;
while (group_index > 0 && group != NULL)
@@ -476,8 +476,8 @@ int
pbuf_findFnumber(GroupBuffer * group,
char *field_name)
{
TypeBlock *types;
int i;
TypeBlock *types;
int i;
types = group->types;
@@ -510,7 +510,7 @@ pbuf_checkFnumber(GroupBuffer * group,
* pbuf_findFname - Find the field name given the field index
* --------------------------------
*/
char *
char *
pbuf_findFname(GroupBuffer * group,
int field_number)
{

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.20 1997/09/07 04:42:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.21 1997/09/08 02:23:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,10 +63,10 @@
* declarations
* ----------------
*/
FILE *Pfout,
*Pfin;
FILE *Pfdebug; /* debugging libpq */
int PQAsyncNotifyWaiting; /* for async. notification */
FILE *Pfout,
*Pfin;
FILE *Pfdebug; /* debugging libpq */
int PQAsyncNotifyWaiting; /* for async. notification */
/* --------------------------------
* pq_init - open portal file descriptors
@@ -102,7 +102,7 @@ pq_init(int fd)
static int
pq_getc(FILE * fin)
{
int c;
int c;
c = getc(fin);
if (Pfdebug && c != EOF)
@@ -127,7 +127,7 @@ pq_gettty(char *tp)
int
pq_getport()
{
char *envport = getenv("PGPORT");
char *envport = getenv("PGPORT");
if (envport)
return (atoi(envport));
@@ -174,7 +174,7 @@ pq_flush()
int
pq_getstr(char *s, int maxlen)
{
int c = '\0';
int c = '\0';
if (Pfin == (FILE *) NULL)
{
@@ -268,7 +268,7 @@ pq_getnchar(char *s, int off, int maxlen)
return pqGetNBytes(s + off, maxlen, Pfin);
#if 0
int c = '\0';
int c = '\0';
if (Pfin == (FILE *) NULL)
{
@@ -300,8 +300,8 @@ pq_getnchar(char *s, int off, int maxlen)
int
pq_getint(int b)
{
int n,
status = 1;
int n,
status = 1;
if (!Pfin)
return EOF;
@@ -313,17 +313,17 @@ pq_getint(int b)
switch (b)
{
case 1:
status = ((n = fgetc(Pfin)) == EOF);
break;
case 2:
status = pqGetShort(&n, Pfin);
break;
case 4:
status = pqGetLong(&n, Pfin);
break;
default:
fprintf(stderr, "** Unsupported size %d\n", b);
case 1:
status = ((n = fgetc(Pfin)) == EOF);
break;
case 2:
status = pqGetShort(&n, Pfin);
break;
case 4:
status = pqGetLong(&n, Pfin);
break;
default:
fprintf(stderr, "** Unsupported size %d\n", b);
}
if (status)
@@ -381,7 +381,7 @@ pq_putnchar(char *s, int n)
void
pq_putint(int i, int b)
{
int status;
int status;
if (!Pfout)
return;
@@ -389,17 +389,17 @@ pq_putint(int i, int b)
status = 1;
switch (b)
{
case 1:
status = (fputc(i, Pfout) == EOF);
break;
case 2:
status = pqPutShort(i, Pfout);
break;
case 4:
status = pqPutLong(i, Pfout);
break;
default:
fprintf(stderr, "** Unsupported size %d\n", b);
case 1:
status = (fputc(i, Pfout) == EOF);
break;
case 2:
status = pqPutShort(i, Pfout);
break;
case 4:
status = pqPutLong(i, Pfout);
break;
default:
fprintf(stderr, "** Unsupported size %d\n", b);
}
if (status)
@@ -421,7 +421,7 @@ pq_putint(int i, int b)
int
pq_sendoob(char *msg, int len)
{
int fd = fileno(Pfout);
int fd = fileno(Pfout);
return (send(fd, msg, len, MSG_OOB));
}
@@ -429,8 +429,8 @@ pq_sendoob(char *msg, int len)
int
pq_recvoob(char *msgPtr, int *lenPtr)
{
int fd = fileno(Pfout);
int len = 0;
int fd = fileno(Pfout);
int len = 0;
len = recv(fd, msgPtr + len, *lenPtr, MSG_OOB);
*lenPtr = len;
@@ -510,7 +510,7 @@ pq_getinserv(struct sockaddr_in * sin, char *host, char *serv)
void
pq_regoob(void (*fptr) ())
{
int fd = fileno(Pfout);
int fd = fileno(Pfout);
#if defined(hpux)
ioctl(fd, FIOSSAIOOWN, getpid());
@@ -532,10 +532,10 @@ pq_unregoob()
void
pq_async_notify()
{
char msg[20];
char msg[20];
/* int len = sizeof(msg); */
int len = 20;
int len = 20;
if (pq_recvoob(msg, &len) >= 0)
{
@@ -546,7 +546,7 @@ pq_async_notify()
}
else
{
extern int errno;
extern int errno;
printf("SIGURG but no data: len = %d, err=%d\n", len, errno);
}
@@ -575,8 +575,8 @@ int
StreamServerPort(char *hostName, short portName, int *fdP)
{
struct sockaddr_in sin;
int fd;
int one = 1;
int fd;
int one = 1;
if (!hostName)
@@ -645,7 +645,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
int
StreamConnection(int server_fd, Port * port)
{
int addrlen;
int addrlen;
/* accept connection (and fill in the client (remote) address) */
addrlen = sizeof(struct sockaddr_in);
@@ -667,7 +667,7 @@ StreamConnection(int server_fd, Port * port)
}
{
struct protoent *pe;
int on = 1;
int on = 1;
pe = getprotobyname("TCP");
if (pe == NULL)
@@ -715,8 +715,8 @@ int
StreamOpen(char *hostName, short portName, Port * port)
{
struct hostent *hp;
int laddrlen = sizeof(struct sockaddr_in);
extern int errno;
int laddrlen = sizeof(struct sockaddr_in);
extern int errno;
if (!hostName)
hostName = "localhost";
@@ -774,7 +774,7 @@ StreamOpen(char *hostName, short portName, Port * port)
return (STATUS_OK);
}
static char *authentication_type_name[] = {
static char *authentication_type_name[] = {
0, 0, 0, 0, 0, 0, 0,
"the default authentication type",
0, 0,
@@ -785,10 +785,10 @@ static char *authentication_type_name[] = {
"plaintext password authentication"
};
char *
char *
name_of_authentication_type(int type)
{
char *result = 0;
char *result = 0;
if (type >= 1 && type <= LAST_AUTHENTICATION_TYPE)
{

View File

@@ -48,9 +48,9 @@
int
pqPutShort(int integer, FILE * f)
{
int retval = 0;
u_short n,
s;
int retval = 0;
u_short n,
s;
s = integer;
n = hton_s(s);
@@ -64,8 +64,8 @@ pqPutShort(int integer, FILE * f)
int
pqPutLong(int integer, FILE * f)
{
int retval = 0;
u_long n;
int retval = 0;
u_long n;
n = hton_l(integer);
if (fwrite(&n, sizeof(u_long), 1, f) != 1)
@@ -78,8 +78,8 @@ pqPutLong(int integer, FILE * f)
int
pqGetShort(int *result, FILE * f)
{
int retval = 0;
u_short n;
int retval = 0;
u_short n;
if (fread(&n, sizeof(u_short), 1, f) != 1)
retval = EOF;
@@ -92,8 +92,8 @@ pqGetShort(int *result, FILE * f)
int
pqGetLong(int *result, FILE * f)
{
int retval = 0;
u_long n;
int retval = 0;
u_long n;
if (fread(&n, sizeof(u_long), 1, f) != 1)
retval = EOF;
@@ -109,7 +109,7 @@ pqGetLong(int *result, FILE * f)
int
pqGetNBytes(char *s, size_t len, FILE * f)
{
int cnt;
int cnt;
if (f == NULL)
return EOF;
@@ -138,7 +138,7 @@ pqPutNBytes(const char *s, size_t len, FILE * f)
int
pqGetString(char *s, size_t len, FILE * f)
{
int c;
int c;
if (f == NULL)
return EOF;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.6 1997/09/07 04:42:28 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.7 1997/09/08 02:23:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,14 +61,14 @@ PacketReceive(Port * port, /* receive port */
PacketBuf * buf, /* MAX_PACKET_SIZE-worth of buffer space */
bool nonBlocking) /* NON_BLOCKING or BLOCKING i/o */
{
PacketLen max_size = sizeof(PacketBuf);
PacketLen cc; /* character count -- bytes recvd */
PacketLen packetLen; /* remaining packet chars to read */
Addr tmp; /* curr recv buf pointer */
int addrLen = sizeof(struct sockaddr_in);
int hdrLen;
int flag;
int decr;
PacketLen max_size = sizeof(PacketBuf);
PacketLen cc; /* character count -- bytes recvd */
PacketLen packetLen; /* remaining packet chars to read */
Addr tmp; /* curr recv buf pointer */
int addrLen = sizeof(struct sockaddr_in);
int hdrLen;
int flag;
int decr;
hdrLen = sizeof(buf->len);
@@ -224,8 +224,8 @@ PacketSend(Port * port,
PacketLen len,
bool nonBlocking)
{
PacketLen totalLen;
int addrLen = sizeof(struct sockaddr_in);
PacketLen totalLen;
int addrLen = sizeof(struct sockaddr_in);
Assert(!nonBlocking);
Assert(buf);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.6 1997/09/07 04:42:29 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.7 1997/09/08 02:23:19 momjian Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
@@ -50,7 +50,7 @@ pqsignal(int signo, pqsigfunc func)
return signal(signo, func);
#else
struct sigaction act,
oact;
oact;
act.sa_handler = func;
sigemptyset(&act.sa_mask);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/util.c,v 1.4 1997/09/07 04:42:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/util.c,v 1.5 1997/09/08 02:23:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,14 +32,14 @@
* exceptions
* ----------------
*/
Exception MemoryError = {"Memory Allocation Error"};
Exception PortalError = {"Invalid arguments to portal functions"};
Exception PostquelError = {"Sql Error"};
Exception ProtocolError = {"Protocol Error"};
char PQerrormsg[ERROR_MSG_LENGTH];
Exception MemoryError = {"Memory Allocation Error"};
Exception PortalError = {"Invalid arguments to portal functions"};
Exception PostquelError = {"Sql Error"};
Exception ProtocolError = {"Protocol Error"};
char PQerrormsg[ERROR_MSG_LENGTH];
int PQtracep = 0; /* 1 to print out debugging messages */
FILE *debug_port = (FILE *) NULL;
int PQtracep = 0; /* 1 to print out debugging messages */
FILE *debug_port = (FILE *) NULL;
/* ----------------------------------------------------------------
* PQ utility routines