> From: [email protected] > To: [email protected] > CC: [email protected]; [email protected] > Subject: Re: Patch for man to ignore trailing spaces in man.conf > Date: Mon, 23 May 2016 10:01:54 -0600 > > Your patch got munged by your mailer. Here's a different patch > that achieves the same thing and also removes the requirement that > the last line in man.conf end with a newline. > > - todd > > Index: usr.bin/mandoc/manpath.c > =================================================================== > RCS file: /cvs/src/usr.bin/mandoc/manpath.c,v > retrieving revision 1.17 > diff -u -p -u -r1.17 manpath.c > --- usr.bin/mandoc/manpath.c 7 Nov 2015 17:58:52 -0000 1.17 > +++ usr.bin/mandoc/manpath.c 23 May 2016 15:59:09 -0000 > @@ -173,13 +173,12 @@ manconf_file(struct manconf *conf, const > > while ((linelen = getline(&line, &linesz, stream)) != -1) { > cp = line; > - ep = cp + linelen; > - if (ep[-1] != '\n') > - break; > - *--ep = '\0'; > + ep = cp + linelen - 1; > + while (ep> cp && isspace((unsigned char)*ep)) > + *ep-- = '\0'; > while (isspace((unsigned char)*cp)) > cp++; > - if (*cp == '#') > + if (cp == ep || *cp == '#') > continue; > > for (tok = 0; tok < sizeof(toks)/sizeof(toks[0]); tok++) {
Thanks much. I like your patch better too. Cheers, Mayukh
