Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/downloadertools/check_md5.cxx

Go to the documentation of this file.
00001 // Filename: check_md5.cxx
00002 // Created by:
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "crypto_utils.h"
00020 #include "hashVal.h"
00021 #include "filename.h"
00022 
00023 int
00024 main(int argc, char *argv[]) {
00025   const char *usagestr = "Usage: check_md5 <file>";
00026   if (argc < 2) {
00027     cerr << usagestr << endl;
00028     return 1;
00029   }
00030 
00031   Filename source_file;
00032   source_file = Filename::from_os_specific(argv[1]);
00033 
00034   if(!source_file.exists()) {
00035        cerr << usagestr << endl;
00036        cerr << source_file << " not found!\n";
00037        return 2;
00038   }
00039 
00040   HashVal hash;
00041   md5_a_file(source_file, hash);
00042 
00043   // output base of Filename along w/md5
00044   cout << source_file.get_basename() << " ";
00045   hash.output(cout);
00046   cout << endl;
00047   
00048   return 0;
00049 }

Generated on Fri May 2 00:36:53 2003 for Panda by doxygen1.3