logo

utils-extra

Collection of extra tools for Unixes git clone https://anongit.hacktivis.me/git/utils-extra.git/
commit: 0348eb07fd9ad5994a5e318ce1bec0f4c38781a8
parent ab267e25eac344209100c7057670afed57b07bd9
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu,  1 Jan 2026 07:33:33 +0100

cmd/pat: use bold for readability

Diffstat:

Mcmd/pat.c16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/cmd/pat.c b/cmd/pat.c @@ -11,27 +11,27 @@ int files = 1; -int +static int concat(int fd, const char *fdname) { ssize_t c; - char buf[BUFSIZ]; + static char buf[BUFSIZ]; // File Number as an escape/containment solution - printf("\n### File %d << %s >> ###\n", files++, fdname); + printf("\n\033[1m### File %d << %s >> ###\033[0m\n", files++, fdname); while((c = read(fd, buf, sizeof(buf))) > 0) { if(fwrite(buf, (size_t)c, 1, stdout) < 0) { - fprintf(stderr, "pat: Error writing: %s\n", strerror(errno)); + fprintf(stderr, "pat: error: Failed writing to stdout: %s\n", strerror(errno)); return 1; } } if(c < 0) { - fprintf(stderr, "pat: Error reading ‘%s’: %s\n", fdname, strerror(errno)); + fprintf(stderr, "pat: error: Failed reading file ‘%s’: %s\n", fdname, strerror(errno)); return 1; } @@ -48,7 +48,7 @@ main(int argc, char *argv[]) } // no \n, concat starts with one - printf("### %d Files ###", argc - 1); + printf("\033[1m### %d Files ###\033[0m", argc - 1); for(int argi = 1; argi < argc; argi++) { @@ -68,7 +68,7 @@ main(int argc, char *argv[]) int fd = open(argv[argi], O_RDONLY); if(fd < 0) { - fprintf(stderr, "pat: Error opening ‘%s’: %s\n", argv[argi], strerror(errno)); + fprintf(stderr, "pat: error: Failed opening file ‘%s’: %s\n", argv[argi], strerror(errno)); return 1; } @@ -79,7 +79,7 @@ main(int argc, char *argv[]) if(close(fd) < 0) { - fprintf(stderr, "pat: Error closing ‘%s’: %s\n", argv[argi], strerror(errno)); + fprintf(stderr, "pat: error: Failed closing file ‘%s’: %s\n", argv[argi], strerror(errno)); return 1; } }