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

Diff for /mandoc/Attic/mlg.c between version 1.16 and 1.18

version 1.16, 2008/12/06 21:10:31 version 1.18, 2008/12/07 16:41:04
Line 62  struct md_mlg {
Line 62  struct md_mlg {
   
 static  char            *mlg_literal(int);  static  char            *mlg_literal(int);
 static  char            *mlg_At_literal(const char *);  static  char            *mlg_At_literal(const char *);
   static  char            *mlg_fmt(int);
 static  char            *mlg_St_literal(int);  static  char            *mlg_St_literal(int);
 static  void             mlg_roffmsg(void *arg, enum roffmsg,  static  void             mlg_roffmsg(void *arg, enum roffmsg,
                                 const char *, const char *, char *);                                  const char *, const char *, char *);
Line 200  mlg_St_literal(int argc)
Line 201  mlg_St_literal(int argc)
 static char *  static char *
 mlg_At_literal(const char *p)  mlg_At_literal(const char *p)
 {  {
   
         if (NULL == p)          if (NULL == p)
                 return("AT&T UNIX");                  return("AT&T UNIX");
         if (0 == strcmp(p, "v6"))          if (0 == strcmp(p, "v6"))
Line 219  mlg_At_literal(const char *p)
Line 221  mlg_At_literal(const char *p)
   
   
 static char *  static char *
   mlg_fmt(int tok)
   {
   
           switch (tok) {
           case (ROFF_Ex):
                   return ("The %s utility exits 0 on success, and "
                                   ">0 if an error occurs.");
           case (ROFF_Rv):
                   return ("The %s() function returns the value 0 if "
                                   "successful; otherwise the value -1 "
                                   "is returned and the global variable "
                                   "<span class=\"inline-Va\">errno</span> "
                                   "is set to indicate the error.");
           case (ROFF_In):
                   return("#include &lt;%s&gt;");
           default:
                   break;
           }
   
           abort();
           /* NOTREACHED */
   }
   
   
   static char *
 mlg_literal(int tok)  mlg_literal(int tok)
 {  {
   
         switch (tok) {          switch (tok) {
         case (ROFF_Bt):          case (ROFF_Bt):
                 return("is currently in beta test.");                  return("is currently in beta test.");
Line 564  mlg_roffspecial(void *arg, int tok, const char *start,
Line 592  mlg_roffspecial(void *arg, int tok, const char *start,
                 const int *argc, const char **argv, char **more)                  const int *argc, const char **argv, char **more)
 {  {
         struct md_mlg   *p;          struct md_mlg   *p;
           char             buf[256];
   
         assert(arg);          assert(arg);
         p = (struct md_mlg *)arg;          p = (struct md_mlg *)arg;
Line 587  mlg_roffspecial(void *arg, int tok, const char *start,
Line 616  mlg_roffspecial(void *arg, int tok, const char *start,
                 break;                  break;
         }          }
   
           /*
            * Handle macros put into different-token tags.
            */
   
           switch (tok) {
           case (ROFF_Fn):
                   assert(*more);
                   if ( ! mlg_begintag(p, MD_NS_INLINE, tok, NULL, more))
                           return(0);
                   if ( ! ml_putstring(p->mbuf, *more++, &p->pos))
                           return(0);
                   if ( ! mlg_endtag(p, MD_NS_INLINE, tok))
                           return(0);
                   if (*more) {
                           if ( ! ml_nputs(p->mbuf, "(", 1, &p->pos))
                                   return(0);
                           p->flags |= ML_OVERRIDE_ONE;
                           if ( ! mlg_begintag(p, MD_NS_INLINE,
                                                   ROFF_Fa, NULL, more))
                                   return(0);
                           if ( ! ml_putstring(p->mbuf, *more++, &p->pos))
                                   return(0);
                           if ( ! mlg_endtag(p, MD_NS_INLINE, ROFF_Fa))
                                   return(0);
                           while (*more) {
                                   if ( ! ml_nputs(p->mbuf, ", ", 2, &p->pos))
                                           return(0);
                                   if ( ! mlg_begintag(p, MD_NS_INLINE, ROFF_Fa, NULL, more))
                                           return(0);
                                   if ( ! ml_putstring(p->mbuf, *more++, &p->pos))
                                           return(0);
                                   if ( ! mlg_endtag(p, MD_NS_INLINE, ROFF_Fa))
                                           return(0);
                           }
                           if ( ! ml_nputs(p->mbuf, ")", 1, &p->pos))
                                   return(0);
                   }
                   return(1);
           default:
                   break;
           }
   
           /*
            * Now handle macros in their environments.
            */
   
         if ( ! mlg_begintag(p, MD_NS_INLINE, tok, NULL, more))          if ( ! mlg_begintag(p, MD_NS_INLINE, tok, NULL, more))
                 return(0);                  return(0);
   
Line 629  mlg_roffspecial(void *arg, int tok, const char *start,
Line 704  mlg_roffspecial(void *arg, int tok, const char *start,
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (ROFF_Nm):          case (ROFF_Nm):
                 assert(*more);                  assert(*more);
                 if ( ! ml_puts(p->mbuf, *more++, &p->pos))                  if ( ! ml_putstring(p->mbuf, *more++, &p->pos))
                         return(0);                          return(0);
                 assert(NULL == *more);                  assert(NULL == *more);
                 break;                  break;
   
           case (ROFF_In):
                   /* NOTREACHED */
         case (ROFF_Ex):          case (ROFF_Ex):
                   /* NOTREACHED */
           case (ROFF_Rv):
                 assert(*more);                  assert(*more);
                 if ( ! ml_puts(p->mbuf, "The ", &p->pos))                  /* FIXME: *more must be ml-filtered. */
                         return(0);                  (void)snprintf(buf, sizeof(buf),
                 if ( ! mlg_begintag(p, MD_NS_INLINE, ROFF_Xr, NULL, NULL))                                  mlg_fmt(tok), *more++);
                         return(0);                  if ( ! ml_puts(p->mbuf, buf, &p->pos))
                 if ( ! ml_puts(p->mbuf, *more++, &p->pos))  
                         return(0);  
                 if ( ! mlg_endtag(p, MD_NS_INLINE, ROFF_Xr))  
                         return(0);  
                 if ( ! ml_puts(p->mbuf, " utility exits 0 on success, "  
                                         "and &gt;0 if an error "  
                                         "occurs.", &p->pos))  
                         return(0);                          return(0);
                 assert(NULL == *more);                  assert(NULL == *more);
                 break;                  break;

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.18

CVSweb