From db0dd02d558b001c22ace501712dd8ab97ab7398 Mon Sep 17 00:00:00 2001 From: emma Date: Fri, 12 Jul 2024 15:32:30 -0600 Subject: [PATCH] dj(1): more formatting --- src/dj.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/dj.c b/src/dj.c index 9edee0f..c0ae9cc 100644 --- a/src/dj.c +++ b/src/dj.c @@ -138,9 +138,7 @@ static long parse(char *s){ errno = 0; r = strtol(s, &s, 0); - return (*s == '\0' /* no chars left unparsed */ && errno == 0) - ? r - : -1; + return (*s == '\0' && errno == 0) ? r : -1; /* no chars left unparsed */ } static int usage(char *s){ @@ -197,10 +195,10 @@ int main(int argc, char *argv[]) { } else { int fd; - if (( - fd = open(optarg, io[i].fl, creat_mode)) != -1 - && (fdisstd(io[i].fd) || close(io[i].fd) == 0 - )) { + if ( + (fd = open(optarg, io[i].fl, creat_mode)) != -1 + && (fdisstd(io[i].fd) || close(io[i].fd) == 0) + ) { io[i].fd = fd; io[i].fn = optarg; break; @@ -224,10 +222,10 @@ int main(int argc, char *argv[]) { i = (c >= 'A' && c <= 'Z'); c |= 0b00100000; /* (ASCII) make lowercase */ - if(( - c == 'b' && (io[i].bs = parse(optarg)) > 0) - || (c == 's' && (io[i].seek = parse(optarg)) >= 0 - )) { break; } + if ( + (c == 'b' && (io[i].bs = parse(optarg)) > 0) + || (c == 's' && (io[i].seek = parse(optarg)) >= 0) + ) { break; } /* FALLTHROUGH */ default: @@ -243,8 +241,10 @@ int main(int argc, char *argv[]) { for (i = 0; i < (sizeof io) / (sizeof *io); ++i) { /* buffer allocation */ if ((io[i].buf = malloc(io[i].bs * (sizeof *(io[i].buf)))) == NULL) { - fprintf(stderr, "%s: Failed to allocate %zd bytes\n", - program_name, io[i].bs); + fprintf( + stderr, "%s: Failed to allocate %zd bytes\n", + program_name, io[i].bs + ); return EX_OSERR; }