Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/amachronic/microtar.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-11-05 03:44:33 +0300
committerAidan MacDonald <amachronic@protonmail.com>2021-11-05 18:16:16 +0300
commit9acb29a6ca6945eab237c2c8a2b7c88d1a55bb30 (patch)
treebba752e6e89ab2136cffd66b5ebd1aaf6f725a45
parent7bdf1c4103315deca9b1f634cd147fbcdac4082b (diff)
Move mtar_open() to another header
It's expected users will provide their own I/O hooks, so mtar_open() does not really belong in microtar.h.
-rw-r--r--Makefile4
-rw-r--r--mtar.c2
-rw-r--r--src/microtar-stdio.c2
-rw-r--r--src/microtar-stdio.h39
-rw-r--r--src/microtar.h2
5 files changed, 43 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 5f42c2d..ae2c4f6 100644
--- a/Makefile
+++ b/Makefile
@@ -17,8 +17,8 @@ $(MICROTAR_LIB): $(MICROTAR_OBJ)
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
src/microtar.o: src/microtar.h
-src/microtar-stdio.o: src/microtar.h
-mtar.o: src/microtar.h
+src/microtar-stdio.o: src/microtar.h src/microtar-stdio.h
+mtar.o: src/microtar.h src/microtar-stdio.h
clean:
rm -f $(MICROTAR_LIB) $(MICROTAR_OBJ)
diff --git a/mtar.c b/mtar.c
index 580c68d..e88732c 100644
--- a/mtar.c
+++ b/mtar.c
@@ -20,7 +20,7 @@
* IN THE SOFTWARE.
*/
-#include "microtar.h"
+#include "microtar-stdio.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
diff --git a/src/microtar-stdio.c b/src/microtar-stdio.c
index b022bf8..d61b81f 100644
--- a/src/microtar-stdio.c
+++ b/src/microtar-stdio.c
@@ -21,7 +21,7 @@
* IN THE SOFTWARE.
*/
-#include "microtar.h"
+#include "microtar-stdio.h"
#include <stdio.h>
#include <string.h>
diff --git a/src/microtar-stdio.h b/src/microtar-stdio.h
new file mode 100644
index 0000000..ad46af0
--- /dev/null
+++ b/src/microtar-stdio.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2017 rxi
+ * Copyright (c) 2021 Aidan MacDonald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef MICROTAR_STDIO_H
+#define MICROTAR_STDIO_H
+
+#include "microtar.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int mtar_open(mtar_t* tar, const char* filename, const char* mode);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/microtar.h b/src/microtar.h
index 8da8a08..4212d40 100644
--- a/src/microtar.h
+++ b/src/microtar.h
@@ -100,8 +100,6 @@ struct mtar {
const char* mtar_strerror(int err);
-int mtar_open(mtar_t* tar, const char* filename, const char* mode);
-
int mtar_init(mtar_t* tar, int access, const mtar_ops_t* ops, void* stream);
int mtar_close(mtar_t* tar);
int mtar_is_open(mtar_t* tar);