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
This commit is contained in:
al 2004-10-29 22:05:34 +00:00
parent 4aa0c76124
commit a8db0e4a90
1 changed files with 10 additions and 3 deletions

View File

@ -151,7 +151,7 @@ int h263_decode_picture_header(unsigned char *b_ptr)
int postable[32768]; int postable[32768];
int main(int argv,char ** argc){ int main(int argc,char ** argv){
int c; int c;
unsigned int head=-1; unsigned int head=-1;
int pos=0; int pos=0;
@ -167,13 +167,20 @@ int flag=0;
int flag2=0; int flag2=0;
int prefix=0; int prefix=0;
// check if enough args were given
if ( argc < 3 ){
printf("Too few arguments given!\n"
"Usage: %s <input_file> <output_file>\n", argv[0]);
return -1;
}
// input // input
if(!(f=fopen(argc[1],"rb"))){ if(!(f=fopen(argv[1],"rb"))){
printf("Couldn't open input file.\n"); printf("Couldn't open input file.\n");
return -1; return -1;
} }
// output // output
if(!(f2=fopen(argc[2],"wb"))){ if(!(f2=fopen(argv[2],"wb"))){
printf("Couldn't open output file.\n"); printf("Couldn't open output file.\n");
return -1; return -1;
} }