cosmetic changes: char* x changed to char *x

submitted by: bruce
This commit is contained in:
Marc G. Fournier 1996-07-28 07:08:15 +00:00
parent 0e887c541e
commit 7450ea6dfb
4 changed files with 61 additions and 61 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.12 1996/07/28 06:59:43 scrappy Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.13 1996/07/28 07:08:13 scrappy Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -60,18 +60,18 @@ typedef struct _psqlSettings {
} PsqlSettings; } PsqlSettings;
/* declarations for functions in this file */ /* declarations for functions in this file */
static void usage(char* progname); static void usage(char *progname);
static void slashUsage(); static void slashUsage();
static void handleCopyOut(PGresult *res, bool quiet); static void handleCopyOut(PGresult *res, bool quiet);
static void handleCopyIn(PGresult *res, bool quiet); static void handleCopyIn(PGresult *res, bool quiet);
static int tableList(PsqlSettings *ps, bool deep_tablelist); static int tableList(PsqlSettings *ps, bool deep_tablelist);
static int tableDesc(PsqlSettings *ps, char *table); static int tableDesc(PsqlSettings *ps, char *table);
char* gets_noreadline(char* prompt, FILE* source); char *gets_noreadline(char *prompt, FILE *source);
char* gets_readline(char* prompt, FILE* source); char *gets_readline(char *prompt, FILE *source);
char* gets_fromFile(char* prompt, FILE* source); char *gets_fromFile(char *prompt, FILE *source);
int listAllDbs(PsqlSettings *settings); int listAllDbs(PsqlSettings *settings);
int SendQuery(PsqlSettings *settings, char* query); int SendQuery(PsqlSettings *settings, char *query);
int HandleSlashCmds(PsqlSettings *settings, int HandleSlashCmds(PsqlSettings *settings,
char *line, char *line,
char *query); char *query);
@ -82,7 +82,7 @@ void PQprint(FILE *fp,
PQprintOpt *po PQprintOpt *po
); );
FILE* setFout(PsqlSettings *ps, char *fname); FILE *setFout(PsqlSettings *ps, char *fname);
/* /*
* usage * usage
@ -90,7 +90,7 @@ FILE* setFout(PsqlSettings *ps, char *fname);
*/ */
static void static void
usage(char* progname) usage(char *progname)
{ {
fprintf(stderr,"Usage: %s [options] [dbname]\n",progname); fprintf(stderr,"Usage: %s [options] [dbname]\n",progname);
fprintf(stderr,"\t -a authsvc set authentication service\n"); fprintf(stderr,"\t -a authsvc set authentication service\n");
@ -187,7 +187,7 @@ int
listAllDbs(PsqlSettings *ps) listAllDbs(PsqlSettings *ps)
{ {
PGresult *results; PGresult *results;
char* query = "select * from pg_database;"; char *query = "select * from pg_database;";
if (!(results=PSQLexec(ps, query))) if (!(results=PSQLexec(ps, query)))
return 1; return 1;
@ -213,10 +213,10 @@ tableList (PsqlSettings *ps, bool deep_tablelist)
char listbuf[256]; char listbuf[256];
int nColumns; int nColumns;
int i; int i;
char* rk; char *rk;
char* rr; char *rr;
PGresult* res; PGresult *res;
listbuf[0] = '\0'; listbuf[0] = '\0';
strcat(listbuf,"SELECT usename, relname, relkind, relhasrules"); strcat(listbuf,"SELECT usename, relname, relkind, relhasrules");
@ -242,7 +242,7 @@ tableList (PsqlSettings *ps, bool deep_tablelist)
if ( table == NULL ) if ( table == NULL )
perror("malloc"); perror("malloc");
/* load table table*/ /* load table table */
for (i=0; i < nColumns; i++) { for (i=0; i < nColumns; i++) {
table[i] = (char *) malloc(PQgetlength(res,i,1) * sizeof(char) + 1); table[i] = (char *) malloc(PQgetlength(res,i,1) * sizeof(char) + 1);
if ( table[i] == NULL ) if ( table[i] == NULL )
@ -304,7 +304,7 @@ tableDesc (PsqlSettings *ps, char *table)
int i; int i;
int rsize; int rsize;
PGresult* res; PGresult *res;
/* Build the query */ /* Build the query */
@ -380,13 +380,13 @@ tableDesc (PsqlSettings *ps, char *table)
} }
} }
typedef char* (*READ_ROUTINE)(char* prompt, FILE* source); typedef char *(*READ_ROUTINE)(char *prompt, FILE *source);
/* gets_noreadline prompt source /* gets_noreadline prompt source
gets a line of input without calling readline, the source is ignored gets a line of input without calling readline, the source is ignored
*/ */
char* char *
gets_noreadline(char* prompt, FILE* source) gets_noreadline(char *prompt, FILE *source)
{ {
fputs(prompt, stdout); fputs(prompt, stdout);
fflush(stdout); fflush(stdout);
@ -398,8 +398,8 @@ gets_noreadline(char* prompt, FILE* source)
* the routine to get input from GNU readline(), the source is ignored * the routine to get input from GNU readline(), the source is ignored
* the prompt argument is used as the prompting string * the prompt argument is used as the prompting string
*/ */
char* char *
gets_readline(char* prompt, FILE* source) gets_readline(char *prompt, FILE *source)
{ {
return (readline(prompt)); return (readline(prompt));
} }
@ -408,12 +408,12 @@ gets_readline(char* prompt, FILE* source)
* gets_fromFile prompt source * gets_fromFile prompt source
* *
* the routine to read from a file, the prompt argument is ignored * the routine to read from a file, the prompt argument is ignored
* the source argument is a FILE* * the source argument is a FILE *
*/ */
char* char *
gets_fromFile(char* prompt, FILE* source) gets_fromFile(char *prompt, FILE *source)
{ {
char* line; char *line;
int len; int len;
line = malloc(MAX_QUERY_BUFFER+1); line = malloc(MAX_QUERY_BUFFER+1);
@ -440,8 +440,8 @@ gets_fromFile(char* prompt, FILE* source)
int int
SendQuery(PsqlSettings *settings, char *query) SendQuery(PsqlSettings *settings, char *query)
{ {
PGresult* results; PGresult *results;
PGnotify* notify; PGnotify *notify;
int status = 0; int status = 0;
if (settings->singleStep) if (settings->singleStep)
@ -610,7 +610,7 @@ decode(char *s)
*/ */
int int
HandleSlashCmds(PsqlSettings *settings, HandleSlashCmds(PsqlSettings *settings,
char* line, char *line,
char *query) char *query)
{ {
int status = 1; int status = 1;
@ -766,7 +766,7 @@ HandleSlashCmds(PsqlSettings *settings,
break; break;
case 'h': case 'h':
{ {
char* cmd; char *cmd;
int i, numCmds; int i, numCmds;
int all_help = 0; int all_help = 0;
@ -814,7 +814,7 @@ HandleSlashCmds(PsqlSettings *settings,
} }
case 'i': /* \i is include file */ case 'i': /* \i is include file */
{ {
FILE* fd; FILE *fd;
if (!optarg) { if (!optarg) {
fprintf(stderr,"\\i must be followed by a file name\n"); fprintf(stderr,"\\i must be followed by a file name\n");
@ -852,7 +852,7 @@ HandleSlashCmds(PsqlSettings *settings,
break; break;
case 'r': case 'r':
{ {
FILE* fd; FILE *fd;
static char *lastfile; static char *lastfile;
struct stat st, st2; struct stat st, st2;
if (optarg) if (optarg)
@ -974,9 +974,9 @@ HandleSlashCmds(PsqlSettings *settings,
*/ */
int int
MainLoop(PsqlSettings *settings, FILE* source) MainLoop(PsqlSettings *settings, FILE *source)
{ {
char* line; /* line of input*/ char *line; /* line of input */
int len; /* length of the line */ int len; /* length of the line */
char query[MAX_QUERY_BUFFER]; /* multi-line query storage */ char query[MAX_QUERY_BUFFER]; /* multi-line query storage */
int exitStatus = 0; int exitStatus = 0;
@ -1028,7 +1028,7 @@ MainLoop(PsqlSettings *settings, FILE* source)
/* filter out comment lines that begin with --, /* filter out comment lines that begin with --,
this could be incorrect if -- is part of a quoted string. this could be incorrect if -- is part of a quoted string.
But we won't go through the trouble of detecting that. If you have But we won't go through the trouble of detecting that. If you have
-- in your quoted string, be careful and don't start a line with it*/ -- in your quoted string, be careful and don't start a line with it */
if (line[0] == '-' && line[1] == '-') { if (line[0] == '-' && line[1] == '-') {
if (settings->singleStep) /* in single step mode, show comments */ if (settings->singleStep) /* in single step mode, show comments */
fprintf(stdout,"%s\n",line); fprintf(stdout,"%s\n",line);
@ -1106,20 +1106,20 @@ MainLoop(PsqlSettings *settings, FILE* source)
} }
int int
main(int argc, char** argv) main(int argc, char **argv)
{ {
extern char* optarg; extern char *optarg;
extern int optind; extern int optind;
char* dbname = NULL; char *dbname = NULL;
char* host = NULL; char *host = NULL;
char* port = NULL; char *port = NULL;
char* qfilename = NULL; char *qfilename = NULL;
char errbuf[ERROR_MSG_LENGTH]; char errbuf[ERROR_MSG_LENGTH];
PsqlSettings settings; PsqlSettings settings;
char* singleQuery = NULL; char *singleQuery = NULL;
bool listDatabases = 0 ; bool listDatabases = 0 ;
int exitStatus = 0; int exitStatus = 0;
@ -1358,10 +1358,10 @@ handleCopyIn(PGresult *res, bool quiet)
PQendcopy(res->conn); PQendcopy(res->conn);
} }
/* try to open fname and return a FILE*, /* try to open fname and return a FILE *,
if it fails, use stdout, instead */ if it fails, use stdout, instead */
FILE* FILE *
setFout(PsqlSettings *ps, char *fname) setFout(PsqlSettings *ps, char *fname)
{ {
if (ps->queryFout && ps->queryFout != stdout) if (ps->queryFout && ps->queryFout != stdout)

View File

@ -5,15 +5,15 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: psqlHelp.h,v 1.1.1.1 1996/07/09 06:22:15 scrappy Exp $ * $Id: psqlHelp.h,v 1.2 1996/07/28 07:08:14 scrappy Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
struct _helpStruct { struct _helpStruct {
char* cmd; /* the command name */ char *cmd; /* the command name */
char* help; /* the help associated with it */ char *help; /* the help associated with it */
char* syntax; /* the syntax associated with it */ char *syntax; /* the syntax associated with it */
} ; } ;
static struct _helpStruct QL_HELP[] = { static struct _helpStruct QL_HELP[] = {

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.1.1.1 1996/07/09 06:22:15 scrappy Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.2 1996/07/28 07:08:15 scrappy Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -21,9 +21,9 @@
/* removes whitespaces from the left, right and both sides of a string */ /* removes whitespaces from the left, right and both sides of a string */
/* MODIFIES the string passed in and returns the head of it */ /* MODIFIES the string passed in and returns the head of it */
char* leftTrim(char* s) char *leftTrim(char *s)
{ {
char* s2 = s; char *s2 = s;
int shift=0; int shift=0;
int j=0; int j=0;
@ -38,9 +38,9 @@ char* leftTrim(char* s)
return s2; return s2;
} }
char* rightTrim(char* s) char *rightTrim(char *s)
{ {
char* sEnd; char *sEnd;
sEnd = s+strlen(s)-1; sEnd = s+strlen(s)-1;
while (isspace(*sEnd)) while (isspace(*sEnd))
sEnd--; sEnd--;
@ -51,7 +51,7 @@ char* rightTrim(char* s)
return s; return s;
} }
char* doubleTrim(char* s) char *doubleTrim(char *s)
{ {
strcpy(s,leftTrim(rightTrim(s))); strcpy(s,leftTrim(rightTrim(s)));
return s; return s;
@ -59,10 +59,10 @@ char* doubleTrim(char* s)
/* dupstr : copies a string, while allocating space for it. /* dupstr : copies a string, while allocating space for it.
the CALLER is responsible for freeing the space the CALLER is responsible for freeing the space
returns NULL if the argument is NULL*/ returns NULL if the argument is NULL */
char* dupstr(char *s) char *dupstr(char *s)
{ {
char* result; char *result;
if (s == NULL) if (s == NULL)
return NULL; return NULL;
@ -76,7 +76,7 @@ char* dupstr(char *s)
#ifdef STRINGUTILS_TEST #ifdef STRINGUTILS_TEST
void testStringUtils() void testStringUtils()
{ {
static char* tests[] = {" goodbye \n", /* space on both ends */ static char *tests[] = {" goodbye \n", /* space on both ends */
"hello world", /* no spaces to trim */ "hello world", /* no spaces to trim */
"", /* empty string */ "", /* empty string */
"a", /* string with one char*/ "a", /* string with one char*/
@ -86,7 +86,7 @@ void testStringUtils()
int i=0; int i=0;
while (tests[i]!=NULL_STR) while (tests[i]!=NULL_STR)
{ {
char* t; char *t;
t = dupstr(tests[i]); t = dupstr(tests[i]);
printf("leftTrim(%s) = ",t); printf("leftTrim(%s) = ",t);
printf("%sEND\n", leftTrim(t)); printf("%sEND\n", leftTrim(t));

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: stringutils.h,v 1.1.1.1 1996/07/09 06:22:16 scrappy Exp $ * $Id: stringutils.h,v 1.2 1996/07/28 07:08:15 scrappy Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -27,14 +27,14 @@
/* removes whitespaces from the left, right and both sides of a string */ /* removes whitespaces from the left, right and both sides of a string */
/* MODIFIES the string passed in and returns the head of it */ /* MODIFIES the string passed in and returns the head of it */
extern char* leftTrim(char* s); extern char *leftTrim(char *s);
extern char* rightTrim(char* s); extern char *rightTrim(char *s);
extern char* doubleTrim(char* s); extern char *doubleTrim(char *s);
/* dupstr : copies a string, while making room for it */ /* dupstr : copies a string, while making room for it */
/* the CALLER is responsible for freeing the space */ /* the CALLER is responsible for freeing the space */
/* returns NULL if the argument is NULL */ /* returns NULL if the argument is NULL */
extern char* dupstr(char *s); extern char *dupstr(char *s);
#ifdef STRINGUTILS_TEST #ifdef STRINGUTILS_TEST
extern void testStringUtils(); extern void testStringUtils();