From 3e8dbc846c55f467c4f3f46cab8286ab6762c481 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Mon, 30 May 2005 18:28:11 +0000
Subject: [PATCH] Support only octal for psql PROMPT values, rather than the
 confusing hex/decimal/octal.  Documentation already updated.

BACKWARD COMPATIBLE CHANGE
---
 src/bin/psql/common.c | 13 +------------
 src/bin/psql/common.h |  8 +-------
 src/bin/psql/prompt.c |  8 +++-----
 3 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 0feec434e20..4000c4ddd8e 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2005, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.97 2005/04/28 13:09:59 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.98 2005/05/30 18:28:11 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "common.h"
@@ -1237,17 +1237,6 @@ command_no_begin(const char *query)
 }
 
 
-char
-parse_char(char **buf)
-{
-	long		l;
-
-	l = strtol(*buf, buf, 0);
-	--*buf;
-	return (char) l;
-}
-
-
 /*
  * Test if the current user is a database superuser.
  *
diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h
index 2758165c9ba..6c18ed73e15 100644
--- a/src/bin/psql/common.h
+++ b/src/bin/psql/common.h
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2005, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.42 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.43 2005/05/30 18:28:11 momjian Exp $
  */
 #ifndef COMMON_H
 #define COMMON_H
@@ -60,12 +60,6 @@ extern bool SendQuery(const char *query);
 extern bool is_superuser(void);
 extern const char *session_username(void);
 
-/* Parse a numeric character code from the string pointed at by *buf, e.g.
- * one written as 0x0c (hexadecimal) or 015 (octal); advance *buf to the last
- * character of the numeric character code.
- */
-extern char parse_char(char **buf);
-
 extern char *expand_tilde(char **filename);
 
 #endif   /* COMMON_H */
diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c
index 9e443cb1266..68cc52c08ed 100644
--- a/src/bin/psql/prompt.c
+++ b/src/bin/psql/prompt.c
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2005, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/prompt.c,v 1.38 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/prompt.c,v 1.39 2005/05/30 18:28:11 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "prompt.h"
@@ -175,11 +175,9 @@ get_prompt(promptStatus_t status)
 				case '5':
 				case '6':
 				case '7':
-				case '8':
-				case '9':
-					*buf = parse_char((char **) &p);
+					*buf = (char) strtol(p, (char **)&p, 8);
+					--p;
 					break;
-
 				case 'R':
 					switch (status)
 					{
-- 
GitLab