97{
98#ifdef __AFL_COMPILER
99 __AFL_INIT();
100#endif
101
102 wxMessageOutput::Set( new wxMessageOutputStderr );
103 wxCmdLineParser cl_parser( argc, argv );
105 cl_parser.AddUsageText(
_(
"This program parses PCB files, either from the stdin stream or "
106 "from the given filenames. This can be used either for standalone "
107 "testing of the parser or for fuzz testing." ) );
108
109 int cmd_parsed_ok = cl_parser.Parse();
110 if( cmd_parsed_ok != 0 )
111 {
112
114 }
115
116 const bool verbose = cl_parser.Found( "verbose" );
117 bool ok = true;
118 const size_t file_count = cl_parser.GetParamCount();
119
120 if( file_count == 0 )
121 {
122
123
124
125 {
126 ok =
parse( std::cin, verbose );
127 }
128 }
129 else
130 {
131
132
133
134 for( unsigned i = 0; i < file_count; i++ )
135 {
136 const auto filename = cl_parser.GetParam( i ).ToStdString();
137
138 if( verbose )
139 std::cout << "Parsing: " << filename << std::endl;
140
141 std::ifstream fin;
142 fin.open( filename );
143
144 ok = ok &&
parse( fin, verbose );
145 }
146 }
147
148 if( !ok )
150
152}
@ BAD_CMDLINE
The command line was not correct for the tool.