summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsijanec <anton@sijanec.eu>2021-01-19 23:35:10 +0100
committersijanec <anton@sijanec.eu>2021-01-19 23:35:10 +0100
commita494deed8bfe2d315917388465a39b5804e31a83 (patch)
tree035a5c9bad63cff3baae7961aaf93f615942e933
parentfixed a mv bug (diff)
downloadbverbose-a494deed8bfe2d315917388465a39b5804e31a83.tar
bverbose-a494deed8bfe2d315917388465a39b5804e31a83.tar.gz
bverbose-a494deed8bfe2d315917388465a39b5804e31a83.tar.bz2
bverbose-a494deed8bfe2d315917388465a39b5804e31a83.tar.lz
bverbose-a494deed8bfe2d315917388465a39b5804e31a83.tar.xz
bverbose-a494deed8bfe2d315917388465a39b5804e31a83.tar.zst
bverbose-a494deed8bfe2d315917388465a39b5804e31a83.zip
-rwxr-xr-xbin/bvr-compose-htmlbin36712 -> 36712 bytes
-rwxr-xr-xbin/bvr-compose-singlebin36568 -> 36568 bytes
-rw-r--r--src/bvrcommands.c5
3 files changed, 3 insertions, 2 deletions
diff --git a/bin/bvr-compose-html b/bin/bvr-compose-html
index fdfd428..e311aeb 100755
--- a/bin/bvr-compose-html
+++ b/bin/bvr-compose-html
Binary files differ
diff --git a/bin/bvr-compose-single b/bin/bvr-compose-single
index ad757b6..1ef4359 100755
--- a/bin/bvr-compose-single
+++ b/bin/bvr-compose-single
Binary files differ
diff --git a/src/bvrcommands.c b/src/bvrcommands.c
index a1738dc..f160731 100644
--- a/src/bvrcommands.c
+++ b/src/bvrcommands.c
@@ -510,7 +510,8 @@ int bvr_handle_explode(FILE * input, FILE * output) {
char * string1 = bvr_var_get(item);
char * string2 = bvr_var_get(value);
char * token;
- char * rest = string1;
+ char * rest = malloc(sizeof(char)*(strlen(string1)+1));
+ strcpy(rest, string1);
char * charpointer;
int index = strlen(item);
size_t len = 0;
@@ -518,7 +519,7 @@ int bvr_handle_explode(FILE * input, FILE * output) {
item[index++] = '[';
item[index] = '\0';
index = 0;
- while ((token = strtok_r(rest, string2, &rest))) {
+ while ((token = strsep(&rest, string2))) { // strsep handles empty strings as well
charpointer = strrchr(item, BVR_ARRAY_INDEX_CHAR);
sprintf(charpointer+1, "%d" BVR_ARRAY_AFTER_INDEX, index++); /* keys must always have 128 bytes more space allocated */
return_value = return_value != SUCCESS ? return_value : bvr_var_set(item, token); // če je bila prej napaka pač ne poskušamo več!