CollectionReader* collectionReader;
char* currentArgument;
char* fileToOpen = NULL;
+ FILE* file = NULL;
int argumentIndex;
+ ED2KLink* nextLink = NULL;
for (argumentIndex = 1; argumentIndex < argc; argumentIndex++) {
currentArgument = argv[argumentIndex];
} else if (!strcmp("--verbose", currentArgument) || !strcmp("-v", currentArgument)) {
GlobalSettings::setVerbose(true);
} else if (!strcmp("--file", currentArgument) || !strcmp("-f", currentArgument)) {
- fileToOpen = currentArgument;
+ fileToOpen = argv[++argumentIndex];
} else {
printf("Unknown Parameter: %s\n", currentArgument);
return 1;
}
}
+ if (fileToOpen) {
+ file = fopen(fileToOpen, "r");
+ fileReaderInput = new FileReaderInput(file);
+ } else {
+ fileReaderInput = new FileReaderInput(stdin);
+ }
+
+ collectionReader = new CollectionReader(fileReaderInput);
+ while ((nextLink = collectionReader->getNextLink())) {
+ printf("%s\n", nextLink->getLink());
+ }
+
+ if (file) {
+ fclose(file);
+ }
+
return 0;
}