Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Nov 2001 10:40:06 -0800 (PST)
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/31392: fmt(1) does format nroff source correctly
Message-ID:  <200111271840.fARIe6X75873@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/31392; it has been noted by GNATS.

From: Ruslan Ermilov <ru@FreeBSD.org>
To: bug-followup@FreeBSD.org, kurt@boolean.net
Cc:  
Subject: Re: bin/31392: fmt(1) does format nroff source correctly
Date: Tue, 27 Nov 2001 20:39:16 +0200

 Hi!
 
 I've checked that the old fmt(1) really had an undocumented
 feature to not format lines starting with the dot character.
 I have also checked that System V's fmt(1) has this feature.
 The below patch is believed to fix the problem.
 
 Index: fmt.1
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/fmt/fmt.1,v
 retrieving revision 1.9
 diff -u -p -r1.9 fmt.1
 --- fmt.1	2001/08/15 14:53:55	1.9
 +++ fmt.1	2001/11/27 18:35:24
 @@ -79,6 +79,11 @@ The spacing at the beginning of the inpu
  as are blank lines and interword spacing.
  Lines are joined or split only at white space; that is, words are never
  joined or hyphenated.
 +.Nm
 +does not fill lines beginning with a
 +.Ql \&.
 +(dot), for compatibility with
 +.Xr nroff 1 .
  .Pp
  The options are as follows:
  .Bl -tag -width indent
 Index: fmt.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/fmt/fmt.c,v
 retrieving revision 1.16
 diff -u -p -r1.16 fmt.c
 --- fmt.c	2001/08/15 14:53:55	1.16
 +++ fmt.c	2001/11/27 18:35:32
 @@ -395,6 +395,7 @@ process_stream(FILE *stream, const char 
        }
        /* We need a new paragraph if and only if:
         *   this line is blank,
 +       *   OR it's a troff request,
         *   OR it's a mail header,
         *   OR it's not a mail header AND the last line was one,
         *   OR the indentation has changed
 @@ -402,6 +403,7 @@ process_stream(FILE *stream, const char 
         *      AND this isn't the second line of an indented paragraph.
         */
        if ( length==0
 +           || (length>0 && line[0]=='.')
             || header_type==hdr_Header
             || (header_type==hdr_NonHeader && prev_header_type>hdr_NonHeader)
             || (np!=last_indent
 @@ -411,6 +413,11 @@ process_stream(FILE *stream, const char 
          para_line_number = 0;
          first_indent = np;
          last_indent = np;
 +        /* nroff compatibility: don't fill lines beginning with a dot */
 +        if (length>0 && line[0]=='.') {
 +          printf("%.*s\n", (int)length, line);
 +          continue;
 +        }
          if (header_type==hdr_Header) last_indent=2;	/* for cont. lines */
          if (length==0) {
            putchar('\n');
 
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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