jigdo API
Last update by Admin on 2010-05-23
jigdo-file-cmd.hh
Go to the documentation of this file.00001 /* $Id: jigdo-file-cmd.hh,v 1.1.1.1 2003/07/04 22:29:34 atterer Exp $ -*- C++ -*- 00002 __ _ 00003 |_) /| Copyright (C) 2001-2002 | richard@ 00004 | \/¯| Richard Atterer | atterer.net 00005 ¯ '` ¯ 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License, version 2. See 00008 the file COPYING for details. 00009 00010 */ 00017 #ifndef JIGDO_FILE_CMD_HH 00018 #define JIGDO_FILE_CMD_HH 00019 00020 #include <config.h> 00021 00022 #include <iosfwd> 00023 #include <string> 00024 00025 #include <jigdoconfig.hh> 00026 #include <scan.hh> 00027 #include <md5sum.hh> 00028 #include <mkimage.hh> 00029 #include <mktemplate.hh> 00030 //______________________________________________________________________ 00031 00034 struct AnyReporter : public MkTemplate::ProgressReporter, 00035 public JigdoCache::ProgressReporter, 00036 public JigdoDesc::ProgressReporter, 00037 public MD5Sum::ProgressReporter, 00038 public JigdoConfig::ProgressReporter { 00039 virtual void error(const string& message) { 00040 MD5Sum::ProgressReporter::error(message); 00041 } 00042 virtual void info(const string& message) { 00043 MD5Sum::ProgressReporter::info(message); 00044 } 00045 virtual void coutInfo(const string& message) { 00046 cout << message << endl; 00047 } 00048 }; 00049 //______________________________________________________________________ 00050 00052 class JigdoFileCmd { 00053 friend int main(int argc, char* argv[]); 00054 //________________________________________ 00055 00056 enum Command { 00057 MAKE_TEMPLATE, MAKE_IMAGE, 00058 PRINT_MISSING, PRINT_MISSING_ALL, 00059 SCAN, VERIFY, LIST_TEMPLATE, MD5SUM 00060 }; 00061 //________________________________________ 00062 00063 // Command line options, to be used by the jigdo-file commands 00064 # if WINDOWS 00065 static const char* const binaryName; 00066 # else 00067 friend const string& binName(); 00068 static string binaryName; // of the program 00069 # endif 00070 00071 // Names of files given on command line, and of --files-from files 00072 static RecurseDir fileNames; 00073 static string imageFile; 00074 static string jigdoFile; 00075 static string templFile; 00076 static string jigdoMergeFile; 00077 static string cacheFile; 00078 static size_t optCacheExpiry; // Expiry time for cache in seconds 00079 static vector<string> optLabels; // Strings of the form "Label=/some/path" 00080 static vector<string> optUris; // "Label=http://some.server/" 00081 static size_t blockLength; // of rsync algorithm, is also minimum file size 00082 static size_t md5BlockLength; 00083 static size_t readAmount; 00084 static int optZipQuality; 00085 static bool optBzip2; 00086 static bool optForce; // true => Silently delete existent output 00087 static bool optMkImageCheck; // true => check MD5sums 00088 static bool optCheckFiles; // true => check if files exist 00089 static bool optScanWholeFile; // false => read only first block 00090 // true => skip smaller matches if a larger match could be possible 00091 static bool optGreedyMatching; 00092 static bool optAddImage; // true => Add [Image] section to output .jigdo 00093 static bool optAddServers; // true => Add [Servers] to output .jigdo 00094 static bool optHex; // true => Use hex not base64 output for md5/ls cmds 00095 static string optDebug; // list of debug msg to turn on, or all/help 00096 // Reporter is defined in config.h and is the base of all other *Reporter's 00097 static AnyReporter* optReporter; 00098 static string optMatchExec; 00099 //________________________________________ 00100 00105 static Command cmdOptions(int argc, char* argv[]); 00106 //________________________________________ 00107 00112 static int makeTemplate(); 00113 static int makeImage(); 00114 static int printMissing(Command command = PRINT_MISSING); 00115 static int scanFiles(); 00116 static int verifyImage(); 00117 static int listTemplate(); 00118 static int md5sumFiles(); 00120 00125 static int addLabels(JigdoCache& cache); 00126 static void addUris(ConfigFile& config); 00127 static bool printMissing_lookup(JigdoConfig& jc, const string& query, 00128 bool printAll); 00130 }; 00131 //______________________________________________________________________ 00132 00135 #if WINDOWS 00136 inline const char* binName() { 00137 return "jigdo-file"; 00138 } 00139 #else 00140 inline const string& binName() { 00141 return JigdoFileCmd::binaryName; 00142 } 00143 #endif 00144 00147 extern void exit_tryHelp(); 00148 //______________________________________________________________________ 00149 00150 #endif
Generated on Tue Sep 23 14:27:41 2008 for jigdo by
