diff options
author | Matt Kraai <kraai@debian.org> | 2002-01-02 19:01:41 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2002-01-02 19:01:41 +0000 |
commit | 39fcb5a7502ffb35a90b9539478c5b0d314c3b8e (patch) | |
tree | 0338510114df960f2fa2f63a33cba5050c97d3b6 | |
parent | 0733e840bd1f94eee6a07f2a1986e29c9ddfe20c (diff) | |
download | busybox-w32-39fcb5a7502ffb35a90b9539478c5b0d314c3b8e.tar.gz busybox-w32-39fcb5a7502ffb35a90b9539478c5b0d314c3b8e.tar.bz2 busybox-w32-39fcb5a7502ffb35a90b9539478c5b0d314c3b8e.zip |
* archival/dpkg.c (create_list): Use chomp.
* archival/tar.c (append_file_list_to_list): Likewise.
-rw-r--r-- | archival/dpkg.c | 6 | ||||
-rw-r--r-- | archival/tar.c | 6 |
2 files changed, 2 insertions, 10 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index f41363d0f..6dee43f50 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -1034,7 +1034,6 @@ char **create_list(const char *filename) | |||
1034 | FILE *list_stream; | 1034 | FILE *list_stream; |
1035 | char **file_list = xmalloc(sizeof(char *)); | 1035 | char **file_list = xmalloc(sizeof(char *)); |
1036 | char *line = NULL; | 1036 | char *line = NULL; |
1037 | char *last_char; | ||
1038 | int length = 0; | 1037 | int length = 0; |
1039 | int count = 0; | 1038 | int count = 0; |
1040 | 1039 | ||
@@ -1047,10 +1046,7 @@ char **create_list(const char *filename) | |||
1047 | while (getline(&line, &length, list_stream) != -1) { | 1046 | while (getline(&line, &length, list_stream) != -1) { |
1048 | /* +2 as we need to include space for the terminating NULL pointer */ | 1047 | /* +2 as we need to include space for the terminating NULL pointer */ |
1049 | file_list = xrealloc(file_list, sizeof(char *) * (length + 2)); | 1048 | file_list = xrealloc(file_list, sizeof(char *) * (length + 2)); |
1050 | last_char = last_char_is(line, '\n'); | 1049 | chomp(line); |
1051 | if (last_char) { | ||
1052 | *last_char = '\0'; | ||
1053 | } | ||
1054 | file_list[count] = xstrdup(line); | 1050 | file_list[count] = xstrdup(line); |
1055 | count++; | 1051 | count++; |
1056 | } | 1052 | } |
diff --git a/archival/tar.c b/archival/tar.c index 22cbf3ab2..19c84a770 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -516,14 +516,10 @@ void append_file_list_to_list(char *filename, char ***name_list, int *num_of_ent | |||
516 | { | 516 | { |
517 | FILE *src_stream; | 517 | FILE *src_stream; |
518 | char *line; | 518 | char *line; |
519 | char *line_ptr; | ||
520 | 519 | ||
521 | src_stream = xfopen(filename, "r"); | 520 | src_stream = xfopen(filename, "r"); |
522 | while ((line = get_line_from_file(src_stream)) != NULL) { | 521 | while ((line = get_line_from_file(src_stream)) != NULL) { |
523 | line_ptr = last_char_is(line, '\n'); | 522 | chomp (line); |
524 | if (line_ptr) { | ||
525 | *line_ptr = '\0'; | ||
526 | } | ||
527 | append_file_to_list(line, name_list, num_of_entries); | 523 | append_file_to_list(line, name_list, num_of_entries); |
528 | free(line); | 524 | free(line); |
529 | } | 525 | } |