/* Here are all the header files */ #include #include /* Some defines */ #define false 0 #define true 1 /* Function definitions */ void putc_html(char c); int main(void) { unsigned char c = ' ', last_c = ' '; /* TODO */ int not_whitespace = false; int do_inline = false; int comment = false; int index; printf("\n" "
");

  while((last_c = c) && (c = getc(stdin))) {
    if(comment) {
      if(last_c == '*' && c == '/') {
        comment = false;
        if(do_inline) {
          printf("*/");
        } else {
          printf("
");
        }
        not_whitespace = true;
        c = getc(stdin);
        continue;
      }
      if(not_whitespace)
        putc_html(last_c);
      if(! (isspace(c) || c == '*'))
        not_whitespace = true;
      if(last_c == '\n') 
        not_whitespace = false;
    } else {
      if(last_c == '/' && c == '*') {
        comment = true;
        if(not_whitespace) {
          do_inline = true;
          printf("/\x2A "); /* heh */
        } else {
          do_inline = false;
          printf("
");
        }
        not_whitespace = false;
        continue;
      }
      if(! isspace(last_c))
        not_whitespace = true;
      if(not_whitespace)
        putc_html(last_c);
      if(last_c == '\n' && c == '\n' && not_whitespace) {
        not_whitespace = false;
        putc('\n', stdout);
      }
    }

    if(feof(stdin) || ferror(stdin)) break;
  }
  printf("
\n"); return 0; } /* This function puts some stuff! Great! */ void putc_html(char c) { switch(c) { case '<': printf("<"); break; case '>': printf(">"); break; case '&': printf("&"); break; default: putc(c,stdout); } }