#include #include "linkedlist.h" #include "ReadFile.h" #include "QuickSort.h" int main(int argc, char *argv[]) { /* Define a doubly-linked list. */ node *linkedList; switch (argc) { /* Print an error if no data file was specified. */ case 1: printf("You must specify a textfile to read your data from\n"); break; /* If only one file was specified, read into a list using ReadFile, then print to the screen using listPrint. */ case 2: printf("Argv[1]: %s\n", argv[1]); printf("What's wrong?\n"); linkedList = readFile(argv[1]); printf("Time to do quickSort\n"); linkedList = quickSort(linkedList); printf("Ahhhh.. done with quickSort\n"); listPrint(linkedList); break; /* If two files were specified read from the first using readFile, then print to the second using writeFile. */ case 3: printf("Argv[1]: %s\n", argv[1]); linkedList = readFile(argv[1]); printf("Time to do quickSort"); linkedList = quickSort(linkedList); printf("Ahhhh.. done with quickSort"); printf("The element is %s\n", linkedList->data); if (writeFile(argv[2], linkedList) == 1) { /* If there was a problem writing to the file, print an error. */ printf("Error writing to file"); } break; /* If some other number of arguments were specified, print an error. */ default: printf("Wrong number of arguments\n"); } return 0; }