Print this page
9718 update mandoc to 1.14.4
   1 /*      $Id: mdoc.c,v 1.267 2017/06/17 13:06:16 schwarze Exp $ */
   2 /*
   3  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
   4  * Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
   5  *
   6  * Permission to use, copy, modify, and distribute this software for any
   7  * purpose with or without fee is hereby granted, provided that the above
   8  * copyright notice and this permission notice appear in all copies.
   9  *
  10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
  11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
  13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17  */
  18 #include "config.h"
  19 
  20 #include <sys/types.h>
  21 


 280         if (mdoc->flags & MDOC_LITERAL)
 281                 return 1;
 282 
 283         /*
 284          * End-of-sentence check.  If the last character is an unescaped
 285          * EOS character, then flag the node as being the end of a
 286          * sentence.  The front-end will know how to interpret this.
 287          */
 288 
 289         assert(buf < end);
 290 
 291         if (mandoc_eos(buf+offs, (size_t)(end-buf-offs)))
 292                 mdoc->last->flags |= NODE_EOS;
 293 
 294         for (c = buf + offs; c != NULL; c = strchr(c + 1, '.')) {
 295                 if (c - buf < offs + 2)
 296                         continue;
 297                 if (end - c < 3)
 298                         break;
 299                 if (c[1] != ' ' ||
 300                     isalpha((unsigned char)c[-2]) == 0 ||
 301                     isalpha((unsigned char)c[-1]) == 0 ||
 302                     (c[-2] == 'n' && c[-1] == 'c') ||
 303                     (c[-2] == 'v' && c[-1] == 's'))
 304                         continue;
 305                 c += 2;
 306                 if (*c == ' ')
 307                         c++;
 308                 if (*c == ' ')
 309                         c++;
 310                 if (isupper((unsigned char)(*c)))
 311                         mandoc_msg(MANDOCERR_EOS, mdoc->parse,
 312                             line, (int)(c - buf), NULL);
 313         }
 314 
 315         return 1;
 316 }
 317 
 318 /*
 319  * Parse a macro line, that is, a line beginning with the control
 320  * character.
 321  */


   1 /*      $Id: mdoc.c,v 1.268 2017/08/11 16:56:21 schwarze Exp $ */
   2 /*
   3  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
   4  * Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
   5  *
   6  * Permission to use, copy, modify, and distribute this software for any
   7  * purpose with or without fee is hereby granted, provided that the above
   8  * copyright notice and this permission notice appear in all copies.
   9  *
  10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
  11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
  13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17  */
  18 #include "config.h"
  19 
  20 #include <sys/types.h>
  21 


 280         if (mdoc->flags & MDOC_LITERAL)
 281                 return 1;
 282 
 283         /*
 284          * End-of-sentence check.  If the last character is an unescaped
 285          * EOS character, then flag the node as being the end of a
 286          * sentence.  The front-end will know how to interpret this.
 287          */
 288 
 289         assert(buf < end);
 290 
 291         if (mandoc_eos(buf+offs, (size_t)(end-buf-offs)))
 292                 mdoc->last->flags |= NODE_EOS;
 293 
 294         for (c = buf + offs; c != NULL; c = strchr(c + 1, '.')) {
 295                 if (c - buf < offs + 2)
 296                         continue;
 297                 if (end - c < 3)
 298                         break;
 299                 if (c[1] != ' ' ||
 300                     isalnum((unsigned char)c[-2]) == 0 ||
 301                     isalnum((unsigned char)c[-1]) == 0 ||
 302                     (c[-2] == 'n' && c[-1] == 'c') ||
 303                     (c[-2] == 'v' && c[-1] == 's'))
 304                         continue;
 305                 c += 2;
 306                 if (*c == ' ')
 307                         c++;
 308                 if (*c == ' ')
 309                         c++;
 310                 if (isupper((unsigned char)(*c)))
 311                         mandoc_msg(MANDOCERR_EOS, mdoc->parse,
 312                             line, (int)(c - buf), NULL);
 313         }
 314 
 315         return 1;
 316 }
 317 
 318 /*
 319  * Parse a macro line, that is, a line beginning with the control
 320  * character.
 321  */