Remove uppercase octal
This commit is contained in:
parent
0519a71688
commit
a259384b6b
@ -6,7 +6,15 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef __GLIBC__
|
||||||
|
#define __GLIBC__ 2
|
||||||
#include <unistr.h>
|
#include <unistr.h>
|
||||||
|
#undef __GLIBC__
|
||||||
|
#else
|
||||||
|
#include <unistr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unictype.h>
|
#include <unictype.h>
|
||||||
#include <uniname.h>
|
#include <uniname.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -70,7 +70,6 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t n;
|
uint64_t n;
|
||||||
bool no_prefix;
|
bool no_prefix;
|
||||||
bool uppercase;
|
|
||||||
int digits;
|
int digits;
|
||||||
} oct_format_t;
|
} oct_format_t;
|
||||||
#define oct(x, ...) ((oct_format_t){.n=x, __VA_ARGS__})
|
#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);
|
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) {
|
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) {
|
PRINT_FN _print_num_format(FILE *f, num_format_t num) {
|
||||||
return fprintf(f, hl("%.*lf"), num.precision, num.n);
|
return fprintf(f, hl("%.*lf"), num.precision, num.n);
|
||||||
|
Loading…
Reference in New Issue
Block a user