Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Aug 2019 02:36:42 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351157 - head/usr.sbin/config
Message-ID:  <201908170236.x7H2agPD033313@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sat Aug 17 02:36:42 2019
New Revision: 351157
URL: https://svnweb.freebsd.org/changeset/base/351157

Log:
  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.

Modified:
  head/usr.sbin/config/mkmakefile.c

Modified: head/usr.sbin/config/mkmakefile.c
==============================================================================
--- head/usr.sbin/config/mkmakefile.c	Sat Aug 17 02:36:37 2019	(r351156)
+++ head/usr.sbin/config/mkmakefile.c	Sat Aug 17 02:36:42 2019	(r351157)
@@ -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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908170236.x7H2agPD033313>