[BACK]Return to roff.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/roff.c between version 1.217 and 1.219

version 1.217, 2014/07/04 16:12:08 version 1.219, 2014/07/06 19:09:00
Line 500  roff_res(struct roff *r, char **bufp, size_t *szp, int
Line 500  roff_res(struct roff *r, char **bufp, size_t *szp, int
         size_t           naml;  /* actual length of the escape name */          size_t           naml;  /* actual length of the escape name */
         int              expand_count;  /* to avoid infinite loops */          int              expand_count;  /* to avoid infinite loops */
         int              npos;  /* position in numeric expression */          int              npos;  /* position in numeric expression */
         int              irc;   /* return code from roff_evalnum() */          int              arg_complete; /* argument not interrupted by eol */
         char             term;  /* character terminating the escape */          char             term;  /* character terminating the escape */
   
         expand_count = 0;          expand_count = 0;
Line 542  roff_res(struct roff *r, char **bufp, size_t *szp, int
Line 542  roff_res(struct roff *r, char **bufp, size_t *szp, int
                         break;                          break;
                 default:                  default:
                         if (ESCAPE_ERROR == mandoc_escape(&cp, NULL, NULL))                          if (ESCAPE_ERROR == mandoc_escape(&cp, NULL, NULL))
                                 mandoc_msg(MANDOCERR_BADESCAPE, r->parse,                                  mandoc_vmsg(MANDOCERR_ESC_BAD,
                                     ln, (int)(stesc - *bufp), NULL);                                      r->parse, ln, (int)(stesc - *bufp),
                                       "%.*s", (int)(cp - stesc), stesc);
                         continue;                          continue;
                 }                  }
   
Line 585  roff_res(struct roff *r, char **bufp, size_t *szp, int
Line 586  roff_res(struct roff *r, char **bufp, size_t *szp, int
   
                 /* Advance to the end of the name. */                  /* Advance to the end of the name. */
   
                   arg_complete = 1;
                 for (naml = 0; 0 == maxl || naml < maxl; naml++, cp++) {                  for (naml = 0; 0 == maxl || naml < maxl; naml++, cp++) {
                         if ('\0' == *cp) {                          if ('\0' == *cp) {
                                 mandoc_msg(MANDOCERR_BADESCAPE, r->parse,                                  mandoc_msg(MANDOCERR_ESC_BAD, r->parse,
                                     ln, (int)(stesc - *bufp), NULL);                                      ln, (int)(stesc - *bufp), stesc);
                                   arg_complete = 0;
                                 break;                                  break;
                         }                          }
                         if (0 == maxl && *cp == term) {                          if (0 == maxl && *cp == term) {
Line 604  roff_res(struct roff *r, char **bufp, size_t *szp, int
Line 607  roff_res(struct roff *r, char **bufp, size_t *szp, int
   
                 switch (stesc[1]) {                  switch (stesc[1]) {
                 case '*':                  case '*':
                         res = roff_getstrn(r, stnam, naml);                          if (arg_complete)
                                   res = roff_getstrn(r, stnam, naml);
                         break;                          break;
                 case 'B':                  case 'B':
                         npos = 0;                          npos = 0;
                         irc = roff_evalnum(stnam, &npos, NULL, 0);                          ubuf[0] = arg_complete &&
                         ubuf[0] = irc && stnam + npos + 1 == cp                              roff_evalnum(stnam, &npos, NULL, 0) &&
                             ? '1' : '0';                              stnam + npos + 1 == cp ? '1' : '0';
                         ubuf[1] = '\0';                          ubuf[1] = '\0';
                         break;                          break;
                 case 'n':                  case 'n':
                         (void)snprintf(ubuf, sizeof(ubuf), "%d",                          if (arg_complete)
                             roff_getregn(r, stnam, naml));                                  (void)snprintf(ubuf, sizeof(ubuf), "%d",
                                       roff_getregn(r, stnam, naml));
                           else
                                   ubuf[0] = '\0';
                         break;                          break;
                 case 'w':                  case 'w':
                           /* use even incomplete args */
                         (void)snprintf(ubuf, sizeof(ubuf), "%d",                          (void)snprintf(ubuf, sizeof(ubuf), "%d",
                             24 * (int)naml);                              24 * (int)naml);
                         break;                          break;
                 }                  }
   
                 if (NULL == res) {                  if (NULL == res) {
                         mandoc_msg(MANDOCERR_BADESCAPE, r->parse,                          mandoc_vmsg(MANDOCERR_STR_UNDEF,
                             ln, (int)(stesc - *bufp), NULL);                              r->parse, ln, (int)(stesc - *bufp),
                               "%.*s", (int)naml, stnam);
                         res = "";                          res = "";
                 }                  }
   
Line 1887  roff_tr(ROFF_ARGS)
Line 1896  roff_tr(ROFF_ARGS)
                 if ('\\' == *first) {                  if ('\\' == *first) {
                         esc = mandoc_escape(&p, NULL, NULL);                          esc = mandoc_escape(&p, NULL, NULL);
                         if (ESCAPE_ERROR == esc) {                          if (ESCAPE_ERROR == esc) {
                                 mandoc_msg(MANDOCERR_BADESCAPE,                                  mandoc_msg(MANDOCERR_ESC_BAD, r->parse,
                                     r->parse, ln,                                      ln, (int)(p - *bufp), first);
                                     (int)(p - *bufp), NULL);  
                                 return(ROFF_IGN);                                  return(ROFF_IGN);
                         }                          }
                         fsz = (size_t)(p - first);                          fsz = (size_t)(p - first);
Line 1899  roff_tr(ROFF_ARGS)
Line 1907  roff_tr(ROFF_ARGS)
                 if ('\\' == *second) {                  if ('\\' == *second) {
                         esc = mandoc_escape(&p, NULL, NULL);                          esc = mandoc_escape(&p, NULL, NULL);
                         if (ESCAPE_ERROR == esc) {                          if (ESCAPE_ERROR == esc) {
                                 mandoc_msg(MANDOCERR_BADESCAPE,                                  mandoc_msg(MANDOCERR_ESC_BAD, r->parse,
                                     r->parse, ln,                                      ln, (int)(p - *bufp), second);
                                     (int)(p - *bufp), NULL);  
                                 return(ROFF_IGN);                                  return(ROFF_IGN);
                         }                          }
                         ssz = (size_t)(p - second);                          ssz = (size_t)(p - second);

Legend:
Removed from v.1.217  
changed lines
  Added in v.1.219

CVSweb