From 7852f76ee05551c05a4f833f9a55bec15f44f85d Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Tue, 12 Dec 2000 21:02:34 +0000 Subject: add "list-contents" feature to mar-extract-only --- mdk-stage1/mar/mar-extract-only.c | 18 ++++++++++++++++++ mdk-stage1/mar/mar-extract-only.h | 1 + 2 files changed, 19 insertions(+) (limited to 'mdk-stage1') diff --git a/mdk-stage1/mar/mar-extract-only.c b/mdk-stage1/mar/mar-extract-only.c index b1079880e..fc9e9e55f 100644 --- a/mdk-stage1/mar/mar-extract-only.c +++ b/mdk-stage1/mar/mar-extract-only.c @@ -52,6 +52,24 @@ gzerr(gzFile f) /* decrease code size */ #endif /* _STANDALONE_ */ +char ** +mar_list_contents(struct mar_stream *s) +{ + struct mar_element * elem = s->first_element; + char * tmp_contents[500]; + char ** answ; + int i = 0; + while (elem) + { + tmp_contents[i++] = strdup(elem->filename); + elem = elem->next_element; + } + tmp_contents[i++] = NULL; + answ = (char **) malloc(sizeof(char *) * i); + memcpy(answ, tmp_contents, sizeof(char *) * i); + return answ; +} + int mar_calc_integrity(struct mar_stream *s) { diff --git a/mdk-stage1/mar/mar-extract-only.h b/mdk-stage1/mar/mar-extract-only.h index e8a88e96e..8a68cc13d 100644 --- a/mdk-stage1/mar/mar-extract-only.h +++ b/mdk-stage1/mar/mar-extract-only.h @@ -31,5 +31,6 @@ int mar_open_file(char *filename, struct mar_stream *s); int mar_extract_file(struct mar_stream *s, char *filename, char *dest_dir); int mar_calc_integrity(struct mar_stream *s); +char ** mar_list_contents(struct mar_stream *s); #endif -- cgit v1.2.1