logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: 11168faf435e8692f523ddc18a622dccf8d34ceb
parent bf95244b9ef457f0d5167fdf1ca285319f055022
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 10 Feb 2022 01:08:55 +0100

bin/sizeof.c: make format

Diffstat:

Mbin/sizeof.c2+-
Mbin/xcd.c15++++++++++++---
2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/bin/sizeof.c b/bin/sizeof.c @@ -4,9 +4,9 @@ #define _POSIX_C_SOURCE 200809L #include <limits.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include <stdint.h> static const char *format = "sizeof(%s) == %d bytes; %d bits\n"; static const char *format_m = "sizeof(%s) == %d bytes; %d bits; (MIN:MAX) == (%d:%d)\n"; diff --git a/bin/xcd.c b/bin/xcd.c @@ -55,7 +55,11 @@ print_plain_rgb(char *line, size_t len) for(size_t i = 0; i < len; i++) { struct rgb color = rgb_char((unsigned char)line[i]); - printf("[38;2;%d;%d;%dm%c", (int)color.red, (int)color.green, (int)color.blue, isprint(line[i]) ? line[i] : '.'); + printf("[38;2;%d;%d;%dm%c", + (int)color.red, + (int)color.green, + (int)color.blue, + isprint(line[i]) ? line[i] : '.'); } LANODAN_XCD_RESET @@ -88,7 +92,11 @@ concat(FILE *stream) memset(&line, 0, WIDTH); pos_rgb = rgb_char((unsigned char)bytes); - printf("\n[38;2;%d;%d;%dm%06x ", (int)pos_rgb.red, (int)pos_rgb.green, (int)pos_rgb.blue, bytes); + printf("\n[38;2;%d;%d;%dm%06x ", + (int)pos_rgb.red, + (int)pos_rgb.green, + (int)pos_rgb.blue, + bytes); cols = 0; } @@ -108,7 +116,8 @@ concat(FILE *stream) print_plain_rgb(line, (size_t)cols); pos_rgb = rgb_char((unsigned char)bytes); - printf("\n[38;2;%d;%d;%dm%06x\n", (int)pos_rgb.red, (int)pos_rgb.green, (int)pos_rgb.blue, bytes); + printf( + "\n[38;2;%d;%d;%dm%06x\n", (int)pos_rgb.red, (int)pos_rgb.green, (int)pos_rgb.blue, bytes); LANODAN_XCD_RESET return 0;