From a8db0e4a909df5857753fb0e6280e5c70fa4c5c5 Mon Sep 17 00:00:00 2001 From: al Date: Fri, 29 Oct 2004 22:05:34 +0000 Subject: Fixed the assumption user will always give 2+ args to the program. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13802 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/vivodump.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'TOOLS') diff --git a/TOOLS/vivodump.c b/TOOLS/vivodump.c index 9896dacb21..a35b4ddd58 100644 --- a/TOOLS/vivodump.c +++ b/TOOLS/vivodump.c @@ -151,7 +151,7 @@ int h263_decode_picture_header(unsigned char *b_ptr) 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 flag=0; 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; } -- cgit v1.2.3