Disk ARchive  2.7.14
Full featured and portable backup and archiving tool
dar_suite.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2024 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // to contact the author, see the AUTHOR file
20 /*********************************************************************/
21 
25 
26 #ifndef DAR_SUITE_HPP
27 #define DAR_SUITE_HPP
28 
29 #include "../my_config.h"
30 #include "libdar.hpp"
31 #include <memory>
32 
33 #define EXIT_OK 0 // all that was asked is done
34 #define EXIT_SYNTAX 1 // syntax error on command line
35 #define EXIT_ERROR 2 // error not related to the data treated
36  // (lack of memory, hardware problem, etc.)
37 #define EXIT_BUG 3 // detected a condition that should never happen
38 #define EXIT_USER_ABORT 4 // user asked to abort (or question in non
39  // interactive mode)
40 #define EXIT_DATA_ERROR 5 // error in data treated (could not save/restore/
41  // compare all data due for example to bad access permission. Comparison
42  // mismatch of some files, archive testing failed etc...)
43 #define EXIT_SCRIPT_ERROR 6 // error around the execution of a user command
44  // using -E or -F options
45 #define EXIT_LIBDAR 7 // error calling libdar. Arguments given to libdar
46  // do not match those expected (sanity checks warning).
47 #define EXIT_LIMITINT 8 // limitinit overflow
48  // fixed using full infinint version of the program
49 #define EXIT_UNKNOWN_ERROR 9
50  // error not possible to report by other mean no access to stdout/stderr)
51 #define EXIT_COMPILATION 10 // feature not activated at compilation time
52 #define EXIT_SAVED_MODIFIED 11 // some files have been modified at the time they were saved
53 
54 #define EXTENSION "dar"
55 
57 #ifndef __VERSION__
58 #define __VERSION__ "unknown"
59 #endif
60 
62 #ifdef __GNUC__
63 #define CC_NAT "GNUC"
64 #else
65 #define CC_NAT "unknown"
66 #endif
67 
68 using namespace libdar;
69 
72 
73 using cli_callback = S_I (*)(std::shared_ptr<user_interaction> & dialog, int, char *const [], const char **env);
74 
75 extern void dar_suite_reset_signal_handler();
76 
78 
83 #if HAVE_GETOPT_LONG
85 #endif
89 extern int dar_suite_global(int argc,
90  char * const argv[],
91  const char **env,
92  const char *getopt_string,
93 #if HAVE_GETOPT_LONG
94  const struct option *long_options,
95 #endif
96  char stop_scan,
97  cli_callback call);
98 
99 extern std::string dar_suite_command_line_features();
100 
102 
103 #endif
int dar_suite_global(int argc, char *const argv[], const char **env, const char *getopt_string, char stop_scan, cli_callback call)
common routine for all dar command-line tools to initialize environment and convert uncaught exceptio...
the main file of the libdar API definitions
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47