aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2000-06-29 16:27:57 +0000
committerBruce Momjian <bruce@momjian.us>2000-06-29 16:27:57 +0000
commitc9ec78a6b89e846c5b1be0aa40b6532ca209c850 (patch)
treed1c0d9b7179523852168b09c9b99dfa10513545e
parent43ba1b4420eca0bf227ad2bae87f7955093e1cc0 (diff)
downloadpostgresql-c9ec78a6b89e846c5b1be0aa40b6532ca209c850.tar.gz
postgresql-c9ec78a6b89e846c5b1be0aa40b6532ca209c850.zip
Fix quotes in /* */ comments in psql.
-rw-r--r--src/bin/psql/mainloop.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c
index bc229944444..d53efaeadc9 100644
--- a/src/bin/psql/mainloop.c
+++ b/src/bin/psql/mainloop.c
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.30 2000/05/12 16:13:44 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.31 2000/06/29 16:27:57 momjian Exp $
*/
#include "postgres.h"
#include "mainloop.h"
@@ -18,9 +18,7 @@
#ifndef WIN32
#include <setjmp.h>
-
sigjmp_buf main_loop_jmp;
-
#endif
@@ -298,18 +296,13 @@ MainLoop(FILE *source)
bslash_count = 0;
rescan:
- /* in quote? */
- if (in_quote)
+ /* start of extended comment? */
+ if (line[i] == '/' && line[i + thislen] == '*')
{
- /* end of quote */
- if (line[i] == in_quote && bslash_count % 2 == 0)
- in_quote = '\0';
+ xcomment = true;
+ ADVANCE_1;
}
- /* start of quote */
- else if (!was_bslash && (line[i] == '\'' || line[i] == '"'))
- in_quote = line[i];
-
/* in extended comment? */
else if (xcomment)
{
@@ -320,13 +313,6 @@ MainLoop(FILE *source)
}
}
- /* start of extended comment? */
- else if (line[i] == '/' && line[i + thislen] == '*')
- {
- xcomment = true;
- ADVANCE_1;
- }
-
/* single-line comment? truncate line */
else if (line[i] == '-' && line[i + thislen] == '-')
{
@@ -334,6 +320,19 @@ MainLoop(FILE *source)
break;
}
+ /* in quote? */
+ else if (in_quote)
+ {
+ /* end of quote */
+ if (line[i] == in_quote && bslash_count % 2 == 0)
+ in_quote = '\0';
+ }
+
+ /* start of quote */
+ else if (!was_bslash &&
+ (line[i] == '\'' || line[i] == '"'))
+ in_quote = line[i];
+
/* count nested parentheses */
else if (line[i] == '(')
paren_level++;