diff options
| author | Bruce Momjian | 1998-02-26 04:46:47 +0000 |
|---|---|---|
| committer | Bruce Momjian | 1998-02-26 04:46:47 +0000 |
| commit | a32450a5855eed4bfd756ef292ee45d3c754665b (patch) | |
| tree | 26735c3406d9f46d0f39accbe6ff1fb5cc5beedc /src/interfaces/libpq | |
| parent | 757bf69a2e259c76baed94fa06e792664ab5ed67 (diff) | |
pgindent run before 6.3 release, with Thomas' requested changes.
Diffstat (limited to 'src/interfaces/libpq')
| -rw-r--r-- | src/interfaces/libpq/fe-auth.c | 54 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-connect.c | 108 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-connect.h | 4 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-exec.c | 17 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-misc.c | 6 | ||||
| -rw-r--r-- | src/interfaces/libpq/libpq-fe.h | 12 |
6 files changed, 109 insertions, 92 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index 7f77589a6b9..93fb4442b05 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.14 1998/01/29 03:24:03 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.15 1998/02/26 04:44:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -477,14 +477,14 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq) */ int fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname, - const char *password, char *PQerrormsg) + const char *password, char *PQerrormsg) { switch (areq) { - case AUTH_REQ_OK: - break; + case AUTH_REQ_OK: + break; - case AUTH_REQ_KRB4: + case AUTH_REQ_KRB4: #ifdef KRB4 if (pg_krb4_sendauth(PQerrormsg, conn->sock, &conn->laddr.in, &conn->raddr.in, @@ -496,12 +496,12 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname, } break; #else - (void)sprintf(PQerrormsg, - "fe_sendauth: krb4 authentication not supported\n"); - return (STATUS_ERROR); + (void) sprintf(PQerrormsg, + "fe_sendauth: krb4 authentication not supported\n"); + return (STATUS_ERROR); #endif - case AUTH_REQ_KRB5: + case AUTH_REQ_KRB5: #ifdef KRB5 if (pg_krb5_sendauth(PQerrormsg, conn->sock, &conn->laddr.in, &conn->raddr.in, @@ -513,27 +513,27 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname, } break; #else - (void)sprintf(PQerrormsg, - "fe_sendauth: krb5 authentication not supported\n"); - return (STATUS_ERROR); + (void) sprintf(PQerrormsg, + "fe_sendauth: krb5 authentication not supported\n"); + return (STATUS_ERROR); #endif - case AUTH_REQ_PASSWORD: - case AUTH_REQ_CRYPT: - if (pg_password_sendauth(conn, password, areq) != STATUS_OK) - { - (void)sprintf(PQerrormsg, - "fe_sendauth: error sending password authentication\n"); - return (STATUS_ERROR); - } + case AUTH_REQ_PASSWORD: + case AUTH_REQ_CRYPT: + if (pg_password_sendauth(conn, password, areq) != STATUS_OK) + { + (void) sprintf(PQerrormsg, + "fe_sendauth: error sending password authentication\n"); + return (STATUS_ERROR); + } - break; + break; - default: - (void)sprintf(PQerrormsg, - "fe_sendauth: authentication type %u not supported\n",areq); - return (STATUS_ERROR); - } + default: + (void) sprintf(PQerrormsg, + "fe_sendauth: authentication type %u not supported\n", areq); + return (STATUS_ERROR); + } return (STATUS_OK); } @@ -580,7 +580,7 @@ fe_getauthsvc(char *PQerrormsg) * name the user has authenticated to the system * if there is an error, return the error message in PQerrormsg */ -char * +char * fe_getauthname(char *PQerrormsg) { char *name = (char *) NULL; diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index f9d856d207a..30f07927c60 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.62 1998/01/31 21:27:28 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.63 1998/02/26 04:44:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -49,7 +49,7 @@ static void closePGconn(PGconn *conn); static int conninfo_parse(const char *conninfo, char *errorMessage); static char *conninfo_getval(char *keyword); static void conninfo_free(void); -void PQsetenv(PGconn *conn); +void PQsetenv(PGconn *conn); #define NOTIFYLIST_INITIAL_SIZE 10 #define NOTIFYLIST_GROWBY 10 @@ -114,15 +114,29 @@ struct EnvironmentOptions { /* common user-interface settings */ - { "PGDATESTYLE", "datestyle" }, - { "PGTZ", "timezone" }, + { + "PGDATESTYLE", "datestyle" + }, + { + "PGTZ", "timezone" + }, /* internal performance-related settings */ - { "PGCOSTHEAP", "cost_heap" }, - { "PGCOSTINDEX", "cost_index" }, - { "PGRPLANS", "r_plans" }, - { "PGGEQO", "geqo" }, - { NULL } + { + "PGCOSTHEAP", "cost_heap" + }, + { + "PGCOSTINDEX", "cost_index" + }, + { + "PGRPLANS", "r_plans" + }, + { + "PGGEQO", "geqo" + }, + { + NULL + } }; /* ---------------- @@ -149,7 +163,8 @@ PQconnectdb(const char *conninfo) { PGconn *conn; char errorMessage[ERROR_MSG_LENGTH]; - char* tmp; + char *tmp; + /* ---------- * Allocate memory for the conn structure * ---------- @@ -190,7 +205,7 @@ PQconnectdb(const char *conninfo) tmp = conninfo_getval("port"); conn->pgport = tmp ? strdup(tmp) : NULL; tmp = conninfo_getval("tty"); - conn->pgtty = tmp ? strdup(tmp) : NULL; + conn->pgtty = tmp ? strdup(tmp) : NULL; tmp = conninfo_getval("options"); conn->pgoptions = tmp ? strdup(tmp) : NULL; tmp = conninfo_getval("user"); @@ -291,7 +306,7 @@ PQconndefaults(void) * * ---------------- */ -PGconn * +PGconn * PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, const char *pgtty, const char *dbName, const char *login, const char *pwd) { PGconn *conn; @@ -399,8 +414,8 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, cons conn->dbName = strdup(conn->pguser); /* - * if the database name is surrounded by double-quotes, - * then don't convert case + * if the database name is surrounded by double-quotes, then + * don't convert case */ if (*conn->dbName == '"') { @@ -455,8 +470,8 @@ connectDB(PGconn *conn) { struct hostent *hp; - StartupPacket sp; - AuthRequest areq; + StartupPacket sp; + AuthRequest areq; int laddrlen = sizeof(SockAddr); int portno, family, @@ -466,9 +481,9 @@ connectDB(PGconn *conn) * Initialize the startup packet. */ - MemSet((char *)&sp, 0, sizeof (StartupPacket)); + MemSet((char *) &sp, 0, sizeof(StartupPacket)); - sp.protoVersion = (ProtocolVersion)htonl(PG_PROTOCOL_LATEST); + sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_LATEST); strncpy(sp.user, conn->pguser, SM_USER); strncpy(sp.database, conn->dbName, SM_DATABASE); @@ -491,7 +506,8 @@ connectDB(PGconn *conn) conn->pghost); goto connect_errReturn; } - } else + } + else hp = NULL; #if FALSE @@ -572,7 +588,7 @@ connectDB(PGconn *conn) /* Send the startup packet. */ - if (packetSend(conn, (char *)&sp, sizeof(StartupPacket)) != STATUS_OK) + if (packetSend(conn, (char *) &sp, sizeof(StartupPacket)) != STATUS_OK) { sprintf(conn->errorMessage, "connectDB() -- couldn't send complete packet: errno=%d\n%s\n", errno, strerror(errno)); @@ -586,12 +602,12 @@ connectDB(PGconn *conn) do { - int beresp; + int beresp; if ((beresp = pqGetc(conn->Pfin, conn->Pfdebug)) == EOF) { - (void)sprintf(conn->errorMessage, - "connectDB() -- error getting authentication request\n"); + (void) sprintf(conn->errorMessage, + "connectDB() -- error getting authentication request\n"); goto connect_errReturn; } @@ -600,8 +616,8 @@ connectDB(PGconn *conn) if (beresp == 'E') { - pqGets(conn->errorMessage, sizeof (conn->errorMessage), - conn->Pfin, conn->Pfdebug); + pqGets(conn->errorMessage, sizeof(conn->errorMessage), + conn->Pfin, conn->Pfdebug); goto connect_errReturn; } @@ -610,18 +626,18 @@ connectDB(PGconn *conn) if (beresp != 'R') { - (void)sprintf(conn->errorMessage, - "connectDB() -- expected authentication request\n"); + (void) sprintf(conn->errorMessage, + "connectDB() -- expected authentication request\n"); goto connect_errReturn; } /* Get the type of request. */ - if (pqGetInt((int *)&areq, 4, conn->Pfin, conn->Pfdebug)) + if (pqGetInt((int *) &areq, 4, conn->Pfin, conn->Pfdebug)) { - (void)sprintf(conn->errorMessage, - "connectDB() -- error getting authentication request type\n"); + (void) sprintf(conn->errorMessage, + "connectDB() -- error getting authentication request type\n"); goto connect_errReturn; } @@ -629,11 +645,11 @@ connectDB(PGconn *conn) /* Get the password salt if there is one. */ if (areq == AUTH_REQ_CRYPT && - pqGetnchar(conn->salt, sizeof (conn->salt), - conn->Pfin, conn->Pfdebug)) + pqGetnchar(conn->salt, sizeof(conn->salt), + conn->Pfin, conn->Pfdebug)) { - (void)sprintf(conn->errorMessage, - "connectDB() -- error getting password salt\n"); + (void) sprintf(conn->errorMessage, + "connectDB() -- error getting password salt\n"); goto connect_errReturn; } @@ -642,7 +658,7 @@ connectDB(PGconn *conn) /* Respond to the request. */ if (fe_sendauth(areq, conn, conn->pghost, conn->pgpass, - conn->errorMessage) != STATUS_OK) + conn->errorMessage) != STATUS_OK) goto connect_errReturn; } while (areq != AUTH_REQ_OK); @@ -664,7 +680,7 @@ void PQsetenv(PGconn *conn) { struct EnvironmentOptions *eo; - char setQuery[80]; /* mjl: size okay? XXX */ + char setQuery[80]; /* mjl: size okay? XXX */ for (eo = EnvironmentOptions; eo->envName; eo++) { @@ -679,13 +695,13 @@ PQsetenv(PGconn *conn) else sprintf(setQuery, "SET %s = '%.60s'", eo->pgName, val); #ifdef CONNECTDEBUG -printf("Use environment variable %s to send %s\n", eo->envName, setQuery); + printf("Use environment variable %s to send %s\n", eo->envName, setQuery); #endif res = PQexec(conn, setQuery); - PQclear(res); /* Don't care? */ + PQclear(res); /* Don't care? */ } } -} /* PQsetenv() */ +} /* PQsetenv() */ /* * freePGconn @@ -1095,7 +1111,7 @@ conninfo_free() } /* =========== accessor functions for PGconn ========= */ -char * +char * PQdb(PGconn *conn) { if (!conn) @@ -1106,7 +1122,7 @@ PQdb(PGconn *conn) return conn->dbName; } -char * +char * PQuser(PGconn *conn) { if (!conn) @@ -1117,7 +1133,7 @@ PQuser(PGconn *conn) return conn->pguser; } -char * +char * PQhost(PGconn *conn) { if (!conn) @@ -1129,7 +1145,7 @@ PQhost(PGconn *conn) return conn->pghost; } -char * +char * PQoptions(PGconn *conn) { if (!conn) @@ -1140,7 +1156,7 @@ PQoptions(PGconn *conn) return conn->pgoptions; } -char * +char * PQtty(PGconn *conn) { if (!conn) @@ -1151,7 +1167,7 @@ PQtty(PGconn *conn) return conn->pgtty; } -char * +char * PQport(PGconn *conn) { if (!conn) @@ -1173,7 +1189,7 @@ PQstatus(PGconn *conn) return conn->status; } -char * +char * PQerrorMessage(PGconn *conn) { if (!conn) diff --git a/src/interfaces/libpq/fe-connect.h b/src/interfaces/libpq/fe-connect.h index 53c9d8e2881..e1260be533e 100644 --- a/src/interfaces/libpq/fe-connect.h +++ b/src/interfaces/libpq/fe-connect.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: fe-connect.h,v 1.7 1998/01/29 03:24:36 scrappy Exp $ + * $Id: fe-connect.h,v 1.8 1998/02/26 04:45:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,6 +23,6 @@ *---------------------------------------------------------------- */ -int packetSend(PGconn *conn, const char *buf, size_t len); +int packetSend(PGconn *conn, const char *buf, size_t len); #endif /* FE_CONNECT_H */ diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index b9517cebbf2..ffa15a6428c 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.46 1998/01/26 01:42:35 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.47 1998/02/26 04:45:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -457,10 +457,11 @@ process_response_from_backend(FILE *pfin, FILE *pfout, FILE *pfdebug, { /* hmm, no response from the backend-end, that's bad */ (void) sprintf(reason, "PQexec() -- Request was sent to backend" - ", but backend closed the channel before responding." - "\n\tThis probably means the backend terminated abnormally" - " before or while processing the request.\n"); - conn->status = CONNECTION_BAD; /* No more connection to backend */ + ", but backend closed the channel before responding." + "\n\tThis probably means the backend terminated abnormally" + " before or while processing the request.\n"); + conn->status = CONNECTION_BAD; /* No more connection to + * backend */ *result_p = (PGresult *) NULL; done = true; } @@ -1643,7 +1644,7 @@ PQnfields(PGresult *res) /* returns NULL if the field_num is invalid */ -char * +char * PQfname(PGresult *res, int field_num) { if (!res) @@ -1756,7 +1757,7 @@ PQfsize(PGresult *res, int field_num) return 0; } -char * +char * PQcmdStatus(PGresult *res) { if (!res) @@ -1853,7 +1854,7 @@ PQcmdTuples(PGresult *res) if res is not binary, a null-terminated ASCII string is returned. */ -char * +char * PQgetvalue(PGresult *res, int tup_num, int field_num) { if (!res) diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index d1c18ee05ae..8a16950cdcd 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.9 1998/01/26 01:42:36 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.10 1998/02/26 04:45:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ pqPutnchar(const char *s, int len, FILE *f, FILE *debug) int pqGetnchar(char *s, int len, FILE *f, FILE *debug) { - int status; + int status; status = pqGetNBytes(s, len, f); @@ -82,7 +82,7 @@ pqGetnchar(char *s, int len, FILE *f, FILE *debug) int pqGets(char *s, int len, FILE *f, FILE *debug) { - int status; + int status; status = pqGetString(s, len, f); diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index 9248ffc4d91..4d801efd153 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: libpq-fe.h,v 1.26 1998/02/24 06:04:55 scrappy Exp $ + * $Id: libpq-fe.h,v 1.27 1998/02/26 04:45:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -138,10 +138,10 @@ extern "C" FILE *Pfin; FILE *Pfout; FILE *Pfdebug; - int sock; /* The socket */ - SockAddr laddr; /* Local address */ - SockAddr raddr; /* Remote address */ - char salt[2]; + int sock; /* The socket */ + SockAddr laddr; /* Local address */ + SockAddr raddr; /* Remote address */ + char salt[2]; int asyncNotifyWaiting; Dllist *notifyList; char *pguser; /* Postgres username of user who is @@ -224,7 +224,7 @@ extern "C" extern PGconn *PQconnectdb(const char *conninfo); extern PQconninfoOption *PQconndefaults(void); extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, - const char *pgtty, const char *dbName, const char *login, const char *pwd); + const char *pgtty, const char *dbName, const char *login, const char *pwd); #define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL) /* close the current connection and free the PGconn data structure */ extern void PQfinish(PGconn *conn); |
