diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-12 00:32:05 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-12 00:32:05 +0000 |
commit | 51742f4bb0c57a4d5063ece9437a2f34a42e52c8 (patch) | |
tree | 7a912fc65ff43bdb09078d75bfc02ad8f5380b47 /libbb | |
parent | 50f7f446ecaadef6895a4ee601567e0b68330637 (diff) | |
download | busybox-w32-51742f4bb0c57a4d5063ece9437a2f34a42e52c8.tar.gz busybox-w32-51742f4bb0c57a4d5063ece9437a2f34a42e52c8.tar.bz2 busybox-w32-51742f4bb0c57a4d5063ece9437a2f34a42e52c8.zip |
style fixes. No code changes
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) | |||
254 | return -1; | 254 | return -1; |
255 | } | 255 | } |
256 | if (con) { | 256 | if (con) { |
257 | if(setfilecon(dest, con) == -1) { | 257 | if (setfilecon(dest, con) == -1) { |
258 | bb_perror_msg("setfilecon:%s,%s", dest, con); | 258 | bb_perror_msg("setfilecon:%s,%s", dest, con); |
259 | freecon(con); | 259 | freecon(con); |
260 | return -1; | 260 | 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) | |||
50 | 50 | ||
51 | for (fd = 2; fd >= 0; fd--) { | 51 | for (fd = 2; fd >= 0; fd--) { |
52 | int fd4name; | 52 | int fd4name; |
53 | int choise_fd; | 53 | int choice_fd; |
54 | char arg; | 54 | char arg; |
55 | 55 | ||
56 | fd4name = open_a_console(console_names[fd]); | 56 | fd4name = open_a_console(console_names[fd]); |
57 | chk_std: | 57 | chk_std: |
58 | choise_fd = (fd4name >= 0 ? fd4name : fd); | 58 | choice_fd = (fd4name >= 0 ? fd4name : fd); |
59 | 59 | ||
60 | arg = 0; | 60 | arg = 0; |
61 | if (ioctl(choise_fd, KDGKBTYPE, &arg) == 0) | 61 | if (ioctl(choice_fd, KDGKBTYPE, &arg) == 0) |
62 | return choise_fd; | 62 | return choice_fd; |
63 | if(fd4name >= 0) { | 63 | if (fd4name >= 0) { |
64 | close(fd4name); | 64 | close(fd4name); |
65 | fd4name = -1; | 65 | fd4name = -1; |
66 | goto chk_std; | 66 | 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 @@ | |||
17 | * end of line. If end isn't NULL, length of the chunk read is stored in it. | 17 | * end of line. If end isn't NULL, length of the chunk read is stored in it. |
18 | * Return NULL if EOF/error */ | 18 | * Return NULL if EOF/error */ |
19 | 19 | ||
20 | char *bb_get_chunk_from_file(FILE * file, int *end) | 20 | char *bb_get_chunk_from_file(FILE *file, int *end) |
21 | { | 21 | { |
22 | int ch; | 22 | int ch; |
23 | int idx = 0; | 23 | int idx = 0; |
@@ -27,7 +27,8 @@ char *bb_get_chunk_from_file(FILE * file, int *end) | |||
27 | while ((ch = getc(file)) != EOF) { | 27 | while ((ch = getc(file)) != EOF) { |
28 | /* grow the line buffer as necessary */ | 28 | /* grow the line buffer as necessary */ |
29 | if (idx >= linebufsz) { | 29 | if (idx >= linebufsz) { |
30 | linebuf = xrealloc(linebuf, linebufsz += 80); | 30 | linebufsz += 80; |
31 | linebuf = xrealloc(linebuf, linebufsz); | ||
31 | } | 32 | } |
32 | linebuf[idx++] = (char) ch; | 33 | linebuf[idx++] = (char) ch; |
33 | if (!ch || (end && ch == '\n')) | 34 | if (!ch || (end && ch == '\n')) |
@@ -49,7 +50,7 @@ char *bb_get_chunk_from_file(FILE * file, int *end) | |||
49 | } | 50 | } |
50 | 51 | ||
51 | /* Get line, including trailing \n if any */ | 52 | /* Get line, including trailing \n if any */ |
52 | char *xmalloc_fgets(FILE * file) | 53 | char *xmalloc_fgets(FILE *file) |
53 | { | 54 | { |
54 | int i; | 55 | int i; |
55 | 56 | ||
@@ -57,7 +58,7 @@ char *xmalloc_fgets(FILE * file) | |||
57 | } | 58 | } |
58 | 59 | ||
59 | /* Get line. Remove trailing \n */ | 60 | /* Get line. Remove trailing \n */ |
60 | char *xmalloc_getline(FILE * file) | 61 | char *xmalloc_getline(FILE *file) |
61 | { | 62 | { |
62 | int i; | 63 | int i; |
63 | char *c = bb_get_chunk_from_file(file, &i); | 64 | 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) | |||
43 | outbuf = buf; | 43 | outbuf = buf; |
44 | buf[0] = c; | 44 | buf[0] = c; |
45 | buf[1] = '\0'; | 45 | buf[1] = '\0'; |
46 | if(c == '\n') { | 46 | if (c == '\n') { |
47 | buf[1] = '\r'; | 47 | buf[1] = '\r'; |
48 | buf[2] = '\0'; | 48 | buf[2] = '\0'; |
49 | } | 49 | } |
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 @@ | |||
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <stdio.h> | ||
12 | #include <string.h> | ||
13 | #include <ctype.h> | ||
14 | #include "libbb.h" | 11 | #include "libbb.h" |
15 | 12 | ||
16 | |||
17 | void trim(char *s) | 13 | void trim(char *s) |
18 | { | 14 | { |
19 | size_t len = strlen(s); | 15 | size_t len = strlen(s); |
@@ -23,9 +19,9 @@ void trim(char *s) | |||
23 | while (len && isspace(s[len-1])) --len; | 19 | while (len && isspace(s[len-1])) --len; |
24 | 20 | ||
25 | /* trim leading whitespace */ | 21 | /* trim leading whitespace */ |
26 | if(len) { | 22 | if (len) { |
27 | lws = strspn(s, " \n\r\t\v"); | 23 | lws = strspn(s, " \n\r\t\v"); |
28 | memmove(s, s + lws, len -= lws); | 24 | memmove(s, s + lws, len -= lws); |
29 | } | 25 | } |
30 | s[len] = 0; | 26 | s[len] = '\0'; |
31 | } | 27 | } |