projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use of ../amanda looks out of date
[debian/amanda]
/
server-src
/
cmdline.c
diff --git
a/server-src/cmdline.c
b/server-src/cmdline.c
index 816c19488a71260fffe5cb8db56826ced6f5e731..28a842f73158997ebd24db81912d8a22c2dbfe88 100644
(file)
--- a/
server-src/cmdline.c
+++ b/
server-src/cmdline.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 200
5 Zmanda
Inc. All Rights Reserved.
+ * Copyright (c) 200
7, 2008, 2009, 2010 Zmanda,
Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
@@
-14,8
+14,8
@@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Contact information: Zmanda Inc,
505 N Mathlida Ave, Suite 12
0
- * Sunnyvale, CA 9408
5
, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc,
465 S. Mathilda Ave., Suite 30
0
+ * Sunnyvale, CA 9408
6
, USA, or: http://www.zmanda.com
*
* Author: Dustin J. Mitchell <dustin@zmanda.com>
*/
*
* Author: Dustin J. Mitchell <dustin@zmanda.com>
*/
@@
-25,8
+25,9
@@
* Utility routines for handling command lines.
*/
* Utility routines for handling command lines.
*/
-#include <ctype.h>
#include "amanda.h"
#include "amanda.h"
+#include <ctype.h>
+#include "match.h"
#include "cmdline.h"
#include "holding.h"
#include "cmdline.h"
#include "holding.h"
@@
-35,16
+36,17
@@
dumpspec_new(
char *host,
char *disk,
char *datestamp,
char *host,
char *disk,
char *datestamp,
- char *level)
+ char *level,
+ char *write_timestamp)
{
dumpspec_t *rv;
{
dumpspec_t *rv;
- rv = calloc(1, sizeof(*rv));
- if (!rv) return NULL;
+ rv = g_new0(dumpspec_t, 1);
if (host) rv->host = stralloc(host);
if (disk) rv->disk = stralloc(disk);
if (datestamp) rv->datestamp = stralloc(datestamp);
if (level) rv->level = stralloc(level);
if (host) rv->host = stralloc(host);
if (disk) rv->disk = stralloc(disk);
if (datestamp) rv->datestamp = stralloc(datestamp);
if (level) rv->level = stralloc(level);
+ if (write_timestamp) rv->write_timestamp = stralloc(write_timestamp);
return rv;
}
return rv;
}
@@
-58,6
+60,7
@@
dumpspec_free(
if (dumpspec->disk) free(dumpspec->disk);
if (dumpspec->datestamp) free(dumpspec->datestamp);
if (dumpspec->level) free(dumpspec->level);
if (dumpspec->disk) free(dumpspec->disk);
if (dumpspec->datestamp) free(dumpspec->datestamp);
if (dumpspec->level) free(dumpspec->level);
+ if (dumpspec->write_timestamp) free(dumpspec->write_timestamp);
free(dumpspec);
}
free(dumpspec);
}
@@
-90,30
+93,18
@@
cmdline_parse_dumpspecs(
switch (arg_state) {
case ARG_GET_HOST:
arg_state = ARG_GET_DISK;
switch (arg_state) {
case ARG_GET_HOST:
arg_state = ARG_GET_DISK;
- if (name[0] != '\0'
- && (errstr=validate_regexp(name)) != NULL) {
- error(_("bad hostname regex \"%s\": %s\n"), name, errstr);
- }
- dumpspec = dumpspec_new(name, NULL, NULL, NULL);
+ dumpspec = dumpspec_new(name, NULL, NULL, NULL, NULL);
list = g_slist_append(list, (gpointer)dumpspec);
break;
case ARG_GET_DISK:
arg_state = ARG_GET_DATESTAMP;
list = g_slist_append(list, (gpointer)dumpspec);
break;
case ARG_GET_DISK:
arg_state = ARG_GET_DATESTAMP;
- if (name[0] != '\0'
- && (errstr=validate_regexp(name)) != NULL) {
- error(_("bad diskname regex \"%s\": %s\n"), name, errstr);
- }
dumpspec->disk = stralloc(name);
break;
case ARG_GET_DATESTAMP:
arg_state = ARG_GET_LEVEL;
if (!(flags & CMDLINE_PARSE_DATESTAMP)) continue;
dumpspec->disk = stralloc(name);
break;
case ARG_GET_DATESTAMP:
arg_state = ARG_GET_LEVEL;
if (!(flags & CMDLINE_PARSE_DATESTAMP)) continue;
- if (name[0] != '\0'
- && (errstr=validate_regexp(name)) != NULL) {
- error(_("bad datestamp regex \"%s\": %s\n"), name, errstr);
- }
dumpspec->datestamp = stralloc(name);
break;
dumpspec->datestamp = stralloc(name);
break;
@@
-136,7
+127,7
@@
cmdline_parse_dumpspecs(
if (list == NULL && (flags & CMDLINE_EMPTY_TO_WILDCARD)) {
dumpspec = dumpspec_new("", "",
(flags & CMDLINE_PARSE_DATESTAMP)?"":NULL,
if (list == NULL && (flags & CMDLINE_EMPTY_TO_WILDCARD)) {
dumpspec = dumpspec_new("", "",
(flags & CMDLINE_PARSE_DATESTAMP)?"":NULL,
- (flags & CMDLINE_PARSE_LEVEL)?"":NULL);
+ (flags & CMDLINE_PARSE_LEVEL)?"":NULL
, ""
);
list = g_slist_append(list, (gpointer)dumpspec);
}
list = g_slist_append(list, (gpointer)dumpspec);
}
@@
-241,7
+232,10
@@
cmdline_match_holding(
for (hi = holding_files; hi != NULL; hi = hi->next) {
/* TODO add level */
if (!holding_file_get_dumpfile((char *)hi->data, &file)) continue;
for (hi = holding_files; hi != NULL; hi = hi->next) {
/* TODO add level */
if (!holding_file_get_dumpfile((char *)hi->data, &file)) continue;
- if (file.type != F_DUMPFILE) continue;
+ if (file.type != F_DUMPFILE) {
+ dumpfile_free_data(&file);
+ continue;
+ }
for (li = dumpspec_list; li != NULL; li = li->next) {
de = (dumpspec_t *)(li->data);
if (de->host && de->host[0] && !match_host(de->host, file.name)) continue;
for (li = dumpspec_list; li != NULL; li = li->next) {
de = (dumpspec_t *)(li->data);
if (de->host && de->host[0] && !match_host(de->host, file.name)) continue;
@@
-250,9
+244,10
@@
cmdline_match_holding(
matching_files = g_slist_append(matching_files, g_strdup((char *)hi->data));
break;
}
matching_files = g_slist_append(matching_files, g_strdup((char *)hi->data));
break;
}
+ dumpfile_free_data(&file);
}
}
-
g_slist_free_full(holding_files
);
+
slist_free_full(holding_files, g_free
);
return matching_files;
}
return matching_files;
}