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

Diff for /texi2mdoc/main.c between version 1.68 and 1.70

version 1.68, 2015/03/12 10:44:34 version 1.70, 2015/03/13 08:13:21
Line 607  domacro(struct texi *p, enum texicmd cmd, size_t *pos)
Line 607  domacro(struct texi *p, enum texicmd cmd, size_t *pos)
         m.key[end - start] = '\0';          m.key[end - start] = '\0';
   
         m.args = argparse(p, pos, &m.argsz, 0);          m.args = argparse(p, pos, &m.argsz, 0);
           if (*pos == BUFSZ(p)) {
                   texiwarn(p, "unexpected EOF");
                   return;
           }
   
         /* Note: we advance to the beginning of the macro. */          /* Note: we advance to the beginning of the macro. */
         advanceeoln(p, pos, 1);          advanceeoln(p, pos, 1);
           if ((start = *pos) == BUFSZ(p)) {
                   texiwarn(p, "unexpected EOF");
                   return;
           }
   
         /*          /*
          * According to the Texinfo manual, the macro ends on the           * According to the Texinfo manual, the macro ends on the
Line 622  domacro(struct texi *p, enum texicmd cmd, size_t *pos)
Line 630  domacro(struct texi *p, enum texicmd cmd, size_t *pos)
          * @end macro without the leading newline else we might look           * @end macro without the leading newline else we might look
          * past empty macros.           * past empty macros.
          */           */
         start = *pos;  
         endtok = "@end macro\n";          endtok = "@end macro\n";
         endtoksz = strlen(endtok);          endtoksz = strlen(endtok);
         blk = memmem(&BUF(p)[start], BUFSZ(p) - start, endtok, endtoksz);          blk = memmem(&BUF(p)[start], BUFSZ(p) - start, endtok, endtoksz);
Line 1509  indexcmp(const void *p1, const void *p2)
Line 1516  indexcmp(const void *p1, const void *p2)
 static void  static void
 doprintindex(struct texi *p, enum texicmd cmd, size_t *pos)  doprintindex(struct texi *p, enum texicmd cmd, size_t *pos)
 {  {
         size_t   i, j, start, end, len;          static size_t    guard = 0;
           size_t           i, j, start, end, len;
 #if HAVE_INDEX  #if HAVE_INDEX
         char    *cp;          char            *cp;
         char     buf[PATH_MAX];          char             buf[PATH_MAX];
 #endif  #endif
   
           if (guard++ > 8)
                   texierr(p, "recursive @printindex");
   
         while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))          while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))
                 advance(p, pos);                  advance(p, pos);
         start = *pos;          start = *pos;
Line 1522  doprintindex(struct texi *p, enum texicmd cmd, size_t 
Line 1533  doprintindex(struct texi *p, enum texicmd cmd, size_t 
                 advance(p, pos);                  advance(p, pos);
         if ((end = *pos) == BUFSZ(p)) {          if ((end = *pos) == BUFSZ(p)) {
                 texiwarn(p, "unexpected EOF");                  texiwarn(p, "unexpected EOF");
                   guard--;
                 return;                  return;
         }          }
   
         advance(p, pos);          advance(p, pos);
         if (0 == (len = end - start)) {          if (*pos == BUFSZ(p)) {
                   texiwarn(p, "unexpected EOF");
                   guard--;
                   return;
           } else if (0 == (len = end - start)) {
                 texiwarn(p, "zero-length index");                  texiwarn(p, "zero-length index");
                   guard--;
                 return;                  return;
         }          }
   
Line 1542  doprintindex(struct texi *p, enum texicmd cmd, size_t 
Line 1559  doprintindex(struct texi *p, enum texicmd cmd, size_t 
   
         if (i == p->indexsz) {          if (i == p->indexsz) {
                 texiwarn(p, "cannot find index");                  texiwarn(p, "cannot find index");
                   guard--;
                 return;                  return;
         } else if (0 == p->indexs[i].indexsz)          } else if (0 == p->indexs[i].indexsz) {
                   guard--;
                 return;                  return;
           }
   
         /* Alphabetically sort our indices. */          /* Alphabetically sort our indices. */
         qsort(p->indexs[i].index,          qsort(p->indexs[i].index,
Line 1591  doprintindex(struct texi *p, enum texicmd cmd, size_t 
Line 1611  doprintindex(struct texi *p, enum texicmd cmd, size_t 
         p->seenvs = 0;          p->seenvs = 0;
         teximacro(p, "El");          teximacro(p, "El");
         texivspace(p);          texivspace(p);
           guard--;
 }  }
   
 static void  static void
Line 1672  domenu(struct texi *p, enum texicmd cmd, size_t *pos)
Line 1693  domenu(struct texi *p, enum texicmd cmd, size_t *pos)
         while (*pos < BUFSZ(p)) {          while (*pos < BUFSZ(p)) {
                 while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))                  while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))
                         advance(p, pos);                          advance(p, pos);
                 if ('*' != BUF(p)[*pos]) {                  if (*pos < BUFSZ(p) && '*' != BUF(p)[*pos]) {
                         if (TEXICMD_END == peeklinecmd(p, *pos))                          if (TEXICMD_END == peeklinecmd(p, *pos))
                                 break;                                  break;
                         parseeoln(p, pos);                          parseeoln(p, pos);
Line 1695  domenu(struct texi *p, enum texicmd cmd, size_t *pos)
Line 1716  domenu(struct texi *p, enum texicmd cmd, size_t *pos)
                         p->seenws = *pos < BUFSZ(p) && isws(BUF(p)[*pos]);                          p->seenws = *pos < BUFSZ(p) && isws(BUF(p)[*pos]);
                 while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))                  while (*pos < BUFSZ(p) && isws(BUF(p)[*pos]))
                         advance(p, pos);                          advance(p, pos);
                 if ('*' != BUF(p)[*pos]) {                  if (*pos == BUFSZ(p)) {
                           texiwarn(p, "unexpected EOF");
                           return;
                   } else if ('*' != BUF(p)[*pos]) {
                         tcmd = peeklinecmd(p, *pos);                          tcmd = peeklinecmd(p, *pos);
                         if (TEXICMD_END == tcmd)                          if (TEXICMD_END == tcmd)
                                 break;                                  break;
Line 1714  domenu(struct texi *p, enum texicmd cmd, size_t *pos)
Line 1738  domenu(struct texi *p, enum texicmd cmd, size_t *pos)
                 while (*pos < BUFSZ(p) && ':' != BUF(p)[*pos])                  while (*pos < BUFSZ(p) && ':' != BUF(p)[*pos])
                         advance(p, pos);                          advance(p, pos);
                 entrynameend = *pos;                  entrynameend = *pos;
                   if (*pos == BUFSZ(p)) {
                           texiwarn(p, "unexpected EOF");
                           return;
                   }
                 advance(p, pos);                  advance(p, pos);
   
                 p->seenvs = 0;                  p->seenvs = 0;

Legend:
Removed from v.1.68  
changed lines
  Added in v.1.70

CVSweb