- if (store.offset == 0) {
- store.offset = offset = st.st_size;
- } else if (store.state != KEY_SEEN) {
- offset = store.offset;
- } else {
- int equal_offset = st.st_size,
- bracket_offset = st.st_size;
-
- if (value == NULL && store.seen > 1) {
- fprintf(stderr, "Cannot remove multivar (%s has %d values\n", key, store.seen);
- close(fd);
- unlink(lock_file);
- return 7;
- }
- for (offset = store.offset-2; offset > 0
- && contents[offset] != '\n'; offset--)
- switch (contents[offset]) {
- case '=': equal_offset = offset; break;
- case ']': bracket_offset = offset; break;
- }
- if (bracket_offset < equal_offset) {
- new_line = 1;
- offset = bracket_offset+1;
+ if (store.seen == 0)
+ store.seen = 1;
+
+ for (i = 0, copy_begin = 0; i < store.seen; i++) {
+ if (store.offset[i] == 0) {
+ store.offset[i] = copy_end = st.st_size;
+ } else if (store.state != KEY_SEEN) {
+ copy_end = store.offset[i];