summaryrefslogtreecommitdiffstats
path: root/src/common.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2017-02-24 22:10:56 +0100
committerGravatar Nikias Bassen2017-02-24 22:10:56 +0100
commite9c805ffdec34c66fdc751ea222fa40678c71351 (patch)
treecaf4e88914996906434b2547029f8eb2680cbdb4 /src/common.c
parentaaec66651aba5f617c5c2c22b019d115e2db8e8f (diff)
downloadidevicerestore-e9c805ffdec34c66fdc751ea222fa40678c71351.tar.gz
idevicerestore-e9c805ffdec34c66fdc751ea222fa40678c71351.tar.bz2
common: Add strsep() implementation for platforms lacking it
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c
index 691137d..7bbe33a 100644
--- a/src/common.c
+++ b/src/common.c
@@ -21,6 +21,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -282,3 +286,16 @@ void idevicerestore_progress(struct idevicerestore_client_t* client, int step, d
}
}
}
+
+#ifndef HAVE_STRSEP
+char* strsep(char** strp, const char* delim)
+{
+ char *p, *s;
+ if (strp == NULL || *strp == NULL || **strp == '\0') return NULL;
+ s = *strp;
+ p = s + strcspn(s, delim);
+ if (*p != '\0') *p++ = '\0';
+ *strp = p;
+ return s;
+}
+#endif