diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/copy_file.c | 2 | ||||
-rw-r--r-- | libbb/get_console.c | 10 | ||||
-rw-r--r-- | libbb/get_line_from_file.c | 9 | ||||
-rw-r--r-- | libbb/login.c | 2 | ||||
-rw-r--r-- | libbb/trim.c | 8 |
5 files changed, 14 insertions, 17 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c index 700564212..a6cfe122d 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c @@ -254,7 +254,7 @@ int copy_file(const char *source, const char *dest, int flags) return -1; } if (con) { - if(setfilecon(dest, con) == -1) { + if (setfilecon(dest, con) == -1) { bb_perror_msg("setfilecon:%s,%s", dest, con); freecon(con); return -1; diff --git a/libbb/get_console.c b/libbb/get_console.c index 42ee137b9..9797ad6f0 100644 --- a/libbb/get_console.c +++ b/libbb/get_console.c @@ -50,17 +50,17 @@ int get_console_fd(void) for (fd = 2; fd >= 0; fd--) { int fd4name; - int choise_fd; + int choice_fd; char arg; fd4name = open_a_console(console_names[fd]); chk_std: - choise_fd = (fd4name >= 0 ? fd4name : fd); + choice_fd = (fd4name >= 0 ? fd4name : fd); arg = 0; - if (ioctl(choise_fd, KDGKBTYPE, &arg) == 0) - return choise_fd; - if(fd4name >= 0) { + if (ioctl(choice_fd, KDGKBTYPE, &arg) == 0) + return choice_fd; + if (fd4name >= 0) { close(fd4name); fd4name = -1; goto chk_std; diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c index 2c9608e9e..1eb4af13c 100644 --- a/libbb/get_line_from_file.c +++ b/libbb/get_line_from_file.c @@ -17,7 +17,7 @@ * end of line. If end isn't NULL, length of the chunk read is stored in it. * Return NULL if EOF/error */ -char *bb_get_chunk_from_file(FILE * file, int *end) +char *bb_get_chunk_from_file(FILE *file, int *end) { int ch; int idx = 0; @@ -27,7 +27,8 @@ char *bb_get_chunk_from_file(FILE * file, int *end) while ((ch = getc(file)) != EOF) { /* grow the line buffer as necessary */ if (idx >= linebufsz) { - linebuf = xrealloc(linebuf, linebufsz += 80); + linebufsz += 80; + linebuf = xrealloc(linebuf, linebufsz); } linebuf[idx++] = (char) ch; if (!ch || (end && ch == '\n')) @@ -49,7 +50,7 @@ char *bb_get_chunk_from_file(FILE * file, int *end) } /* Get line, including trailing \n if any */ -char *xmalloc_fgets(FILE * file) +char *xmalloc_fgets(FILE *file) { int i; @@ -57,7 +58,7 @@ char *xmalloc_fgets(FILE * file) } /* Get line. Remove trailing \n */ -char *xmalloc_getline(FILE * file) +char *xmalloc_getline(FILE *file) { int i; char *c = bb_get_chunk_from_file(file, &i); diff --git a/libbb/login.c b/libbb/login.c index 6ebb9a6a0..f3a3357bc 100644 --- a/libbb/login.c +++ b/libbb/login.c @@ -43,7 +43,7 @@ void print_login_issue(const char *issue_file, const char *tty) outbuf = buf; buf[0] = c; buf[1] = '\0'; - if(c == '\n') { + if (c == '\n') { buf[1] = '\r'; buf[2] = '\0'; } diff --git a/libbb/trim.c b/libbb/trim.c index d36391540..4957d7276 100644 --- a/libbb/trim.c +++ b/libbb/trim.c @@ -8,12 +8,8 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include <stdio.h> -#include <string.h> -#include <ctype.h> #include "libbb.h" - void trim(char *s) { size_t len = strlen(s); @@ -23,9 +19,9 @@ void trim(char *s) while (len && isspace(s[len-1])) --len; /* trim leading whitespace */ - if(len) { + if (len) { lws = strspn(s, " \n\r\t\v"); memmove(s, s + lws, len -= lws); } - s[len] = 0; + s[len] = '\0'; } |