summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdk-stage1/mar/mar-extract-only.c18
-rw-r--r--mdk-stage1/mar/mar-extract-only.h1
2 files changed, 19 insertions, 0 deletions
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