/* Title: Insertion Sort
*  Author: Ben MIller
*  This program sort a list of unsorted number.  The purpose of this assignment
*  is to practise a new kind of sort technique.  The technique is called insertion
*  sort.  The program goes down the list of unsorted number taking a, a+1, a+2, ...,
*  a+nuntil the ist is empty.  It takes the numbers and finds there location in the
*  new sorted list.  This might be a little modified from the actual insertion
*  sorting algorithm.  This program is for my CS 38 class.
*/

#include <stdio.h>
#include "insertion_sort_lib.c"

int main (int argc, char *argv[])
{
	char unsorted_file[LENGTH];
	FILE *infile;
	int number, sorted_list[MAX], a = 0;
	
	check_command_line(argc, argv, unsorted_file);
	
	infile = openfile(unsorted_file);
	
	initialize_list(sorted_list);
	
	while (fscanf(infile, "%d", &number) != EOF) {
		sort_file(number, sorted_list, a);
		a++;
	}

	print_list(sorted_list, a);
	
	exit(1);
}
