Panda3D

apply_patch.cxx

00001 // Filename: apply_patch.cxx
00002 // Created by:  
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "pandabase.h"
00016 #include "panda_getopt.h"
00017 #include "preprocess_argv.h"
00018 #include "patchfile.h"
00019 #include "filename.h"
00020 
00021 int
00022 main(int argc, char **argv) {
00023   preprocess_argv(argc, argv);
00024 
00025   if (argc < 3) {
00026     cerr << "Usage: apply_patch <patch_file> <old_file>" << endl;
00027     cerr << "Will overwrite old_file" << endl;
00028     return 1;
00029   }
00030 
00031   Filename patch = argv[1];
00032   patch.set_binary();
00033 
00034   Filename file = argv[2];
00035   file.set_binary();
00036 
00037   Patchfile pfile;
00038 
00039   cerr << "Applying patch file " << patch << " to " << file << endl;
00040   if (pfile.apply(patch, file) == false) {
00041     cerr << "apply patch failed" << endl;
00042     return 1;
00043   }
00044 
00045   return 0;
00046 }
 All Classes Functions Variables Enumerations