From b033314bf1901d436dc71d41d5e1f37dda47e511 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 12 Dec 2024 16:03:08 +0100 Subject: formatting: Use clang-format on all projects This commit also add braces to all `if` statements. --- userland/minibox/utilities/cat.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'userland/minibox/utilities/cat.c') diff --git a/userland/minibox/utilities/cat.c b/userland/minibox/utilities/cat.c index 736aee6..a425392 100644 --- a/userland/minibox/utilities/cat.c +++ b/userland/minibox/utilities/cat.c @@ -13,10 +13,12 @@ int fd_to_stdout(int fd) { int rc; for (char buffer[CAT_BUFFER]; (rc = read(fd, &buffer, sizeof(buffer)));) { - if (-1 == rc) + if (-1 == rc) { return 0; - if (-1 == write(fd_stdout, buffer, rc)) + } + if (-1 == write(fd_stdout, buffer, rc)) { return 0; + } } return 1; } @@ -35,8 +37,9 @@ int cat_main(int argc, char **argv) { // If a file is '-', the cat utility shall read from the standard // input at that point in the sequence. if (0 == strcmp(*argv, "-")) { - if (!fd_to_stdout(0)) + if (!fd_to_stdout(0)) { return 1; + } continue; } @@ -46,8 +49,9 @@ int cat_main(int argc, char **argv) { perror(*argv); return 1; } - if (!fd_to_stdout(fd)) + if (!fd_to_stdout(fd)) { return 1; + } close(fd); } return 0; -- cgit v1.2.3