aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2003-03-20 22:08:50 +0000
committerBruce Momjian <bruce@momjian.us>2003-03-20 22:08:50 +0000
commit5ae424529b1bb9bf36eddbec57c7ba887698371e (patch)
tree2d309922a251ae4905fe114653e80b59b7de1976
parente5f5e73fcbfcc33989ea4405f7f7e1da38cc5fc5 (diff)
downloadpostgresql-5ae424529b1bb9bf36eddbec57c7ba887698371e.tar.gz
postgresql-5ae424529b1bb9bf36eddbec57c7ba887698371e.zip
Fix multiline C comments in psql.
-rw-r--r--src/bin/psql/mainloop.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c
index 27b5a560d5f..1d0392e96ef 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.53 2003/03/20 06:43:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.54 2003/03/20 22:08:50 momjian Exp $
*/
#include "postgres_fe.h"
#include "mainloop.h"
@@ -272,21 +272,24 @@ MainLoop(FILE *source)
/* start of extended comment? */
else if (line[i] == '/' && line[i + thislen] == '*')
- {
+ {
in_xcomment++;
if (in_xcomment == 1)
- ADVANCE_1;
- }
+ ADVANCE_1;
+ }
- /* end of extended comment? */
- else if (line[i] == '*' && line[i + thislen] == '/')
+ /* in or end of extended comment? */
+ else if (in_xcomment)
{
- in_xcomment--;
- if (in_xcomment <= 0)
+ if (line[i] == '*' && line[i + thislen] == '/')
{
- in_xcomment = 0;
- ADVANCE_1;
- }
+ in_xcomment--;
+ if (in_xcomment <= 0)
+ {
+ in_xcomment = 0;
+ ADVANCE_1;
+ }
+ }
}
/* start of quote? */