extern int main (int __unused__ argc, char **argv) { cookedArgs *args; #ifdef VMS extern int getredirection (int *ac, char ***av); /* do wildcard expansion and I/O redirection */ getredirection (&argc, &argv); #endif #ifdef AMIGA /* This program doesn't work when started from the Workbench */ if (argc == 0) exit (1); #endif #ifdef __EMX__ _wildcard (&argc, &argv); /* expand wildcards in argument list */ #endif #if defined (macintosh) && BUILD_MPW_TOOL == 0 argc = ccommand (&argv); #endif setCurrentDirectory (); setExecutableName (*argv++); sanitizeEnviron (); checkRegex (); args = cArgNewFromArgv (argv); previewFirstOption (args); testEtagsInvocation (); initializeParsing (); initOptions (); readOptionConfiguration (); verbose ("Reading initial options from command line\n"); parseOptions (args); checkOptions (); unifyLanguageMaps (); makeTags (args); /* Clean up. */ cArgDelete (args); freeKeywordTable (); freeRoutineResources (); freeSourceFileResources (); freeTagFileResources (); freeOptionResources (); freeParserResources (); freeRegexResources (); freeXcmdResources (); if (Option.guessParser) return (Option.guessParser == TRUE)? 0: 1; exit (0); return 0; }
int main(int argc, char *argv[]) { int fd, bytes_read; uint8_t packet_buffer[TS_PACKET_SIZE]; int n_packets = 0; TSParser tsParser; memset(&tsParser, 0, sizeof(TSParser)); fd = openStream(argv[1]); if(fd<0) { printf("Error opening the stream\nSyntax: tsunpacket FileToParse.ts\n"); return -1; } while(1) { bytes_read = readData(fd, packet_buffer, TS_PACKET_SIZE); if(packet_buffer[0] == TS_DISCONTINUITY) { printf("Discontinuity detected!\n"); signalDiscontinuity(&tsParser, 0); } else if(bytes_read < TS_PACKET_SIZE) { printf("End of file!\n"); break; } else if(packet_buffer[0] == TS_SYNC) { ABitReader bitReader; initABitReader(&bitReader, packet_buffer, bytes_read); parseTSPacket(&tsParser, &bitReader); n_packets++; } } printf("Number of packets: %d\n", n_packets); printf("Finishing application\n"); close(fd); freeParserResources(&tsParser); return 0; }
extern int main (int __unused__ argc, char **argv) { cookedArgs *args; setCurrentDirectory (); setExecutableName (*argv++); sanitizeEnviron (); checkRegex (); args = cArgNewFromArgv (argv); previewFirstOption (args); testEtagsInvocation (); initializeParsing (); initOptions (); readOptionConfiguration (); verbose ("Reading initial options from command line\n"); parseOptions (args); checkOptions (); unifyLanguageMaps (); makeTags (args); /* Clean up. */ cArgDelete (args); freeKeywordTable (); freeRoutineResources (); freeSourceFileResources (); freeTagFileResources (); freeOptionResources (); freeParserResources (); freeRegexResources (); freeXcmdResources (); #ifdef HAVE_ICONV freeEncodingResources (); #endif if (Option.printLanguage) return (Option.printLanguage == TRUE)? 0: 1; exit (0); return 0; }