00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
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 }