ChangeLog, subst.c:
subst.c (replace_string): Fix replace_string so that it correctly
handles replacing a substitution variable with a zero-length string.
diff --git a/util/subst.c b/util/subst.c
index 94444ca..7b7ba83 100644
--- a/util/subst.c
+++ b/util/subst.c
@@ -108,7 +108,9 @@
replace_len = strlen(newstr);
len = end - begin;
- if (replace_len != len+1)
+ if (replace_len == 0)
+ memmove(begin, end+1, strlen(end)+1);
+ else if (replace_len != len+1)
memmove(end+(replace_len-len-1), end,
strlen(end)+1);
memcpy(begin, newstr, replace_len);
@@ -248,7 +250,7 @@
if (!isspace(*cp))
break;
#if 0
- printf("Substitute: '%s' for '%s'\n", ptr, cp);
+ printf("Substitute: '%s' for '%s'\n", ptr, cp ? cp : "<NULL>");
#endif
add_subst(ptr, cp);
}