Panda3D
|
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 #ifndef HAVE_GETOPT 00017 #include "gnu_getopt.h" 00018 #else 00019 #include <getopt.h> 00020 #endif 00021 #include "patchfile.h" 00022 #include "filename.h" 00023 00024 int 00025 main(int argc, char *argv[]) { 00026 if (argc < 3) { 00027 cerr << "Usage: apply_patch <patch_file> <old_file>" << endl; 00028 cerr << "Will overwrite old_file" << endl; 00029 return 1; 00030 } 00031 00032 Filename patch = argv[1]; 00033 patch.set_binary(); 00034 00035 Filename file = argv[2]; 00036 file.set_binary(); 00037 00038 Patchfile pfile; 00039 00040 cerr << "Applying patch file " << patch << " to " << file << endl; 00041 if (pfile.apply(patch, file) == false) { 00042 cerr << "apply patch failed" << endl; 00043 return 1; 00044 } 00045 00046 return 0; 00047 }