HTML Tidy  5.9.15
The HTACG Tidy HTML Project
tidy.c File Reference

Detailed Description

HTML TidyLib command line driver.

This console application utilizing LibTidy in order to offer a complete console application offering all of the features of LibTidy.

Author
HTACG, et al (consult git log)
All Rights Reserved.
See tidy.h for the complete license.
Date
Additional updates: consult git log

Data Structures

struct  AllOption_t
 Array holding all options. More...
 
struct  CmdOptDesc
 The struct and subsequent array keep the help output structured because we also output all of this stuff as as XML. More...
 
struct  OptionDesc
 Structure maintains a description of a configuration ption. More...
 

Typedefs

typedef void(* OptionFunc) (TidyDoc, TidyOption, OptionDesc *)
 A type for a function pointer for a function used to print out options descriptions. More...
 

Enumerations

enum  CmdOptCategory {
  CmdOptFileManip ,
  CmdOptCatFIRST = CmdOptFileManip ,
  CmdOptProcDir ,
  CmdOptCharEnc ,
  CmdOptMisc ,
  CmdOptXML ,
  CmdOptCatLAST
}
 This enum is used to categorize the options for help output. More...
 

Functions

static tmbstr cleanup_description (ctmbstr description)
 Cleans up the HTML-laden option descriptions for console output. More...
 
static int cmpOpt (const void *e1_, const void *e2_)
 A simple option comparator, used for sorting the options. More...
 
static ctmbstr ConfigCategoryId (TidyConfigCategory id)
 Returns the configuration category id for the specified configuration category id. More...
 
static const char * cutToWhiteSpace (const char *s, uint offset, char *sbuf)
 Used by print1Column, print2Columns and print3Columns to manage wrapping text within columns. More...
 
static void exportDefaultOptionValues (TidyDoc tdoc)
 Handles the -export-default-config service. More...
 
static void exportOptionValues (TidyDoc tdoc)
 Handles the -export-config service. More...
 
static void ForEachOption (TidyDoc tdoc, OptionFunc OptionPrint)
 An iterator for the unsorted options. More...
 
static void ForEachSortedOption (TidyDoc tdoc, OptionFunc OptionPrint)
 An iterator for the sorted options. More...
 
static tmbstr get_escaped_name (ctmbstr name)
 Escape a name for XML output. More...
 
static ctmbstr get_final_name (ctmbstr prog)
 Returns the final name of the tidy executable by eliminating the path name components from the executable name. More...
 
static tmbstr get_option_names (const CmdOptDesc *pos)
 Retrieve the option's name(s) from the structure as a single string, localizing the field values if application. More...
 
static tmbstr GetAllowedValues (TidyOption topt, const OptionDesc *d)
 Retrieves allowed values for an option. More...
 
static tmbstr GetAllowedValuesFromPick (TidyOption topt)
 Retrieves allowed values from an option's pick list. More...
 
static void GetOption (TidyDoc tdoc, TidyOption topt, OptionDesc *d)
 Create OptionDesc "d" related to "opt". More...
 
static void getSortedOption (TidyDoc tdoc, AllOption_t *tOption)
 Returns options sorted. More...
 
static Bool hasPickList (TidyOption topt)
 Utility to determine if an option has a picklist. More...
 
static void help (TidyDoc tdoc, ctmbstr prog)
 Handles the -help service. More...
 
static void helpEnv (TidyDoc tdoc)
 Handles the -help-env service. More...
 
static void invertBuffer (TidyBuffer *src, TidyBuffer *dst)
 
static void lang_help (TidyDoc tdoc)
 Handles the -lang help service. More...
 
static void localize_option_names (CmdOptDesc *pos)
 Option names aren't localized, but the sample fields should be localized. More...
 
int main (int argc, char **argv)
 
static void optionDescribe (TidyDoc tdoc, char *option)
 Handles the -help-option service. More...
 
static void optionhelp (TidyDoc tdoc)
 Handles the -help-config service. More...
 
static void optionvalues (TidyDoc tdoc)
 Handles the -show-config service. More...
 
static void outOfMemory (void)
 Exits with an error in the event of an out of memory condition. More...
 
static void print1Column (const char *fmt, uint l1, const char *c1)
 Outputs one column of text. More...
 
static void print2Columns (const char *fmt, uint l1, uint l2, const char *c1, const char *c2)
 Outputs two columns of text. More...
 
static void print3Columns (const char *fmt, uint l1, uint l2, uint l3, const char *c1, const char *c2, const char *c3)
 Outputs three columns of text. More...
 
static void print_help_options (TidyDoc tdoc)
 Outputs all of the complete help options (text). More...
 
static void print_xml_help_option_element (ctmbstr element, ctmbstr name)
 Outputs an XML element for a CLI option, escaping special characters as required. More...
 
static void PrintAllowedValues (TidyOption topt, const OptionDesc *d)
 Prints an option's allowed values. More...
 
static void PrintAllowedValuesFromPick (TidyOption topt)
 Prints an option's allowed value as specified in its pick list. More...
 
static void printOption (TidyDoc ARG_UNUSED(tdoc), TidyOption topt, OptionDesc *d)
 Prints a single option. More...
 
static void printOptionExportValues (TidyDoc ARG_UNUSED(tdoc), TidyOption topt, OptionDesc *d)
 Prints the option value for a given option. More...
 
static void printOptionValues (TidyDoc ARG_UNUSED(tdoc), TidyOption topt, OptionDesc *d)
 Prints the option value for a given option. More...
 
static void printXMLCrossRef (TidyDoc tdoc, TidyOption topt)
 Prints for XML an option's <seealso>. More...
 
static void printXMLCrossRefEqConsole (TidyDoc tdoc, TidyOption topt)
 Prints for XML an option's <eqconfig>. More...
 
static void printXMLDescription (TidyDoc tdoc, TidyOption topt)
 Prints for XML an option's . More...
 
static void printXMLOption (TidyDoc tdoc, TidyOption topt, OptionDesc *d)
 Prints for XML an option. More...
 
static void printXMLOptionString (TidyDoc tdoc, TidyOption topt, OptionDesc *d)
 Handles printing of option description for -xml-options-strings service. More...
 
static Bool TIDY_CALL reportCallback (TidyMessage tmessage)
 This callback from LibTidy allows the console application to examine an error message before allowing LibTidy to display it. More...
 
static Bool samefile (ctmbstr filename1, ctmbstr filename2)
 Indicates whether or not two filenames are the same. More...
 
static tmbstr stringWithFormat (const ctmbstr fmt,...)
 Create a new, allocated string with a format and arguments. More...
 
static void tidy_cleanup (void)
 Handles exit cleanup. More...
 
void tidyPrintTidyLanguageNames (ctmbstr format)
 Prints the languages the are currently built into Tidy, using the specified format string. More...
 
void tidyPrintWindowsLanguageNames (ctmbstr format)
 Prints the Windows language names that Tidy recognizes, using the specified format string. More...
 
static void unknownOption (TidyDoc tdoc, uint c)
 Provides the unknown option output to the current errout. More...
 
static void version (TidyDoc tdoc)
 Handles the -version service. More...
 
static void xml_error_strings (TidyDoc tdoc)
 Handles the -xml-error-strings service. More...
 
static void xml_help (void)
 Provides the -xml-help service. More...
 
static void xml_options_strings (TidyDoc tdoc)
 Handles the -xml-options-strings service. More...
 
static void xml_strings (void)
 Handles the -xml-strings service. More...
 
static void XMLoptionhelp (TidyDoc tdoc)
 Handles the -xml-config service. More...
 

Variables

struct {
uint key
 Key to fetch the localized string. More...
 
ctmbstr mnemonic
 Used in XML as a class. More...
 
cmdopt_catname []
 This array contains headings that will be used in help output. More...
 
static const CmdOptDesc cmdopt_defs []
 All instances of s will be substituted with localized string specified by the subKey field. More...
 
static FILE * errout = NULL
 Tidy will send errors to this file, which will be stderr later. More...
 
Format strings and decorations used in output.
static const char fmt [] = "%-27.27s %-9.9s %-40.40s\n"
 
static const char helpfmt [] = " %-*.*s %-*.*s\n"
 
static const char helpul [] = "-----------------------------------------------------------------"
 
static const char ul [] = "================================================================="
 

Variable Documentation

◆ errout

FILE* errout = NULL
static

Tidy will send errors to this file, which will be stderr later.