 |
Disk ARchive
2.6.8
Full featured and portable backup and archiving tool
|
Go to the documentation of this file.
26 #ifndef LINE_TOOLS_HPP
27 #define LINE_TOOLS_HPP
29 #include "../my_config.h"
44 constexpr U_I LINE_TOOLS_SI_SUFFIX = 1000;
45 constexpr U_I LINE_TOOLS_BIN_SUFFIX = 1024;
50 argc_argv(S_I size = 0);
51 argc_argv(
const argc_argv & ref) {
throw Efeature(
"argc_argv"); };
52 argc_argv & operator = (
const argc_argv & ref) {
throw Efeature(
"argc_argv"); };
53 ~argc_argv() noexcept(false);
55 void resize(S_I size);
56 void set_arg(const std::
string & arg, S_I index);
59 S_I argc()
const {
return x_argc; };
60 char*
const * argv()
const {
return x_argv; };
67 extern void line_tools_slice_ownership(
const std::string & cmd, std::string & slice_permission, std::string & slice_user_ownership, std::string & slice_group_ownership);
68 extern void line_tools_repeat_param(
const std::string & cmd,
infinint & repeat_count,
infinint & repeat_byte);
69 extern void line_tools_tlv_list2argv(
user_interaction & dialog, tlv_list & list, argc_argv & arg);
75 std::string::const_iterator line_tools_find_first_char_out_of_parenth(
const std::string & argument,
unsigned char to_find);
76 std::string::const_iterator line_tools_find_last_char_out_of_parenth(
const std::string & argument,
unsigned char to_find);
78 std::string line_tools_expand_user_comment(
const std::string & user_comment, S_I argc,
char *
const argv[]);
105 const char *getopt_string,
107 const struct option *long_options,
110 std::deque<char> & presence);
125 const char *getopt_string,
127 const struct option *long_options,
130 bool & Q_is_present);
137 std::string::const_iterator be = val.begin();
138 std::string::const_iterator ne = val.begin();
141 while(ne != val.end())
147 split.push_back(std::string(be, ne));
154 split.push_back(std::string(be, ne));
157 extern std::set<std::string> line_tools_deque_to_set(
const std::deque<std::string> & list);
159 extern void line_tools_4_4_build_compatible_overwriting_policy(
bool allow_over,
175 bool & no_cipher_given,
176 std::vector<std::string> & recipients);
234 std::string & hostname,
236 std::string & path_basename);
276 const std::string & extension);
297 std::deque <char> quotes;
298 std::string current =
"";
301 bool escaped =
false;
306 if(f.
read(&a, 1) != 1)
341 quotes.push_back(
' ');
349 if(quotes.back() !=
' ')
364 if(a == quotes.back())
369 mots.push_back(current);
402 mem.
write(arg.c_str(), arg.size());
413 const std::string & relative_part);
std::string line_tools_get_hostname()
return a string containing the hostname of the current host
void line_tools_split_in_words(generic_file &f, T &mots)
read a file and split its contents into words
std::string line_tools_get_full_path_from_PATH(const std::deque< std::string > &the_path, const char *filename)
return the full path of the given filename (eventually unchanged of pointing to the first file of tha...
std::string line_tools_get_egid()
return a string containing the Effective UID
virtual void write(const char *a, U_I size) override
write data to the generic_file inherited from proto_generic_file
std::string line_tools_build_regex_for_exclude_mask(const std::string &prefix, const std::string &relative_part)
builds a regex from root directory and user provided regex to be applied to the relative path
This is a pure virtual class that is used by libdar when interaction with the user is required.
const char * line_tools_get_from_env(const char **env, const char *clef)
isolate the value of a given variable from the environment vector
the arbitrary large positive integer class
exception used when a requested feature is not (yet) implemented
void line_tools_split(const std::string &val, char sep, T &split)
split a line in words given the separator character (sep)
void line_tools_look_for(const std::deque< char > &arguments, S_I argc, char *const argv[], const char *getopt_string, char stop_scan, std::deque< char > &presence)
test the presence of a set of argument on the command line
std::string tools_printf(const char *format,...)
make printf-like formating to a std::string
virtual bool skip(const infinint &pos) override
skip at the absolute position
std::deque< std::string > line_tools_explode_PATH(const char *the_path)
split a PATH environement variable string into its components (/usr/lib:/lib => /usr/lib /lib)
void line_tools_read_range(const std::string &s, S_I &min, U_I &max)
from a string with a range notation (min-max) extract the range values
std::string line_tools_get_euid()
return a string containing the Effective UID
S_I line_tools_str2signed_int(const std::string &x)
convert a signed integer written in decimal notation to the corresponding value
void line_tools_crypto_split_algo_pass(const secu_string &all, crypto_algo &algo, secu_string &pass, bool &no_cipher_given, std::vector< std::string > &recipients)
std::deque< std::string > line_tools_substract_from_deque(const std::deque< std::string > &a, const std::deque< std::string > &b)
remove from 'a' elements found in 'b' and return the resulting deque
the class path is here to manipulate paths in the Unix notation: using'/'
bool line_tools_split_entrepot_path(const std::string &all, std::string &proto, std::string &login, secu_string &password, std::string &hostname, std::string &port, std::string &path_basename)
split a given full remote repository path in parts
generic_file stored in memory
this is the interface class from which all other data transfer classes inherit
exception used to signal range error
void line_tools_split_at_first_space(const char *field, std::string &before_space, std::string &after_space)
return split at the first space met the string given as first argument, and provide the two splitted ...
void line_tools_check_basename(user_interaction &dialog, const path &loc, std::string &base, const std::string &extension)
does sanity checks on a slice name, check presence and detect whether the given basename is not rathe...
virtual U_I read(char *a, U_I size) override
read data from the generic_file inherited from proto_generic_file
void line_tools_split_path_basename(const char *all, path *&chemin, std::string &base)
split a given full path in path part and basename part
void line_tools_display_signatories(user_interaction &ui, const std::list< signator > &gnupg_signed)
display information about the signatories
List of Generic Type Length Value data structures.
void line_tools_read_from_pipe(std::shared_ptr< user_interaction > &dialog, S_I fd, tlv_list &result)
Extract from anonymous pipe a tlv_list.
void line_tools_look_for_Q(S_I argc, char *const argv[], const char *getopt_string, char stop_scan, bool &Q_is_present)
test the presence of -Q and -j options on the command line
S_I line_tools_reset_getopt()
returns the old position of parsing (next argument to parse)
crypto_algo
the different cypher available for encryption (strong or weak)
void line_tools_merge_to_deque(std::deque< std::string > &a, const std::deque< std::string > &b)
add in 'a', element of 'b' not already found in 'a'
const char * dar_gettext(const char *)
a routine to change NLS domaine forth and back for inline routines
std::string line_tools_get_date_utc()
return a string containing the current time (UTC)
std::string::iterator line_tools_find_first_char_of(std::string &s, unsigned char v)
give a pointer to the last character of the given value in the given string
the main file of the libdar API definitions
the global action for overwriting
infinint line_tools_convert_date(const std::string &repres)
convert a human readable date representation in number of second since the system reference date
void line_tools_display_features(user_interaction &dialog)
display the compilation time features of libdar
fs_function_t
defines the function to use to derivate block size from file size
delta_sig_block_size::fs_function_t line_tools_string_to_sig_block_size_function(const std::string &funname)
converts string name to function
libdar namespace encapsulate all libdar symbols
void line_tools_extract_basename(const char *command_name, std::string &basename)
extracts the basename of a file (removing path part)