aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-28 15:03:07 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-28 15:03:07 -0400
commita259384b6b07b3b8928ea94e2546eaa0570f29aa (patch)
treec3597bc5afdb308908dcdb4eef4a7a5cefc67741
parent0519a71688b6bc026847d5ed47274d1fcc5c391b (diff)
Remove uppercase octal
-rw-r--r--src/parse.c8
-rw-r--r--src/stdlib/print.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/src/parse.c b/src/parse.c
index b7124c5d..71bd49fd 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -6,7 +6,15 @@
#include <stdarg.h>
#include <stdbool.h>
#include <string.h>
+
+#ifndef __GLIBC__
+#define __GLIBC__ 2
+#include <unistr.h>
+#undef __GLIBC__
+#else
#include <unistr.h>
+#endif
+
#include <unictype.h>
#include <uniname.h>
#include <signal.h>
diff --git a/src/stdlib/print.h b/src/stdlib/print.h
index 16400e7d..35664926 100644
--- a/src/stdlib/print.h
+++ b/src/stdlib/print.h
@@ -70,7 +70,6 @@ typedef struct {
typedef struct {
uint64_t n;
bool no_prefix;
- bool uppercase;
int digits;
} oct_format_t;
#define oct(x, ...) ((oct_format_t){.n=x, __VA_ARGS__})
@@ -104,7 +103,7 @@ PRINT_FN _print_hex(FILE *f, hex_format_t hex) {
return fprintf(f, hex.no_prefix ? (hex.uppercase ? hl("%0*lX") : hl("%0*lx")) : (hex.uppercase ? hl("0x%0*lX") : hl("%#0*lx")), hex.digits, hex.n);
}
PRINT_FN _print_oct(FILE *f, oct_format_t oct) {
- return fprintf(f, oct.no_prefix ? (oct.uppercase ? hl("%0*lO") : hl("%0*lo")) : (oct.uppercase ? hl("%#0*lO") : hl("%#0*lo")), oct.digits, oct.n);
+ return fprintf(f, oct.no_prefix ? hl("%0*lo") : hl("%#0*lo"), oct.digits, oct.n);
}
PRINT_FN _print_num_format(FILE *f, num_format_t num) {
return fprintf(f, hl("%.*lf"), num.precision, num.n);