Mercurial > mplayer.hg
changeset 13801:245f5d4b4af7
Fixed the assumption user will always give 2+ args to the program.
author | al |
---|---|
date | Fri, 29 Oct 2004 22:05:34 +0000 |
parents | 75644a19873b |
children | 08c90d8c1325 |
files | TOOLS/vivodump.c |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <input_file> <output_file>\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; }