Disk ARchive  2.5.2
Full featured and portable backup and archiving tool
line_tools.hpp
Go to the documentation of this file.
00001 /*********************************************************************/
00002 // dar - disk archive - a backup/restoration program
00003 // Copyright (C) 2002-2052 Denis Corbin
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 //
00019 // to contact the author : http://dar.linux.free.fr/email.html
00020 /*********************************************************************/
00021 
00025 
00026 #ifndef LINE_TOOLS_HPP
00027 #define LINE_TOOLS_HPP
00028 
00029 #include "../my_config.h"
00030 
00031 #include <string>
00032 #include <vector>
00033 #include "infinint.hpp"
00034 #include "tlv_list.hpp"
00035 #include "integers.hpp"
00036 #include "criterium.hpp"
00037 
00038 using namespace libdar;
00039 
00042 
00043 class argc_argv
00044 {
00045 public:
00046     argc_argv(S_I size = 0);
00047     argc_argv(const argc_argv & ref) { throw Efeature("argc_argv"); };
00048     const argc_argv & operator = (const argc_argv & ref) { throw Efeature("argc_argv"); };
00049     ~argc_argv();
00050 
00051     void resize(S_I size);
00052     void set_arg(const std::string & arg, S_I index);
00053     void set_arg(generic_file & f, U_I size, S_I index);
00054 
00055     S_I argc() const { return x_argc; };
00056     char* const * argv() const { return x_argv; }; // well, the const method is a bit silly, as the caller has the possibility to modify what is pointed to by the returned value...
00057 
00058 private:
00059     S_I x_argc;
00060     char **x_argv;
00061 };
00062 
00063 extern void line_tools_slice_ownership(const std::string & cmd, std::string & slice_permission, std::string & slice_user_ownership, std::string & slice_group_ownership);
00064 extern void line_tools_repeat_param(const std::string & cmd, infinint & repeat_count, infinint & repeat_byte);
00065 extern void line_tools_tlv_list2argv(user_interaction & dialog, tlv_list & list, argc_argv & arg);
00066 
00068 extern S_I line_tools_reset_getopt();
00069 
00070 
00071 std::string::const_iterator line_tools_find_first_char_out_of_parenth(const std::string & argument, unsigned char to_find);
00072 std::string::const_iterator line_tools_find_last_char_out_of_parenth(const std::string & argument, unsigned char to_find);
00073 
00074 std::string line_tools_expand_user_comment(const std::string & user_comment, S_I argc, char *const argv[]);
00075 
00077 std::vector<std::string> line_tools_explode_PATH(const char *the_path);
00078 
00080 std::string line_tools_get_full_path_from_PATH(const std::vector<std::string> & the_path, const char * filename);
00081 
00083 void line_tools_split_at_first_space(const char *field, std::string & before_space, std::string & after_space);
00084 
00085 void line_tools_get_min_digits(std::string arg, infinint & num, infinint & ref_num, infinint & aux_num);
00086 
00093 #if HAVE_GETOPT_LONG
00094 
00095 #endif
00096 
00097 
00098 extern void line_tools_look_for(const std::vector<char> & arguments,
00099                 S_I argc,
00100                 char *const argv[],
00101                 const char *getopt_string,
00102 #if HAVE_GETOPT_LONG
00103                 const struct option *long_options,
00104 #endif
00105                 char stop_scan,
00106                 std::vector<char> & presence);
00107 
00108 
00114 #if HAVE_GETOPT_LONG
00115 
00116 #endif
00117 
00118 
00119 extern void line_tools_look_for_Q(S_I argc,
00120                    char *const argv[],
00121                    const char *getopt_string,
00122 #if HAVE_GETOPT_LONG
00123                    const struct option *long_options,
00124 #endif
00125                    char stop_scan,
00126                    bool & Q_is_present);
00127 
00128 
00130 
00131 extern std::vector<std::string> line_tools_split(const std::string & val, char sep);
00132 
00133 extern void line_tools_4_4_build_compatible_overwriting_policy(bool allow_over,
00134                                    bool detruire,
00135                                    bool more_recent,
00136                                    const libdar::infinint & hourshift,
00137                                    bool ea_erase,
00138                                    const libdar::crit_action * & overwrite);
00139 
00146 extern void line_tools_crypto_split_algo_pass(const secu_string & all,
00147                           crypto_algo & algo,
00148                           secu_string & pass,
00149                           bool & no_cipher_given,
00150                           std::vector<std::string> & recipients);
00151 
00153 extern void line_tools_display_signatories(user_interaction & ui, const std::list<signator> & gnupg_signed);
00154 
00156 
00157 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines