Fix small bug in wrapping introduced in r325955.

When local support was fixed, it introduced a minor bug in formatting. We don't
increment the lpos by enouogh, so lines are a little too long. Adjust to be
correct now with variable length srcprefix.
This commit is contained in:
Warner Losh 2019-08-17 02:36:42 +00:00
parent 44fcf30bdd
commit 2bc9c25782
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351157

View File

@ -639,17 +639,16 @@ do_before_depend(FILE *fp)
lpos = 15;
STAILQ_FOREACH(tp, &ftab, f_next)
if (tp->f_flags & BEFORE_DEPEND) {
len = strlen(tp->f_fn);
if ((len = 3 + len) + lpos > 72) {
len = strlen(tp->f_fn) + strlen(tp->f_srcprefix);
if (len + lpos > 72) {
lpos = 8;
fputs("\\\n\t", fp);
}
if (tp->f_flags & NO_IMPLCT_RULE)
fprintf(fp, "%s ", tp->f_fn);
lpos += fprintf(fp, "%s ", tp->f_fn);
else
fprintf(fp, "%s%s ", tp->f_srcprefix,
lpos += fprintf(fp, "%s%s ", tp->f_srcprefix,
tp->f_fn);
lpos += len + 1;
}
if (lpos != 8)
putc('\n', fp);
@ -709,12 +708,11 @@ do_xxfiles(char *tag, FILE *fp)
continue;
if (strcasecmp(&tp->f_fn[len - slen], suff) != 0)
continue;
if ((len = 3 + len) + lpos > 72) {
if (len + strlen(tp->f_srcprefix) + lpos > 72) {
lpos = 8;
fputs("\\\n\t", fp);
}
fprintf(fp, "%s%s ", tp->f_srcprefix, tp->f_fn);
lpos += len + 1;
lpos += fprintf(fp, "%s%s ", tp->f_srcprefix, tp->f_fn);
}
free(suff);
if (lpos != 8)