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)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to