# HG changeset patch # User al # Date 1099087534 0 # Node ID 245f5d4b4af711d5361925052cf2283cd3ff522a # Parent 75644a19873b869777a91fc51d5cb761c4159468 Fixed the assumption user will always give 2+ args to the program. diff -r 75644a19873b -r 245f5d4b4af7 TOOLS/vivodump.c --- a/TOOLS/vivodump.c Fri Oct 29 20:48:13 2004 +0000 +++ b/TOOLS/vivodump.c Fri Oct 29 22:05:34 2004 +0000 @@ -151,7 +151,7 @@ int postable[32768]; -int main(int argv,char ** argc){ +int main(int argc,char ** argv){ int c; unsigned int head=-1; int pos=0; @@ -167,13 +167,20 @@ int flag2=0; int prefix=0; +// check if enough args were given +if ( argc < 3 ){ + printf("Too few arguments given!\n" + "Usage: %s \n", argv[0]); + + return -1; +} // input -if(!(f=fopen(argc[1],"rb"))){ +if(!(f=fopen(argv[1],"rb"))){ printf("Couldn't open input file.\n"); return -1; } // output -if(!(f2=fopen(argc[2],"wb"))){ +if(!(f2=fopen(argv[2],"wb"))){ printf("Couldn't open output file.\n"); return -1; }