summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.c3
-rw-r--r--src/opk.c15
2 files changed, 15 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 1fecdfe..d9ccb64 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,7 +17,6 @@
* along with opkg-opk. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdio.h>
#include <stdlib.h>
#include "defs.h"
#include "opk.h"
@@ -42,8 +41,6 @@ main(int argc, char *argv[])
}
opkg_opk_opk_free_inner(opk);
- puts("");
-
/* List data files. */
if (opkg_opk_opk_init_inner(opk, "data.tar.gz") != OPKG_OPK_OK) {
goto error1;
diff --git a/src/opk.c b/src/opk.c
index 14efe10..ce24e55 100644
--- a/src/opk.c
+++ b/src/opk.c
@@ -36,6 +36,7 @@ struct opkg_opk_opk {
size_t version_size;
struct opkg_opk_gzip *inner_gzip;
struct opkg_opk_ustar *inner_ustar;
+ int previously_printed;
};
static int
@@ -107,6 +108,8 @@ opkg_opk_opk_init_outer(const char *file_name)
goto error3;
}
+ opk->previously_printed = 0;
+
return opk;
error3:
@@ -167,6 +170,10 @@ opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
size_t size;
int ret;
+ if (opk->previously_printed == 1) {
+ puts("");
+ }
+
if (opkg_opk_ustar_seek(opk->inner_ustar, 2, "control", "./control") !=
OPKG_OPK_OK) {
fputs("Error: Failed to find control file\n", stderr);
@@ -181,6 +188,8 @@ opkg_opk_opk_read_control(struct opkg_opk_opk *opk)
return OPKG_OPK_ERROR;
}
+ opk->previously_printed = 1;
+
return OPKG_OPK_OK;
}
@@ -201,6 +210,10 @@ opkg_opk_opk_list_members(struct opkg_opk_opk *opk)
char mode[10];
char mtime[20];
+ if (opk->previously_printed == 1) {
+ puts("");
+ }
+
/* Build singly-linked list and find maximum column widths. */
head = NULL;
uname_len_max = 0;
@@ -260,6 +273,8 @@ opkg_opk_opk_list_members(struct opkg_opk_opk *opk)
free(head);
}
+ opk->previously_printed = 1;
+
return OPKG_OPK_OK;
}