diff options
author | Freya Murphy <freya@freyacat.org> | 2024-02-03 21:38:57 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-02-03 21:39:02 -0500 |
commit | 61e7fdf1eb7d5d4a66c443fe6bd16fd2a2a92859 (patch) | |
tree | 757350208c44ac1e639dc7095d3e80eedc6cd74a /src/print.c | |
parent | formatting (diff) | |
download | corn-61e7fdf1eb7d5d4a66c443fe6bd16fd2a2a92859.tar.gz corn-61e7fdf1eb7d5d4a66c443fe6bd16fd2a2a92859.tar.bz2 corn-61e7fdf1eb7d5d4a66c443fe6bd16fd2a2a92859.zip |
acpi table loading and shutdown works, plus mmap fix :3
Diffstat (limited to 'src/print.c')
-rw-r--r-- | src/print.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/print.c b/src/print.c index 8cab6e4..a7ce5f6 100644 --- a/src/print.c +++ b/src/print.c @@ -95,6 +95,7 @@ static enum printtype conversion_to_printtype(enum format_conversion conversion) return OCTAL; case FMT_HEX: case FMT_HEX_UPPER: + case FMT_PTR: return HEX; default: return NONE; @@ -377,11 +378,12 @@ static void print_number_buffer( const char *buf, // buffer containing the text we want to print struct spacing spacing, // the spacing on the left right and middle enum printtype type, - enum charcase cc + enum charcase cc, + enum format_flag flags ) { // put the 0x at the start of the string - if (spacing.left && spacing.zero && type == HEX) { + if (spacing.left && spacing.zero && type == HEX && (flags & FLG_ALTERNATE)) { if (cc == UPPERCASE) { kputs("0X"); } else { @@ -389,7 +391,7 @@ static void print_number_buffer( } } - if ((!spacing.left || !spacing.zero) && type == OCTAL) { + if ((!spacing.left || !spacing.zero) && type == OCTAL && (flags & FLG_ALTERNATE)) { kputc('0'); } @@ -397,7 +399,7 @@ static void print_number_buffer( spacing.zero ? kputc('0') : kputc(' '); } - if ((!spacing.left || !spacing.zero) && type == HEX) { + if ((!spacing.left || !spacing.zero) && type == HEX && (flags & FLG_ALTERNATE)) { if (cc == UPPERCASE) { kputs("0X"); } else { @@ -457,18 +459,18 @@ static struct spacing get_spacing( } unsigned gap = 0; - if (max > length) { - gap = max - length; + if (min > length) { + gap = min - length; } spacing.length = length; if (flags & FLG_LEFT_ALIGN) { - spacing.left = gap; - spacing.right = 0; - } else { spacing.left = 0; spacing.right = gap; + } else { + spacing.left = gap; + spacing.right = 0; } spacing.zero = (flags & FLG_ZERO); @@ -574,7 +576,7 @@ static void print_signed_number( unsigned length = strlen(ptr); struct spacing spacing = get_spacing(width, precision, flags, length); - print_number_buffer(ptr, spacing, type, cc); + print_number_buffer(ptr, spacing, type, cc, flags); } static void print_unsigned_number( @@ -591,7 +593,7 @@ static void print_unsigned_number( unsigned length = strlen(ptr); struct spacing spacing = get_spacing(width, precision, flags, length); - print_number_buffer(ptr, spacing, type, cc); + print_number_buffer(ptr, spacing, type, cc, flags); } static bool is_conversion_number(enum format_conversion conversion) { |