*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/stringutils.c,v 1.40 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/stringutils.c,v 1.41 2005/10/15 02:49:40 momjian Exp $
*/
#include "postgres_fe.h"
bool del_quotes,
int encoding)
{
- static char *storage = NULL;/* store the local copy of the users
- * string here */
- static char *string = NULL; /* pointer into storage where to continue
- * on next call */
+ static char *storage = NULL;/* store the local copy of the users string
+ * here */
+ static char *string = NULL; /* pointer into storage where to continue on
+ * next call */
/* variously abused variables: */
unsigned int offset;
/*
* We may need extra space to insert delimiter nulls for adjacent
- * tokens. 2X the space is a gross overestimate, but it's
- * unlikely that this code will be used on huge strings anyway.
+ * tokens. 2X the space is a gross overestimate, but it's unlikely
+ * that this code will be used on huge strings anyway.
*/
storage = pg_malloc(2 * strlen(s) + 1);
strcpy(storage, s);
if (delim && strchr(delim, *start))
{
/*
- * If not at end of string, we need to insert a null to terminate
- * the returned token. We can just overwrite the next character
- * if it happens to be in the whitespace set ... otherwise move
- * over the rest of the string to make room. (This is why we
- * allocated extra space above).
+ * If not at end of string, we need to insert a null to terminate the
+ * returned token. We can just overwrite the next character if it
+ * happens to be in the whitespace set ... otherwise move over the
+ * rest of the string to make room. (This is why we allocated extra
+ * space above).
*/
p = start + 1;
if (*p != '\0')
}
/*
- * If not at end of string, we need to insert a null to terminate
- * the returned token. See notes above.
+ * If not at end of string, we need to insert a null to terminate the
+ * returned token. See notes above.
*/
if (*p != '\0')
{
}
/*
- * Otherwise no quoting character. Scan till next whitespace,
- * delimiter or quote. NB: at this point, *start is known not to be
- * '\0', whitespace, delim, or quote, so we will consume at least one
- * character.
+ * Otherwise no quoting character. Scan till next whitespace, delimiter
+ * or quote. NB: at this point, *start is known not to be '\0',
+ * whitespace, delim, or quote, so we will consume at least one character.
*/
offset = strcspn(start, whitespace);