/*
* Amanda, The Advanced Maryland Automatic Network Disk Archiver
* Copyright (c) 1991-1998 University of Maryland at College Park
+ * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved.
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* argv[1] is the config name or NOCONFIG
*/
#include "amanda.h"
+#include "match.h"
+#include "conffile.h"
#include "fsusage.h"
-#include "version.h"
-#include "sl.h"
+#include "am_sl.h"
#include "util.h"
#define ROUND(n,x) ((x) + (n) - 1 - (((x) + (n) - 1) % (n)))
void add_file_unknown(int, struct stat *);
off_t final_size_unknown(int, char *);
-sl_t *calc_load_file(char *filename);
+am_sl_t *calc_load_file(char *filename);
int calc_check_exclude(char *filename);
int use_star_excl = 0;
int use_gtar_excl = 0;
-sl_t *include_sl=NULL, *exclude_sl=NULL;
+am_sl_t *include_sl=NULL, *exclude_sl=NULL;
int
main(
set_pname("calcsize");
dbopen(NULL);
+ config_init(CONFIG_INIT_CLIENT, NULL);
/* Don't die when child closes pipe */
signal(SIGPIPE, SIG_IGN);
char *amname=NULL, *qamname=NULL;
char *filename=NULL, *qfilename = NULL;
- /* drop root privileges; we'll regain them for the required operations */
-#ifdef WANT_SETUID_CLIENT
- if (!set_root_privs(0)) {
- error(_("calcsize must be run setuid root"));
+ if (argc > 1 && argv && argv[1] && g_str_equal(argv[1], "--version")) {
+ printf("calcsize-%s\n", VERSION);
+ return (0);
}
-#endif
safe_fd(-1, 0);
safe_cd();
set_pname("calcsize");
dbopen(DBG_SUBDIR_CLIENT);
- dbprintf(_("version %s\n"), version());
+ config_init(CONFIG_INIT_CLIENT, NULL);
+ dbprintf(_("version %s\n"), VERSION);
-#if 0
- erroutput_type = (ERR_INTERACTIVE|ERR_SYSLOG);
+ /* drop root privileges; we'll regain them for the required operations */
+#ifdef WANT_SETUID_CLIENT
+ check_running_as(RUNNING_AS_CLIENT_LOGIN | RUNNING_AS_UID_ONLY);
+ if (!set_root_privs(0)) {
+ error(_("calcsize must be run setuid root"));
+ }
+#else
+ check_running_as(RUNNING_AS_CLIENT_LOGIN);
#endif
argc--, argv++; /* skip program name */
argc--;
argv++;
- check_running_as(RUNNING_AS_CLIENT_LOGIN);
-
/* parse backup program name */
if(strcmp(*argv, "DUMP") == 0) {
/*
* =========================================================================
*/
-sl_t *
+am_sl_t *
calc_load_file(
char * filename)
{
char pattern[1025];
- sl_t *sl_list;
+ am_sl_t *sl_list;
FILE *file = fopen(filename, "r");