Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
    const SGML_dtd *the_dtd = &HTML_dtd;
    int ch;
    int dtd_version = 0;
    int c_option = FALSE;
    int h_option = FALSE;
    int l_option = FALSE;
    FILE *input = stdin;
    FILE *output = stdout;

    while ((ch = getopt(argc, argv, GETOPT)) != -1) {
	switch (ch) {
	case 'c':
	    c_option = TRUE;
	    break;
	case 'h':
	    h_option = TRUE;
	    break;
	case 'l':
	    l_option = TRUE;
	    input = fopen(optarg, "r");
	    if (input == 0)
		failed(optarg);
	    break;
	case 'o':
	    output = fopen(optarg, "w");
	    if (output == 0)
		failed(optarg);
	    break;
	case 't':
	    dtd_version = 1;
	    break;
	case 's':
	    dtd_version = 0;
	    break;
	default:
	    usage();
	}
    }

    HTSwitchDTD(dtd_version);
    if (l_option)
	the_dtd = load_flatfile(input);

    if (the_dtd != 0) {
	if (c_option)
	    dump_source(output, the_dtd, dtd_version);
	if (h_option)
	    dump_header(output, the_dtd);
	if (!c_option && !h_option)
	    dump_flatfile(output, the_dtd);
    }

    return EXIT_SUCCESS;
}
Ejemplo n.º 2
0
int get_tagsoup( char *value )
{
  int eax;
  int found = Old_DTD;
  if ( ( LYgetEnum( tbl_DTD_recovery, value, &found ) & 255 ) && found != Old_DTD )
  {
    Old_DTD = found;
    HTSwitchDTD( Old_DTD == 0 );
  }
  return 0;
}