/*
- * Copyright (c) 2007, 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved.
+ * Copyright (c) 2007-2012 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
- * by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* Utility routines for handling command lines.
*/
-#include <ctype.h>
#include "amanda.h"
+#include <ctype.h>
#include "match.h"
#include "cmdline.h"
#include "holding.h"
char *host,
char *disk,
char *datestamp,
- char *level)
+ char *level,
+ char *write_timestamp)
{
dumpspec_t *rv;
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;
}
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);
}
enum { ARG_GET_HOST, ARG_GET_DISK, ARG_GET_DATESTAMP, ARG_GET_LEVEL } arg_state = ARG_GET_HOST;
while (optind < argc) {
+ char *new_name = NULL;
name = argv[optind];
+ if (flags & CMDLINE_EXACT_MATCH && *name != '=') {
+ new_name = g_strconcat("=", name, NULL);
+ name = new_name;
+ }
switch (arg_state) {
case ARG_GET_HOST:
arg_state = ARG_GET_DISK;
- dumpspec = dumpspec_new(name, NULL, NULL, NULL);
+ dumpspec = dumpspec_new(name, NULL, NULL, NULL, NULL);
list = g_slist_append(list, (gpointer)dumpspec);
break;
arg_state = ARG_GET_HOST;
if (!(flags & CMDLINE_PARSE_LEVEL)) continue;
if (name[0] != '\0'
+ && !(flags & CMDLINE_EXACT_MATCH)
&& (errstr=validate_regexp(name)) != NULL) {
error(_("bad level regex \"%s\": %s\n"), name, errstr);
}
dumpspec->level = stralloc(name);
break;
}
+ amfree(new_name);
optind++;
}
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);
}
dumpfile_free_data(&file);
}
- g_slist_free_full(holding_files);
+ slist_free_full(holding_files, g_free);
return matching_files;
}