VC 1

File Edit Options Buffers Tools C Help                                          
/**                                                                             
 * Encodes the given VC dump, writing HTML to the given file pointer.           
 */                                                                             
int htmlencode(FILE *fp, VCDump *dump) {                                        
  int y,x,oldattr=-1;                                                           
  CA * cap=dump->ca;                                                            
                                                                                
  fputs("<pre>", fp);                                                           
  for (y=0; y<dump->h.ys; y++) {                                                
    for (x=0; x<dump->h.xs; x++) {                                              
      int ch=cap->ch, attr=cap->attr;                                           
      cap++;                                                                    
                                                                                
      // if attribute changed, print appropriate tag                            
      if (oldattr != attr) {                                                    
        if (oldattr != -1) fputs("</span>", fp); // close old tag if open       
        fprintf(fp, "<span class=\"a%02x\">", attr);                            
        oldattr=attr;                                                           
      }                                                                         
                                                                                
      // replace unprintable characters with '?'                                
      if (ch & 0x7f < 0x20) ch='?';                                             
-uu-:---F1  vcsadump.c        (C CVS-1.1.1.1 Abbrev)--L122--C0--42%-------------