about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/options.c1
-rw-r--r--Src/params.c7
-rw-r--r--Src/zsh.h1
3 files changed, 8 insertions, 1 deletions
diff --git a/Src/options.c b/Src/options.c
index 0bbe6b844..8660ade68 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -90,6 +90,7 @@ static struct optname optns[] = {
 {NULL, "bgnice",	      OPT_EMULATE|OPT_NONBOURNE, BGNICE},
 {NULL, "braceccl",	      OPT_EMULATE,		 BRACECCL},
 {NULL, "bsdecho",	      OPT_EMULATE|OPT_SH,	 BSDECHO},
+{NULL, "cbases",	      0,			 CBASES},
 {NULL, "cdablevars",	      OPT_EMULATE,		 CDABLEVARS},
 {NULL, "chasedots",	      OPT_EMULATE,		 CHASEDOTS},
 {NULL, "chaselinks",	      OPT_EMULATE,		 CHASELINKS},
diff --git a/Src/params.c b/Src/params.c
index 9ef3e61ca..1439e9af8 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3045,7 +3045,12 @@ convbase(char *s, zlong v, int base)
 	base = 10;
 
     if (base != 10) {
-	sprintf(s, "%d#", base);
+	if (isset(CBASES) && base == 16)
+	    sprintf(s, "0x");
+	else if (isset(CBASES) && base == 8 && isset(OCTALZEROES))
+	    sprintf(s, "0");
+	else
+	    sprintf(s, "%d#", base);
 	s += strlen(s);
     }
     for (x = v; x; digs++)
diff --git a/Src/zsh.h b/Src/zsh.h
index bf59641b5..cdb90e264 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1326,6 +1326,7 @@ enum {
     BGNICE,
     BRACECCL,
     BSDECHO,
+    CBASES,
     CDABLEVARS,
     CHASEDOTS,
     CHASELINKS,