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

Diff for /mandoc/html.c between version 1.67 and 1.68

version 1.67, 2009/10/27 04:50:14 version 1.68, 2009/10/28 05:08:17
Line 17 
Line 17 
 #include <sys/types.h>  #include <sys/types.h>
   
 #include <assert.h>  #include <assert.h>
   #include <ctype.h>
 #include <err.h>  #include <err.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdarg.h>  #include <stdarg.h>
Line 648  bufcat_su(struct html *h, const char *p, const struct 
Line 649  bufcat_su(struct html *h, const char *p, const struct 
                 buffmt(h, "%s: %d%s;", p, (int)v, u);                  buffmt(h, "%s: %d%s;", p, (int)v, u);
 }  }
   
   
   void
   html_idcpy(char *dst, const char *src, int sz)
   {
   
           assert(sz);
           dst[0] = '\0';
           html_idcat(dst, src, sz);
   }
   
   
   void
   html_idcat(char *dst, const char *src, int sz)
   {
           int              i;
   
           /* Cf. <http://www.w3.org/TR/html4/types.html#h-6.2>. */
   
           for (i = 0; *dst != '\0' && i < sz - 1; dst++, i++)
                   /* Jump to end. */ ;
   
           for ( ; *src != '\0' && i < sz - 1; src++, i++) {
                   if (isalnum((u_char)*src)) {
                           *dst++ = *src;
                           continue;
                   }
   
                   switch (*src) {
                   case (';'):
                           *dst++ = ';';
                           break;
                   case ('-'):
                           *dst++ = '-';
                           break;
                   case (':'):
                           *dst++ = ':';
                           break;
                   case ('_'):
                           /* FALLTHROUGH */
                   default:
                           *dst++ = '_';
                           break;
                   }
           }
   
           *dst = '\0';
   }

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

CVSweb