diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-26 20:04:27 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-26 20:04:27 +0000 |
commit | 8ee649a02e97e9d4e770a8138ba94c0f3ddd8055 (patch) | |
tree | cf13ce448542a36595264ad53397a0633ffedcc8 | |
parent | ce7eb4443cc90038aabc19a8b7b8f25e4b88892e (diff) | |
download | busybox-w32-8ee649a02e97e9d4e770a8138ba94c0f3ddd8055.tar.gz busybox-w32-8ee649a02e97e9d4e770a8138ba94c0f3ddd8055.tar.bz2 busybox-w32-8ee649a02e97e9d4e770a8138ba94c0f3ddd8055.zip |
*: more uniform naming: s/xmalloc_getline/xmalloc_fgetline/
-rw-r--r-- | archival/dpkg.c | 2 | ||||
-rw-r--r-- | archival/tar.c | 2 | ||||
-rw-r--r-- | coreutils/cut.c | 2 | ||||
-rw-r--r-- | coreutils/md5_sha1_sum.c | 2 | ||||
-rw-r--r-- | coreutils/sort.c | 4 | ||||
-rw-r--r-- | coreutils/uniq.c | 2 | ||||
-rw-r--r-- | coreutils/uudecode.c | 4 | ||||
-rw-r--r-- | e2fsprogs/fsck.c | 2 | ||||
-rw-r--r-- | editors/patch.c | 4 | ||||
-rw-r--r-- | editors/sed.c | 4 | ||||
-rw-r--r-- | findutils/grep.c | 4 | ||||
-rw-r--r-- | include/libbb.h | 15 | ||||
-rw-r--r-- | include/usage.h | 2 | ||||
-rw-r--r-- | libbb/get_line_from_file.c | 2 | ||||
-rw-r--r-- | libbb/lineedit.c | 2 | ||||
-rw-r--r-- | libbb/read.c | 11 | ||||
-rw-r--r-- | loginutils/addgroup.c | 2 | ||||
-rw-r--r-- | loginutils/chpasswd.c | 2 | ||||
-rw-r--r-- | loginutils/cryptpw.c | 2 | ||||
-rw-r--r-- | miscutils/dc.c | 2 | ||||
-rw-r--r-- | miscutils/makedevs.c | 2 | ||||
-rw-r--r-- | networking/ifupdown.c | 6 | ||||
-rw-r--r-- | networking/sendmail.c | 4 | ||||
-rw-r--r-- | util-linux/hexdump.c | 4 | ||||
-rw-r--r-- | util-linux/mdev.c | 2 | ||||
-rw-r--r-- | util-linux/mount.c | 2 |
26 files changed, 48 insertions, 44 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 7693342f7..1280ca03d 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -1162,7 +1162,7 @@ static char **create_list(const char *filename) | |||
1162 | return NULL; | 1162 | return NULL; |
1163 | } | 1163 | } |
1164 | 1164 | ||
1165 | while ((line = xmalloc_getline(list_stream)) != NULL) { | 1165 | while ((line = xmalloc_fgetline(list_stream)) != NULL) { |
1166 | file_list = xrealloc(file_list, sizeof(char *) * (count + 2)); | 1166 | file_list = xrealloc(file_list, sizeof(char *) * (count + 2)); |
1167 | file_list[count] = line; | 1167 | file_list[count] = line; |
1168 | count++; | 1168 | count++; |
diff --git a/archival/tar.c b/archival/tar.c index 7bd79552e..0c90ac07e 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -660,7 +660,7 @@ static llist_t *append_file_list_to_list(llist_t *list) | |||
660 | tmp = cur; | 660 | tmp = cur; |
661 | cur = cur->link; | 661 | cur = cur->link; |
662 | free(tmp); | 662 | free(tmp); |
663 | while ((line = xmalloc_getline(src_stream)) != NULL) { | 663 | while ((line = xmalloc_fgetline(src_stream)) != NULL) { |
664 | /* kill trailing '/' unless the string is just "/" */ | 664 | /* kill trailing '/' unless the string is just "/" */ |
665 | char *cp = last_char_is(line, '/'); | 665 | char *cp = last_char_is(line, '/'); |
666 | if (cp > line) | 666 | if (cp > line) |
diff --git a/coreutils/cut.c b/coreutils/cut.c index e617ef28f..7a44d1088 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -51,7 +51,7 @@ static void cut_file(FILE *file, char delim) | |||
51 | unsigned int linenum = 0; /* keep these zero-based to be consistent */ | 51 | unsigned int linenum = 0; /* keep these zero-based to be consistent */ |
52 | 52 | ||
53 | /* go through every line in the file */ | 53 | /* go through every line in the file */ |
54 | while ((line = xmalloc_getline(file)) != NULL) { | 54 | while ((line = xmalloc_fgetline(file)) != NULL) { |
55 | 55 | ||
56 | /* set up a list so we can keep track of what's been printed */ | 56 | /* set up a list so we can keep track of what's been printed */ |
57 | char * printed = xzalloc(strlen(line) * sizeof(char)); | 57 | char * printed = xzalloc(strlen(line) * sizeof(char)); |
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 080eac5f4..2e1c96459 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c | |||
@@ -115,7 +115,7 @@ int md5_sha1_sum_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
115 | 115 | ||
116 | pre_computed_stream = xfopen_stdin(argv[0]); | 116 | pre_computed_stream = xfopen_stdin(argv[0]); |
117 | 117 | ||
118 | while ((line = xmalloc_getline(pre_computed_stream)) != NULL) { | 118 | while ((line = xmalloc_fgetline(pre_computed_stream)) != NULL) { |
119 | char *filename_ptr; | 119 | char *filename_ptr; |
120 | 120 | ||
121 | count_total++; | 121 | count_total++; |
diff --git a/coreutils/sort.c b/coreutils/sort.c index 15566ce2b..a54be7269 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -150,9 +150,9 @@ static struct sort_key *add_key(void) | |||
150 | #define GET_LINE(fp) \ | 150 | #define GET_LINE(fp) \ |
151 | ((option_mask32 & FLAG_z) \ | 151 | ((option_mask32 & FLAG_z) \ |
152 | ? bb_get_chunk_from_file(fp, NULL) \ | 152 | ? bb_get_chunk_from_file(fp, NULL) \ |
153 | : xmalloc_getline(fp)) | 153 | : xmalloc_fgetline(fp)) |
154 | #else | 154 | #else |
155 | #define GET_LINE(fp) xmalloc_getline(fp) | 155 | #define GET_LINE(fp) xmalloc_fgetline(fp) |
156 | #endif | 156 | #endif |
157 | 157 | ||
158 | /* Iterate through keys list and perform comparisons */ | 158 | /* Iterate through keys list and perform comparisons */ |
diff --git a/coreutils/uniq.c b/coreutils/uniq.c index d0729607c..32327c6ce 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c | |||
@@ -71,7 +71,7 @@ int uniq_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
71 | dups = 0; | 71 | dups = 0; |
72 | 72 | ||
73 | /* gnu uniq ignores newlines */ | 73 | /* gnu uniq ignores newlines */ |
74 | while ((s1 = xmalloc_getline(in)) != NULL) { | 74 | while ((s1 = xmalloc_fgetline(in)) != NULL) { |
75 | e1 = s1; | 75 | e1 = s1; |
76 | for (i = skip_fields; i; i--) { | 76 | for (i = skip_fields; i; i--) { |
77 | e1 = skip_whitespace(e1); | 77 | e1 = skip_whitespace(e1); |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 4c619dec5..c06747622 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -18,7 +18,7 @@ static void read_stduu(FILE *src_stream, FILE *dst_stream) | |||
18 | { | 18 | { |
19 | char *line; | 19 | char *line; |
20 | 20 | ||
21 | while ((line = xmalloc_getline(src_stream)) != NULL) { | 21 | while ((line = xmalloc_fgetline(src_stream)) != NULL) { |
22 | int encoded_len, str_len; | 22 | int encoded_len, str_len; |
23 | char *line_ptr, *dst; | 23 | char *line_ptr, *dst; |
24 | 24 | ||
@@ -151,7 +151,7 @@ int uudecode_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
151 | src_stream = xfopen_stdin(*argv); | 151 | src_stream = xfopen_stdin(*argv); |
152 | 152 | ||
153 | /* Search for the start of the encoding */ | 153 | /* Search for the start of the encoding */ |
154 | while ((line = xmalloc_getline(src_stream)) != NULL) { | 154 | while ((line = xmalloc_fgetline(src_stream)) != NULL) { |
155 | void (*decode_fn_ptr)(FILE * src, FILE * dst); | 155 | void (*decode_fn_ptr)(FILE * src, FILE * dst); |
156 | char *line_ptr; | 156 | char *line_ptr; |
157 | FILE *dst_stream; | 157 | FILE *dst_stream; |
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 178792f6f..0707d295d 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c | |||
@@ -391,7 +391,7 @@ static void load_fs_info(const char *filename) | |||
391 | } | 391 | } |
392 | while (1) { | 392 | while (1) { |
393 | int r; | 393 | int r; |
394 | char *buf = xmalloc_getline(f); | 394 | char *buf = xmalloc_fgetline(f); |
395 | if (!buf) break; | 395 | if (!buf) break; |
396 | r = parse_fstab_line(buf, &fs); | 396 | r = parse_fstab_line(buf, &fs); |
397 | free(buf); | 397 | free(buf); |
diff --git a/editors/patch.c b/editors/patch.c index 6f42b835c..1c9e97005 100644 --- a/editors/patch.c +++ b/editors/patch.c | |||
@@ -85,7 +85,7 @@ int patch_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
85 | patch_file = xfopen_stdin(i); | 85 | patch_file = xfopen_stdin(i); |
86 | } | 86 | } |
87 | 87 | ||
88 | patch_line = xmalloc_getline(patch_file); | 88 | patch_line = xmalloc_fgetline(patch_file); |
89 | while (patch_line) { | 89 | while (patch_line) { |
90 | FILE *src_stream; | 90 | FILE *src_stream; |
91 | FILE *dst_stream; | 91 | FILE *dst_stream; |
@@ -106,7 +106,7 @@ int patch_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
106 | /* Extract the filename used before the patch was generated */ | 106 | /* Extract the filename used before the patch was generated */ |
107 | new_filename = extract_filename(patch_line, patch_level, "--- "); | 107 | new_filename = extract_filename(patch_line, patch_level, "--- "); |
108 | // was old_filename above | 108 | // was old_filename above |
109 | patch_line = xmalloc_getline(patch_file); | 109 | patch_line = xmalloc_fgetline(patch_file); |
110 | if (!patch_line) goto quit; | 110 | if (!patch_line) goto quit; |
111 | } while (!new_filename); | 111 | } while (!new_filename); |
112 | free(new_filename); // "source" filename is irrelevant | 112 | free(new_filename); // "source" filename is irrelevant |
diff --git a/editors/sed.c b/editors/sed.c index 32911f8f9..f85884534 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -1028,7 +1028,7 @@ static void process_files(void) | |||
1028 | if (rfile) { | 1028 | if (rfile) { |
1029 | char *line; | 1029 | char *line; |
1030 | 1030 | ||
1031 | while ((line = xmalloc_getline(rfile)) | 1031 | while ((line = xmalloc_fgetline(rfile)) |
1032 | != NULL) | 1032 | != NULL) |
1033 | append(line); | 1033 | append(line); |
1034 | xprint_and_close_file(rfile); | 1034 | xprint_and_close_file(rfile); |
@@ -1273,7 +1273,7 @@ int sed_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
1273 | char *line; | 1273 | char *line; |
1274 | FILE *cmdfile; | 1274 | FILE *cmdfile; |
1275 | cmdfile = xfopen(opt_f->data, "r"); | 1275 | cmdfile = xfopen(opt_f->data, "r"); |
1276 | while ((line = xmalloc_getline(cmdfile)) != NULL) { | 1276 | while ((line = xmalloc_fgetline(cmdfile)) != NULL) { |
1277 | add_cmd(line); | 1277 | add_cmd(line); |
1278 | free(line); | 1278 | free(line); |
1279 | } | 1279 | } |
diff --git a/findutils/grep.c b/findutils/grep.c index 259026ee5..b319e22ce 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -172,7 +172,7 @@ static int grep_file(FILE *file) | |||
172 | enum { print_n_lines_after = 0 }; | 172 | enum { print_n_lines_after = 0 }; |
173 | #endif /* ENABLE_FEATURE_GREP_CONTEXT */ | 173 | #endif /* ENABLE_FEATURE_GREP_CONTEXT */ |
174 | 174 | ||
175 | while ((line = xmalloc_getline(file)) != NULL) { | 175 | while ((line = xmalloc_fgetline(file)) != NULL) { |
176 | llist_t *pattern_ptr = pattern_head; | 176 | llist_t *pattern_ptr = pattern_head; |
177 | grep_list_data_t *gl = gl; /* for gcc */ | 177 | grep_list_data_t *gl = gl; /* for gcc */ |
178 | 178 | ||
@@ -364,7 +364,7 @@ static void load_regexes_from_file(llist_t *fopt) | |||
364 | fopt = cur->link; | 364 | fopt = cur->link; |
365 | free(cur); | 365 | free(cur); |
366 | f = xfopen(ffile, "r"); | 366 | f = xfopen(ffile, "r"); |
367 | while ((line = xmalloc_getline(f)) != NULL) { | 367 | while ((line = xmalloc_fgetline(f)) != NULL) { |
368 | llist_add_to(&pattern_head, | 368 | llist_add_to(&pattern_head, |
369 | new_grep_list_data(line, PATTERN_MEM_A)); | 369 | new_grep_list_data(line, PATTERN_MEM_A)); |
370 | } | 370 | } |
diff --git a/include/libbb.h b/include/libbb.h index 07f74e476..3638b7e15 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -524,15 +524,16 @@ extern ssize_t nonblock_safe_read(int fd, void *buf, size_t count); | |||
524 | extern ssize_t full_read(int fd, void *buf, size_t count); | 524 | extern ssize_t full_read(int fd, void *buf, size_t count); |
525 | extern void xread(int fd, void *buf, size_t count); | 525 | extern void xread(int fd, void *buf, size_t count); |
526 | extern unsigned char xread_char(int fd); | 526 | extern unsigned char xread_char(int fd); |
527 | // Read one line a-la fgets. Uses one read(), works only on seekable streams | 527 | // Reads one line a-la fgets (but doesn't save terminating '\n'). |
528 | // Uses single full_read() call, works only on seekable streams. | ||
528 | extern char *reads(int fd, char *buf, size_t count); | 529 | extern char *reads(int fd, char *buf, size_t count); |
529 | // Read one line a-la fgets. Reads byte-by-byte. | 530 | // Reads one line a-la fgets (but doesn't save terminating '\n'). |
530 | // Useful when it is important to not read ahead. | 531 | // Reads byte-by-byte. Useful when it is important to not read ahead. |
531 | // Bytes are appended to pfx (which must be malloced, or NULL). | 532 | // Bytes are appended to pfx (which must be malloced, or NULL). |
532 | extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p); | 533 | extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p); |
533 | extern ssize_t read_close(int fd, void *buf, size_t count); | 534 | extern ssize_t read_close(int fd, void *buf, size_t maxsz); |
534 | extern ssize_t open_read_close(const char *filename, void *buf, size_t count); | 535 | extern ssize_t open_read_close(const char *filename, void *buf, size_t maxsz); |
535 | extern void *xmalloc_open_read_close(const char *filename, size_t *sizep); | 536 | extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p); |
536 | 537 | ||
537 | extern ssize_t safe_write(int fd, const void *buf, size_t count); | 538 | extern ssize_t safe_write(int fd, const void *buf, size_t count); |
538 | // NB: will return short write on error, not -1, | 539 | // NB: will return short write on error, not -1, |
@@ -549,7 +550,7 @@ extern char *xmalloc_fgetline_str(FILE *file, const char *terminating_string); | |||
549 | /* Reads up to (and including) "\n" or NUL byte */ | 550 | /* Reads up to (and including) "\n" or NUL byte */ |
550 | extern char *xmalloc_fgets(FILE *file); | 551 | extern char *xmalloc_fgets(FILE *file); |
551 | /* Chops off '\n' from the end, unlike fgets: */ | 552 | /* Chops off '\n' from the end, unlike fgets: */ |
552 | extern char *xmalloc_getline(FILE *file); | 553 | extern char *xmalloc_fgetline(FILE *file); |
553 | extern char *bb_get_chunk_from_file(FILE *file, int *end); | 554 | extern char *bb_get_chunk_from_file(FILE *file, int *end); |
554 | extern void die_if_ferror(FILE *file, const char *msg); | 555 | extern void die_if_ferror(FILE *file, const char *msg); |
555 | extern void die_if_ferror_stdout(void); | 556 | extern void die_if_ferror_stdout(void); |
diff --git a/include/usage.h b/include/usage.h index f950a0a49..f830fb35c 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -133,6 +133,8 @@ | |||
133 | "\n -f Control pipe (else exit after drawing image)" \ | 133 | "\n -f Control pipe (else exit after drawing image)" \ |
134 | "\n commands: 'NN' (% for progress bar) or 'exit'" \ | 134 | "\n commands: 'NN' (% for progress bar) or 'exit'" \ |
135 | 135 | ||
136 | |||
137 | |||
136 | #define brctl_trivial_usage \ | 138 | #define brctl_trivial_usage \ |
137 | "COMMAND [BRIDGE [INTERFACE]]" | 139 | "COMMAND [BRIDGE [INTERFACE]]" |
138 | #define brctl_full_usage \ | 140 | #define brctl_full_usage \ |
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c index ac4d14b1f..b88872d53 100644 --- a/libbb/get_line_from_file.c +++ b/libbb/get_line_from_file.c | |||
@@ -57,7 +57,7 @@ char *xmalloc_fgets(FILE *file) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | /* Get line. Remove trailing \n */ | 59 | /* Get line. Remove trailing \n */ |
60 | char *xmalloc_getline(FILE *file) | 60 | char *xmalloc_fgetline(FILE *file) |
61 | { | 61 | { |
62 | int i; | 62 | int i; |
63 | char *c = bb_get_chunk_from_file(file, &i); | 63 | char *c = bb_get_chunk_from_file(file, &i); |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 5d65665d3..4ba61c143 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -969,7 +969,7 @@ static void load_history(const char *fromfile) | |||
969 | } | 969 | } |
970 | 970 | ||
971 | for (hi = 0; hi < MAX_HISTORY;) { | 971 | for (hi = 0; hi < MAX_HISTORY;) { |
972 | char *hl = xmalloc_getline(fp); | 972 | char *hl = xmalloc_fgetline(fp); |
973 | int l; | 973 | int l; |
974 | 974 | ||
975 | if (!hl) | 975 | if (!hl) |
diff --git a/libbb/read.c b/libbb/read.c index 9c025e3a3..1d31fb076 100644 --- a/libbb/read.c +++ b/libbb/read.c | |||
@@ -141,7 +141,7 @@ char *reads(int fd, char *buffer, size_t size) | |||
141 | off_t offset; | 141 | off_t offset; |
142 | *p++ = '\0'; | 142 | *p++ = '\0'; |
143 | // avoid incorrect (unsigned) widening | 143 | // avoid incorrect (unsigned) widening |
144 | offset = (off_t)(p-buffer) - (off_t)size; | 144 | offset = (off_t)(p - buffer) - (off_t)size; |
145 | // set fd position right after '\n' | 145 | // set fd position right after '\n' |
146 | if (offset && lseek(fd, offset, SEEK_CUR) == (off_t)-1) | 146 | if (offset && lseek(fd, offset, SEEK_CUR) == (off_t)-1) |
147 | return NULL; | 147 | return NULL; |
@@ -149,8 +149,8 @@ char *reads(int fd, char *buffer, size_t size) | |||
149 | return buffer; | 149 | return buffer; |
150 | } | 150 | } |
151 | 151 | ||
152 | // Read one line a-la fgets. Reads byte-by-byte. | 152 | // Reads one line a-la fgets (but doesn't save terminating '\n'). |
153 | // Useful when it is important to not read ahead. | 153 | // Reads byte-by-byte. Useful when it is important to not read ahead. |
154 | // Bytes are appended to pfx (which must be malloced, or NULL). | 154 | // Bytes are appended to pfx (which must be malloced, or NULL). |
155 | char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p) | 155 | char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p) |
156 | { | 156 | { |
@@ -178,9 +178,10 @@ char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p) | |||
178 | break; | 178 | break; |
179 | p++; | 179 | p++; |
180 | } | 180 | } |
181 | *p++ = '\0'; | 181 | *p = '\0'; |
182 | if (maxsz_p) | 182 | if (maxsz_p) |
183 | *maxsz_p = p - buf - 1; | 183 | *maxsz_p = p - buf; |
184 | p++; | ||
184 | return xrealloc(buf, p - buf); | 185 | return xrealloc(buf, p - buf); |
185 | } | 186 | } |
186 | 187 | ||
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c index 367c6b9f0..c9495b2c1 100644 --- a/loginutils/addgroup.c +++ b/loginutils/addgroup.c | |||
@@ -83,7 +83,7 @@ static void add_user_to_group(char **args, | |||
83 | 83 | ||
84 | if (!group_file) return; | 84 | if (!group_file) return; |
85 | 85 | ||
86 | while ((line = xmalloc_getline(group_file))) { | 86 | while ((line = xmalloc_fgetline(group_file)) != NULL) { |
87 | /* Find the group */ | 87 | /* Find the group */ |
88 | if (!strncmp(line, args[1], len) | 88 | if (!strncmp(line, args[1], len) |
89 | && line[len] == ':' | 89 | && line[len] == ':' |
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index cb13ebb2d..5dc7a9bf0 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c | |||
@@ -33,7 +33,7 @@ int chpasswd_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
33 | USE_GETOPT_LONG(applet_long_options = chpasswd_longopts;) | 33 | USE_GETOPT_LONG(applet_long_options = chpasswd_longopts;) |
34 | opt = getopt32(argv, "em"); | 34 | opt = getopt32(argv, "em"); |
35 | 35 | ||
36 | while ((name = xmalloc_getline(stdin)) != NULL) { | 36 | while ((name = xmalloc_fgetline(stdin)) != NULL) { |
37 | pass = strchr(name, ':'); | 37 | pass = strchr(name, ':'); |
38 | if (!pass) | 38 | if (!pass) |
39 | bb_error_msg_and_die("missing new password"); | 39 | bb_error_msg_and_die("missing new password"); |
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c index c5170c6a4..68f5e8074 100644 --- a/loginutils/cryptpw.c +++ b/loginutils/cryptpw.c | |||
@@ -22,7 +22,7 @@ int cryptpw_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
22 | crypt_make_salt(salt, 1, 0); /* des */ | 22 | crypt_make_salt(salt, 1, 0); /* des */ |
23 | } | 23 | } |
24 | 24 | ||
25 | puts(pw_encrypt(argv[optind] ? argv[optind] : xmalloc_getline(stdin), salt)); | 25 | puts(pw_encrypt(argv[optind] ? argv[optind] : xmalloc_fgetline(stdin), salt)); |
26 | 26 | ||
27 | return 0; | 27 | return 0; |
28 | } | 28 | } |
diff --git a/miscutils/dc.c b/miscutils/dc.c index 612937556..193929c8e 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c | |||
@@ -204,7 +204,7 @@ int dc_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
204 | char *line; | 204 | char *line; |
205 | char *cursor; | 205 | char *cursor; |
206 | char *token; | 206 | char *token; |
207 | while ((line = xmalloc_getline(stdin)) != NULL) { | 207 | while ((line = xmalloc_fgetline(stdin)) != NULL) { |
208 | cursor = line; | 208 | cursor = line; |
209 | while (1) { | 209 | while (1) { |
210 | token = get_token(&cursor); | 210 | token = get_token(&cursor); |
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index 1f88f3428..43e4b8c4d 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c | |||
@@ -97,7 +97,7 @@ int makedevs_main(int argc, char **argv) | |||
97 | printf("table=<stdin>\n"); | 97 | printf("table=<stdin>\n"); |
98 | } | 98 | } |
99 | 99 | ||
100 | while ((line = xmalloc_getline(table))) { | 100 | while ((line = xmalloc_fgetline(table)) != NULL) { |
101 | char type; | 101 | char type; |
102 | unsigned int mode = 0755; | 102 | unsigned int mode = 0755; |
103 | unsigned int major = 0; | 103 | unsigned int major = 0; |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 20bb709ce..7c31448e8 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -693,13 +693,13 @@ static struct interfaces_file_t *read_interfaces(const char *filename) | |||
693 | defn = xzalloc(sizeof(*defn)); | 693 | defn = xzalloc(sizeof(*defn)); |
694 | f = xfopen(filename, "r"); | 694 | f = xfopen(filename, "r"); |
695 | 695 | ||
696 | while ((buf = xmalloc_getline(f)) != NULL) { | 696 | while ((buf = xmalloc_fgetline(f)) != NULL) { |
697 | #if ENABLE_DESKTOP | 697 | #if ENABLE_DESKTOP |
698 | /* Trailing "\" concatenates lines */ | 698 | /* Trailing "\" concatenates lines */ |
699 | char *p; | 699 | char *p; |
700 | while ((p = last_char_is(buf, '\\')) != NULL) { | 700 | while ((p = last_char_is(buf, '\\')) != NULL) { |
701 | *p = '\0'; | 701 | *p = '\0'; |
702 | rest_of_line = xmalloc_getline(f); | 702 | rest_of_line = xmalloc_fgetline(f); |
703 | if (!rest_of_line) | 703 | if (!rest_of_line) |
704 | break; | 704 | break; |
705 | p = xasprintf("%s%s", buf, rest_of_line); | 705 | p = xasprintf("%s%s", buf, rest_of_line); |
@@ -1051,7 +1051,7 @@ static char *run_mapping(char *physical, struct mapping_defn_t *map) | |||
1051 | /* If the mapping script exited successfully, try to | 1051 | /* If the mapping script exited successfully, try to |
1052 | * grab a line of output and use that as the name of the | 1052 | * grab a line of output and use that as the name of the |
1053 | * logical interface. */ | 1053 | * logical interface. */ |
1054 | char *new_logical = xmalloc_getline(out); | 1054 | char *new_logical = xmalloc_fgetline(out); |
1055 | 1055 | ||
1056 | if (new_logical) { | 1056 | if (new_logical) { |
1057 | /* If we are able to read a line of output from the script, | 1057 | /* If we are able to read a line of output from the script, |
diff --git a/networking/sendmail.c b/networking/sendmail.c index 378c4bb2e..973d712b9 100644 --- a/networking/sendmail.c +++ b/networking/sendmail.c | |||
@@ -170,7 +170,7 @@ static int smtp_checkp(const char *fmt, const char *param, int code) | |||
170 | // if code = -1 then just return this number | 170 | // if code = -1 then just return this number |
171 | // if code != -1 then checks whether the number equals the code | 171 | // if code != -1 then checks whether the number equals the code |
172 | // if not equal -> die saying msg | 172 | // if not equal -> die saying msg |
173 | while ((answer = xmalloc_getline(stdin)) != NULL) | 173 | while ((answer = xmalloc_fgetline(stdin)) != NULL) |
174 | if (strlen(answer) <= 3 || '-' != answer[3]) | 174 | if (strlen(answer) <= 3 || '-' != answer[3]) |
175 | break; | 175 | break; |
176 | if (answer) { | 176 | if (answer) { |
@@ -211,7 +211,7 @@ static char *sane(char *str) | |||
211 | static void pop3_checkr(const char *fmt, const char *param, char **ret) | 211 | static void pop3_checkr(const char *fmt, const char *param, char **ret) |
212 | { | 212 | { |
213 | const char *msg = command(fmt, param); | 213 | const char *msg = command(fmt, param); |
214 | char *answer = xmalloc_getline(stdin); | 214 | char *answer = xmalloc_fgetline(stdin); |
215 | if (answer && '+' == *answer) { | 215 | if (answer && '+' == *answer) { |
216 | alarm(0); | 216 | alarm(0); |
217 | if (ret) | 217 | if (ret) |
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index 10c57fd61..7630153e7 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c | |||
@@ -23,7 +23,7 @@ static void bb_dump_addfile(char *name) | |||
23 | 23 | ||
24 | fp = xfopen(name, "r"); | 24 | fp = xfopen(name, "r"); |
25 | 25 | ||
26 | while ((buf = xmalloc_getline(fp)) != NULL) { | 26 | while ((buf = xmalloc_fgetline(fp)) != NULL) { |
27 | p = skip_whitespace(buf); | 27 | p = skip_whitespace(buf); |
28 | 28 | ||
29 | if (*p && (*p != '#')) { | 29 | if (*p && (*p != '#')) { |
@@ -135,7 +135,7 @@ int hexdump_main(int argc, char **argv) | |||
135 | char *buf; | 135 | char *buf; |
136 | fp = xfopen(*argv, "r"); | 136 | fp = xfopen(*argv, "r"); |
137 | jump_in: | 137 | jump_in: |
138 | while ((buf = xmalloc_getline(fp)) != NULL) { | 138 | while ((buf = xmalloc_fgetline(fp)) != NULL) { |
139 | p = buf; | 139 | p = buf; |
140 | while (1) { | 140 | while (1) { |
141 | /* skip address or previous byte */ | 141 | /* skip address or previous byte */ |
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 0edaf1047..5a8f1d918 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
@@ -68,7 +68,7 @@ static void make_device(char *path, int delete) | |||
68 | if (!fp) | 68 | if (!fp) |
69 | goto end_parse; | 69 | goto end_parse; |
70 | 70 | ||
71 | while ((vline = line = xmalloc_getline(fp)) != NULL) { | 71 | while ((vline = line = xmalloc_fgetline(fp)) != NULL) { |
72 | int field; | 72 | int field; |
73 | 73 | ||
74 | /* A pristine copy for command execution. */ | 74 | /* A pristine copy for command execution. */ |
diff --git a/util-linux/mount.c b/util-linux/mount.c index bd5f27b2e..351a31a73 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -362,7 +362,7 @@ static llist_t *get_block_backed_filesystems(void) | |||
362 | f = fopen(filesystems[i], "r"); | 362 | f = fopen(filesystems[i], "r"); |
363 | if (!f) continue; | 363 | if (!f) continue; |
364 | 364 | ||
365 | while ((buf = xmalloc_getline(f)) != 0) { | 365 | while ((buf = xmalloc_fgetline(f)) != NULL) { |
366 | if (!strncmp(buf, "nodev", 5) && isspace(buf[5])) | 366 | if (!strncmp(buf, "nodev", 5) && isspace(buf[5])) |
367 | continue; | 367 | continue; |
368 | fs = skip_whitespace(buf); | 368 | fs = skip_whitespace(buf); |