2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1991-1998 University of Maryland at College Park
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of U.M. not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. U.M. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Authors: the Amanda Development Team. Its members are listed in a
24 * file named AUTHORS, in the root directory of this distribution.
27 * $Id: client_util.h,v 1.14 2006/05/25 01:47:11 johnfranks Exp $
36 #include "amfeatures.h"
38 #include "util.h" /* for bstrncmp() */
39 #include "amandad.h" /* for g_option_t */
40 #include "amxml.h" /* for dle_t */
42 typedef struct backup_support_option_s {
62 } backup_support_option_t;
64 typedef struct client_script_result_s {
69 } client_script_result_t;
71 char *build_exclude(dle_t *dle, int verbose);
72 char *build_include(dle_t *dle, int verbose);
73 void parse_options(char *str,
75 am_feature_t *features,
78 /* Count the size of an ARGV to store all properties of an application for
79 * a dle. include/exclude options are converted to properties.
82 * @returns: size of an ARGV needed.
84 int application_property_argv_size(dle_t *dle);
86 /* Add all properties of an application for a dle to an ARGV.
87 * include/exclude options are converted to properties.
89 * @param argvchild: the ARGV where to store properties.
90 * @param dle: the dle.
91 * @returns: Number of argument added to ARGV.
93 int application_property_add_to_argv(char **argvchild,
95 backup_support_option_t *bsu);
97 char *fixup_relative(char *name, char *device);
98 backup_support_option_t *backup_support_option(char *program,
99 g_option_t *g_options,
102 GPtrArray **errarray);
104 void run_client_script(script_t *script,
105 execute_on_t execute_on,
106 g_option_t *g_options,
109 void run_client_scripts(execute_on_t execute_on,
110 g_option_t *g_options,
114 void run_calcsize(char *config, char *program, char *disk,
115 char *dirname, GSList *levels,
116 char *file_exclude, char *file_include);
118 void check_access(char *filename, int mode);
119 void check_file(char *filename, int mode);
120 void check_dir(char *dirname, int mode);
121 void check_suid(char *filename);
122 double the_num(char * str, int pos);
124 /* Convert a GSList returned from config_errors into an "ERROR "
125 * line suitable for inclusion in a NAK or REP packet. Because we only
126 * get one ERROR line per packet, this includes only the first
127 * error, with an indication that there are more to follow.
129 * @param errlist: the list of errors from config_errors
130 * @returns: newly allocated string containing the error messages
132 char *config_errors_to_error_string(GSList *errlist);