$(MKDIR) $(DESTDIR)$(sbindir)
$(MKDIR) $(DESTDIR)$(sysconfdir)
$(MKDIR) $(DESTDIR)$(scriptdir)
- $(MKDIR) $(DESTDIR)$(working_dir)
+ if test ! -e $(DESTDIR)$(working_dir) ; then \
+ $(MKDIR) $(DESTDIR)$(working_dir); \
+ -chmod 770 $(DESTDIR)$(working_dir); \
+ fi
if test "x$(dir_user)" != "x" ; then \
- chown -f $(dir_user) $(DESTDIR)$(working_dir); fi
+ -chown -f $(dir_user) $(DESTDIR)$(working_dir); \
+ fi
if test "x$(dir_group)" != "x" ; then \
- chown -f :$(dir_group) $(DESTDIR)$(working_dir); fi
+ -chown -f :$(dir_group) $(DESTDIR)$(working_dir); \
+ fi
# $(MKDIR) $(DESTDIR)$(mandir)
gnomedirs:
Makefiles:
$(SHELL) config.status
(cd scripts; \
- chmod 755 startmysql stopmysql bacula startit stopit btraceback; \
- chmod 755 mtx-changer bconsole gconsole devel_bacula; \
- chmod 755 dvd-handler)
+ chmod 755 startmysql stopmysql bacula startit stopit btraceback; \
+ chmod 755 mtx-changer bconsole gconsole devel_bacula; \
+ chmod 755 dvd-handler)
(cd src/cats; \
- chmod 755 create_bacula_database update_bacula_tables make_bacula_tables; \
- chmod 755 grant_bacula_privileges drop_bacula_tables drop_bacula_database; \
- \
- chmod 755 create_@DB_NAME@_database update_@DB_NAME@_tables make_@DB_NAME@_tables; \
- chmod 755 grant_@DB_NAME@_privileges drop_@DB_NAME@_tables drop_@DB_NAME@_database; \
- \
- chmod 755 make_catalog_backup delete_catalog_backup)
+ chmod 755 create_bacula_database update_bacula_tables make_bacula_tables; \
+ chmod 755 grant_bacula_privileges drop_bacula_tables drop_bacula_database; \
+ chmod 755 create_@DB_NAME@_database update_@DB_NAME@_tables make_@DB_NAME@_tables; \
+ chmod 755 grant_@DB_NAME@_privileges drop_@DB_NAME@_tables drop_@DB_NAME@_database; \
+ chmod 755 make_catalog_backup delete_catalog_backup)
clean:
@for I in ${all_subdirs}; \
Kern Sibbald
General:
+Release 1.38.8
+11Apr06
+- Modify Makefile to change the permissions on Working Directory
+ to 770 if the directory is created.
+- Do not fail the Makefile if changing the permissions or
+ owner/group on WorkingDir fails.
+- Remove early selection of Scratch Volumes in the recycling
+ algorithm.
+- Correct the old recycling algorithm so that Scratch Volumes
+ are selected when looking for a Volume in the changer.
+- Correct a typo in the Verify SQL reported by Joe Park.
+10Apr06
+- Remove automatic case folding on Windows FDs. You must
+ explictly use the 'Ignore Case = yes' option.
+- Remove the code added to 1.38.6 and 1.38.7 that pulls a
+ scratch volume in an Autochanger early in the 'recycling'
+ algorithm.
+08Apr06
+- Tweak license to include Microsoft restrictions.
+- Move mysql.reconnect to after real_connect(). Thanks to
+ Frank Sweetser for the patch.
+- Disallow a backslash in a File = directive (Windows junk)
+ unless the string is quoted.
+- Apply Eric's patch to ua_label.c so that daemon protocol
+ is not translated.
+
Release 1.38.7 (06Apr06) released 07Apr06
+06Apr06
- Remove timed wait for VSS on Win2K3 as it is not yet
implemented.
- Correct bacula.in script to reference bacula-ctl-xx in the
Kern Sibbald
General:
+11Apr06
+- More work on migration.
+- Implement wild program in tools directory for testing
+ wild-cards. Almost identical to the regex program.
+- Up port VSS single thread locking code.
+- Replace N_(..) by NT_(...) to inhibit translation of
+ commands.
+- Modify Makefile to change the permissions on Working Directory
+ to 770 if the directory is created.
+- Do not fail the Makefile if changing the permissions or
+ owner/group on WorkingDir fails.
+- Remove early selection of Scratch Volumes in the recycling
+ algorithm.
+- Correct the old recycling algorithm so that Scratch Volumes
+ are selected when looking for a Volume in the changer.
+- Correct a typo in the Verify SQL reported by Joe Park.
+10Apr06
+- Remove automatic case folding on Windows FDs. You must
+ explictly use the 'Ignore Case = yes' option.
+- Remove the code added to 1.38.6 and 1.38.7 that pulls a
+ scratch volume in an Autochanger early in the 'recycling'
+ algorithm.
09Apr06
- Make weof() and clrerror() methods of class DEVICE.
08Apr06
}
/* Mark the file record as being visited during database
- * verify compare. Stuff JobId into MarkedId field
+ * verify compare. Stuff JobId into the MarkId field
*/
int db_mark_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId)
{
static int date_item(JCR *jcr, int code,
- const char **val_ptr, int *val_len, int *val_size)
+ const char **val_ptr, int *val_len, int *val_size)
{
struct tm tm;
time_t now = time(NULL);
char buf[10];
switch (code) {
- case 1: /* year */
+ case 1: /* year */
val = tm.tm_year + 1900;
break;
- case 2: /* month */
+ case 2: /* month */
val = tm.tm_mon + 1;
break;
- case 3: /* day */
+ case 3: /* day */
val = tm.tm_mday;
break;
- case 4: /* hour */
+ case 4: /* hour */
val = tm.tm_hour;
break;
- case 5: /* minute */
+ case 5: /* minute */
val = tm.tm_min;
break;
- case 6: /* second */
+ case 6: /* second */
val = tm.tm_sec;
break;
- case 7: /* Week day */
+ case 7: /* Week day */
val = tm.tm_wday;
break;
}
}
static int job_item(JCR *jcr, int code,
- const char **val_ptr, int *val_len, int *val_size)
+ const char **val_ptr, int *val_len, int *val_size)
{
const char *str = " ";
char buf[20];
switch (code) {
- case 1: /* Job */
+ case 1: /* Job */
str = jcr->job->hdr.name;
break;
case 2: /* Director's name */
str = my_name;
break;
- case 3: /* level */
+ case 3: /* level */
str = job_level_to_str(jcr->JobLevel);
break;
- case 4: /* type */
+ case 4: /* type */
str = job_type_to_str(jcr->JobType);
break;
- case 5: /* JobId */
+ case 5: /* JobId */
bsnprintf(buf, sizeof(buf), "%d", jcr->JobId);
str = buf;
break;
- case 6: /* Client */
+ case 6: /* Client */
str = jcr->client->hdr.name;
if (!str) {
- str = " ";
+ str = " ";
}
break;
- case 7: /* NumVols */
+ case 7: /* NumVols */
bsnprintf(buf, sizeof(buf), "%d", jcr->NumVols);
str = buf;
break;
- case 8: /* Pool */
+ case 8: /* Pool */
str = jcr->pool->hdr.name;
break;
- case 9: /* Storage */
+ case 9: /* Storage */
str = jcr->store->hdr.name;
break;
- case 10: /* Catalog */
+ case 10: /* Catalog */
str = jcr->catalog->hdr.name;
break;
- case 11: /* MediaType */
+ case 11: /* MediaType */
str = jcr->store->media_type;
break;
- case 12: /* JobName */
+ case 12: /* JobName */
str = jcr->Job;
break;
}
struct s_built_in_vars {const char *var_name; int code; int (*func)(JCR *jcr, int code,
- const char **val_ptr, int *val_len, int *val_size);};
+ const char **val_ptr, int *val_len, int *val_size);};
/*
* Table of build in variables
*/
static struct s_built_in_vars built_in_vars[] = {
- { N_("Year"), 1, date_item},
- { N_("Month"), 2, date_item},
- { N_("Day"), 3, date_item},
- { N_("Hour"), 4, date_item},
- { N_("Minute"), 5, date_item},
- { N_("Second"), 6, date_item},
- { N_("WeekDay"), 7, date_item},
-
- { N_("Job"), 1, job_item},
- { N_("Dir"), 2, job_item},
- { N_("Level"), 3, job_item},
- { N_("Type"), 4, job_item},
- { N_("JobId"), 5, job_item},
- { N_("Client"), 6, job_item},
- { N_("NumVols"), 7, job_item},
- { N_("Pool"), 8, job_item},
- { N_("Storage"), 9, job_item},
- { N_("Catalog"), 10, job_item},
- { N_("MediaType"), 11, job_item},
- { N_("JobName"), 12, job_item},
+ { NT_("Year"), 1, date_item},
+ { NT_("Month"), 2, date_item},
+ { NT_("Day"), 3, date_item},
+ { NT_("Hour"), 4, date_item},
+ { NT_("Minute"), 5, date_item},
+ { NT_("Second"), 6, date_item},
+ { NT_("WeekDay"), 7, date_item},
+
+ { NT_("Job"), 1, job_item},
+ { NT_("Dir"), 2, job_item},
+ { NT_("Level"), 3, job_item},
+ { NT_("Type"), 4, job_item},
+ { NT_("JobId"), 5, job_item},
+ { NT_("Client"), 6, job_item},
+ { NT_("NumVols"), 7, job_item},
+ { NT_("Pool"), 8, job_item},
+ { NT_("Storage"), 9, job_item},
+ { NT_("Catalog"), 10, job_item},
+ { NT_("MediaType"), 11, job_item},
+ { NT_("JobName"), 12, job_item},
{ NULL, 0, NULL}
};
* call the appropriate subroutine to do the work.
*/
static var_rc_t lookup_built_in_var(var_t *ctx, void *my_ctx,
- const char *var_ptr, int var_len, int var_index,
- const char **val_ptr, int *val_len, int *val_size)
+ const char *var_ptr, int var_len, int var_index,
+ const char **val_ptr, int *val_len, int *val_size)
{
JCR *jcr = (JCR *)my_ctx;
int stat;
for (int i=0; _(built_in_vars[i].var_name); i++) {
if (strncmp(_(built_in_vars[i].var_name), var_ptr, var_len) == 0) {
- stat = (*built_in_vars[i].func)(jcr, built_in_vars[i].code,
- val_ptr, val_len, val_size);
- if (stat) {
- return VAR_OK;
- }
- break;
+ stat = (*built_in_vars[i].func)(jcr, built_in_vars[i].code,
+ val_ptr, val_len, val_size);
+ if (stat) {
+ return VAR_OK;
+ }
+ break;
}
}
return VAR_ERR_UNDEFINED_VARIABLE;
* Search counter variables
*/
static var_rc_t lookup_counter_var(var_t *ctx, void *my_ctx,
- const char *var_ptr, int var_len, int var_inc, int var_index,
- const char **val_ptr, int *val_len, int *val_size)
+ const char *var_ptr, int var_len, int var_inc, int var_index,
+ const char **val_ptr, int *val_len, int *val_size)
{
char buf[MAXSTRING];
var_rc_t stat = VAR_ERR_UNDEFINED_VARIABLE;
LockRes();
for (COUNTER *counter=NULL; (counter = (COUNTER *)GetNextRes(R_COUNTER, (RES *)counter)); ) {
if (strcmp(counter->hdr.name, buf) == 0) {
- Dmsg2(100, "Counter=%s val=%d\n", buf, counter->CurrentValue);
- /* -1 => return size of array */
- if (var_index == -1) {
- bsnprintf(buf, sizeof(buf), "%d", counter->CurrentValue);
- *val_len = bsnprintf(buf, sizeof(buf), "%d", strlen(buf));
- *val_ptr = buf;
- *val_size = 0; /* don't try to free val_ptr */
- return VAR_OK;
- } else {
- bsnprintf(buf, sizeof(buf), "%d", counter->CurrentValue);
- *val_ptr = bstrdup(buf);
- *val_len = strlen(buf);
- *val_size = *val_len + 1;
- }
- if (var_inc) { /* increment the variable? */
- if (counter->CurrentValue == counter->MaxValue) {
- counter->CurrentValue = counter->MinValue;
- } else {
- counter->CurrentValue++;
- }
- if (counter->Catalog) { /* update catalog if need be */
- COUNTER_DBR cr;
- JCR *jcr = (JCR *)my_ctx;
- memset(&cr, 0, sizeof(cr));
- bstrncpy(cr.Counter, counter->hdr.name, sizeof(cr.Counter));
- cr.MinValue = counter->MinValue;
- cr.MaxValue = counter->MaxValue;
- cr.CurrentValue = counter->CurrentValue;
- Dmsg1(100, "New value=%d\n", cr.CurrentValue);
- if (counter->WrapCounter) {
- bstrncpy(cr.WrapCounter, counter->WrapCounter->hdr.name, sizeof(cr.WrapCounter));
- } else {
- cr.WrapCounter[0] = 0;
- }
- if (!db_update_counter_record(jcr, jcr->db, &cr)) {
- Jmsg(jcr, M_ERROR, 0, _("Count not update counter %s: ERR=%s\n"),
- counter->hdr.name, db_strerror(jcr->db));
- }
- }
- }
- stat = VAR_OK;
- break;
+ Dmsg2(100, "Counter=%s val=%d\n", buf, counter->CurrentValue);
+ /* -1 => return size of array */
+ if (var_index == -1) {
+ bsnprintf(buf, sizeof(buf), "%d", counter->CurrentValue);
+ *val_len = bsnprintf(buf, sizeof(buf), "%d", strlen(buf));
+ *val_ptr = buf;
+ *val_size = 0; /* don't try to free val_ptr */
+ return VAR_OK;
+ } else {
+ bsnprintf(buf, sizeof(buf), "%d", counter->CurrentValue);
+ *val_ptr = bstrdup(buf);
+ *val_len = strlen(buf);
+ *val_size = *val_len + 1;
+ }
+ if (var_inc) { /* increment the variable? */
+ if (counter->CurrentValue == counter->MaxValue) {
+ counter->CurrentValue = counter->MinValue;
+ } else {
+ counter->CurrentValue++;
+ }
+ if (counter->Catalog) { /* update catalog if need be */
+ COUNTER_DBR cr;
+ JCR *jcr = (JCR *)my_ctx;
+ memset(&cr, 0, sizeof(cr));
+ bstrncpy(cr.Counter, counter->hdr.name, sizeof(cr.Counter));
+ cr.MinValue = counter->MinValue;
+ cr.MaxValue = counter->MaxValue;
+ cr.CurrentValue = counter->CurrentValue;
+ Dmsg1(100, "New value=%d\n", cr.CurrentValue);
+ if (counter->WrapCounter) {
+ bstrncpy(cr.WrapCounter, counter->WrapCounter->hdr.name, sizeof(cr.WrapCounter));
+ } else {
+ cr.WrapCounter[0] = 0;
+ }
+ if (!db_update_counter_record(jcr, jcr->db, &cr)) {
+ Jmsg(jcr, M_ERROR, 0, _("Count not update counter %s: ERR=%s\n"),
+ counter->hdr.name, db_strerror(jcr->db));
+ }
+ }
+ }
+ stat = VAR_OK;
+ break;
}
}
UnlockRes();
* Called here from "core" expand code to look up a variable
*/
static var_rc_t lookup_var(var_t *ctx, void *my_ctx,
- const char *var_ptr, int var_len, int var_inc, int var_index,
- const char **val_ptr, int *val_len, int *val_size)
+ const char *var_ptr, int var_len, int var_inc, int var_index,
+ const char **val_ptr, int *val_len, int *val_size)
{
char buf[MAXSTRING], *val, *p, *v;
var_rc_t stat;
/* Note, if val_size > 0 and val_ptr!=NULL, the core code will free() it */
if ((stat = lookup_built_in_var(ctx, my_ctx, var_ptr, var_len, var_index,
- val_ptr, val_len, val_size)) == VAR_OK) {
+ val_ptr, val_len, val_size)) == VAR_OK) {
return VAR_OK;
}
if ((stat = lookup_counter_var(ctx, my_ctx, var_ptr, var_len, var_inc, var_index,
- val_ptr, val_len, val_size)) == VAR_OK) {
+ val_ptr, val_len, val_size)) == VAR_OK) {
return VAR_OK;
}
/* He wants to index the "array" */
count = 1;
/* Find the size of the "array"
- * each element is separated by a |
+ * each element is separated by a |
*/
for (p = val; *p; p++) {
if (*p == '|') {
- count++;
+ count++;
}
}
Dmsg3(100, "For %s, reqest index=%d have=%d\n",
/* -1 => return size of array */
if (var_index == -1) {
int len;
- if (count == 1) { /* if not array */
- len = strlen(val); /* return length of string */
+ if (count == 1) { /* if not array */
+ len = strlen(val); /* return length of string */
} else {
- len = count; /* else return # array items */
+ len = count; /* else return # array items */
}
*val_len = bsnprintf(buf, sizeof(buf), "%d", len);
*val_ptr = buf;
count = 0;
for (p=val; *p; ) {
if (*p == '|') {
- if (count < var_index) {
- val = ++p;
- count++;
- continue;
- }
- break;
+ if (count < var_index) {
+ val = ++p;
+ count++;
+ continue;
+ }
+ break;
}
p++;
}
* out_ptr points to string to be returned
*/
static var_rc_t operate_var(var_t *var, void *my_ctx,
- const char *op_ptr, int op_len,
- const char *arg_ptr, int arg_len,
- const char *val_ptr, int val_len,
- char **out_ptr, int *out_len, int *out_size)
+ const char *op_ptr, int op_len,
+ const char *arg_ptr, int arg_len,
+ const char *val_ptr, int val_len,
+ char **out_ptr, int *out_len, int *out_size)
{
var_rc_t stat = VAR_ERR_UNDEFINED_OPERATION;
Dmsg0(100, "Enter operate_var\n");
if (op_len == 3 && strncmp(op_ptr, "inc", 3) == 0) {
char buf[MAXSTRING];
if (val_len > (int)sizeof(buf) - 1) {
- return VAR_ERR_OUT_OF_MEMORY;
+ return VAR_ERR_OUT_OF_MEMORY;
}
memcpy(buf, arg_ptr, arg_len);
buf[arg_len] = 0;
Dmsg1(100, "Val=%s\n", buf);
LockRes();
for (COUNTER *counter=NULL; (counter = (COUNTER *)GetNextRes(R_COUNTER, (RES *)counter)); ) {
- if (strcmp(counter->hdr.name, buf) == 0) {
- Dmsg2(100, "counter=%s val=%s\n", counter->hdr.name, buf);
- break;
- }
+ if (strcmp(counter->hdr.name, buf) == 0) {
+ Dmsg2(100, "counter=%s val=%s\n", counter->hdr.name, buf);
+ break;
+ }
}
UnlockRes();
return stat;
* Expand an input line and return it.
*
* Returns: 0 on failure
- * 1 on success and exp has expanded input
+ * 1 on success and exp has expanded input
*/
int variable_expansion(JCR *jcr, char *inp, POOLMEM **exp)
{
/* expand variables */
if ((stat = var_expand(var_ctx, inp, in_len, &outp, &out_len, 0)) != VAR_OK) {
Jmsg(jcr, M_ERROR, 0, _("Cannot expand expression \"%s\": ERR=%s\n"),
- inp, var_strerror(var_ctx, stat));
+ inp, var_strerror(var_ctx, stat));
goto bail_out;
}
migration_cleanup(jcr, jcr->JobStatus);
return true; /* no work */
}
- Dmsg4(100, "Target: Name=%s JobId=%d Type=%c Level=%c\n",
+ Dmsg4(000, "Target: Name=%s JobId=%d Type=%c Level=%c\n",
jcr->previous_jr.Name, jcr->previous_jr.JobId,
jcr->previous_jr.JobType, jcr->previous_jr.JobLevel);
- Dmsg4(100, "Current: Name=%s JobId=%d Type=%c Level=%c\n",
+ Dmsg4(000, "Current: Name=%s JobId=%d Type=%c Level=%c\n",
jcr->jr.Name, jcr->jr.JobId,
jcr->jr.JobType, jcr->jr.JobLevel);
set_jcr_job_status(jcr, JS_Running);
set_jcr_job_status(tjcr, JS_Running);
- Dmsg2(100, "JobId=%d JobLevel=%c\n", jcr->jr.JobId, jcr->jr.JobLevel);
+ Dmsg2(000, "JobId=%d JobLevel=%c\n", jcr->jr.JobId, jcr->jr.JobLevel);
if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
return false;
memset(new_item, 0, sizeof(uitem));
new_item->item = bstrdup(row[0]);
-
+ Dmsg1(000, "Item=%s\n", row[0]);
item = (uitem *)list->binary_insert((void *)new_item, item_compare);
if (item != new_item) { /* already in list */
free(new_item->item);
" Job.PoolId=Media.PoolId";
const char *sql_job =
- "SELECT DISTINCT Job.Name from Pool,Media,Job,JobMedia "
- " WHERE Media.PoolId=Pool.PoolId AND Pool.Name='%s' AND"
- " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId";
+ "SELECT DISTINCT Job.Name from Job,Pool"
+ " WHERE Pool.Name='%s' AND Job.PoolId=Pool.PoolId";
+
+const char *sql_jobids_from_job =
+ "SELECT DISTINCT Job.JobId FROM Job,Pool"
+ " WHERE Job.Name=%s AND Pool.Name='%s' AND Job.PoolId=Pool.PoolId"
+ " ORDER by Job.StartTime";
+
const char *sql_ujobid =
"SELECT DISTINCT Job.Job from Client,Pool,Media,Job,JobMedia "
char *p;
dlist *item_chain;
uitem *item = NULL;
+ uitem *last_item = NULL;
char prbuf[500];
regex_t preg;
+ JobIds[0] = 0;
if (jcr->MigrateJobId != 0) {
jcr->previous_jr.JobId = jcr->MigrateJobId;
+ Dmsg1(000, "previous jobid=%u\n", jcr->MigrateJobId);
} else {
switch (jcr->job->selection_type) {
case MT_SMALLEST_VOL:
_("SQL to get Volume failed. ERR=%s\n"), db_strerror(jcr->db));
goto bail_out;
}
- Dmsg1(000, "Jobids=%s\n", JobIds);
+ Dmsg1(000, "Smallest Vol Jobids=%s\n", JobIds);
break;
case MT_OLDEST_VOL:
Mmsg(query, sql_oldest_vol, jcr->pool->hdr.name);
_("SQL to get Volume failed. ERR=%s\n"), db_strerror(jcr->db));
goto bail_out;
}
- Dmsg1(000, "Jobids=%s\n", JobIds);
+ Dmsg1(000, "Oldest Vol Jobids=%s\n", JobIds);
break;
case MT_POOL_OCCUPANCY:
Mmsg(query, sql_pool_bytes, jcr->pool->hdr.name);
Jmsg(jcr, M_INFO, 0, _("No jobs found to migrate.\n"));
goto ok_out;
}
+ Dmsg1(000, "Pool Occupancy Jobids=%s\n", JobIds);
break;
case MT_POOL_TIME:
+ Dmsg0(000, "Pool time not implemented\n");
break;
case MT_CLIENT:
if (!jcr->job->selection_pattern) {
- Jmsg(jcr, M_FATAL, 0, _("No selection pattern specified.\n"));
+ Jmsg(jcr, M_FATAL, 0, _("No Migration Client selection pattern specified.\n"));
goto bail_out;
}
+ Dmsg1(000, "Client regex=%s\n", jcr->job->selection_pattern);
rc = regcomp(&preg, jcr->job->selection_pattern, REG_EXTENDED);
if (rc != 0) {
regerror(rc, &preg, prbuf, sizeof(prbuf));
break;
case MT_VOLUME:
if (!jcr->job->selection_pattern) {
- Jmsg(jcr, M_FATAL, 0, _("No selection pattern specified.\n"));
+ Jmsg(jcr, M_FATAL, 0, _("No Migration Volume selection pattern specified.\n"));
goto bail_out;
}
+ Dmsg1(000, "Volume regex=%s\n", jcr->job->selection_pattern);
rc = regcomp(&preg, jcr->job->selection_pattern, REG_EXTENDED);
if (rc != 0) {
regerror(rc, &preg, prbuf, sizeof(prbuf));
break;
case MT_JOB:
if (!jcr->job->selection_pattern) {
- Jmsg(jcr, M_FATAL, 0, _("No selection pattern specified.\n"));
+ Jmsg(jcr, M_FATAL, 0, _("No Migration Job selection pattern specified.\n"));
goto bail_out;
}
+ Dmsg1(000, "Job regex=%s\n", jcr->job->selection_pattern);
rc = regcomp(&preg, jcr->job->selection_pattern, REG_EXTENDED);
if (rc != 0) {
regerror(rc, &preg, prbuf, sizeof(prbuf));
Jmsg(jcr, M_FATAL, 0, _("Could not compile regex pattern \"%s\" ERR=%s\n"),
jcr->job->selection_pattern, prbuf);
+ goto bail_out;
}
item_chain = New(dlist(item, &item->link));
Mmsg(query, sql_job, jcr->pool->hdr.name);
- Dmsg1(100, "query=%s\n", query.c_str());
+ Dmsg1(000, "query=%s\n", query.c_str());
if (!db_sql_query(jcr->db, query.c_str(), unique_name_handler,
(void *)item_chain)) {
Jmsg(jcr, M_FATAL, 0,
_("SQL to get Job failed. ERR=%s\n"), db_strerror(jcr->db));
goto bail_out;
}
- /* Now apply the regex and create the jobs */
+ /* Now apply the regex and remove any item not matched */
foreach_dlist(item, item_chain) {
const int nmatch = 30;
regmatch_t pmatch[nmatch];
+ if (last_item) {
+ free(last_item->item);
+ item_chain->remove(last_item);
+ }
+ Dmsg1(000, "Jobitem=%s\n", item->item);
rc = regexec(&preg, item->item, nmatch, pmatch, 0);
if (rc == 0) {
- Dmsg1(000, "Do Job=%s\n", item->item);
+ last_item = NULL; /* keep this one */
+ } else {
+ last_item = item;
}
- free(item->item);
+ }
+ if (last_item) {
+ free(last_item->item);
+ item_chain->remove(last_item);
}
regfree(&preg);
+ /*
+ * At this point, we have a list of items in item_chain
+ * that have been matched by the regex, so now we need
+ * to look up their jobids.
+ */
+ JobIds = get_pool_memory(PM_MESSAGE);
+ JobIds[0] = 0;
+ foreach_dlist(item, item_chain) {
+ Dmsg1(000, "Got Job: %s\n", item->item);
+ Mmsg(query, sql_jobids_from_job, item->item, jcr->pool->hdr.name);
+ if (!db_sql_query(jcr->db, query.c_str(), jobid_handler, (void *)JobIds)) {
+ Jmsg(jcr, M_FATAL, 0,
+ _("SQL failed. ERR=%s\n"), db_strerror(jcr->db));
+ goto bail_out;
+ }
+ }
+ if (JobIds[0] == 0) {
+ Jmsg(jcr, M_INFO, 0, _("No jobs found to migrate.\n"));
+ goto ok_out;
+ }
+ Dmsg1(000, "Job Jobids=%s\n", JobIds);
+ free_pool_memory(JobIds);
delete item_chain;
break;
case MT_SQLQUERY:
JobIds[0] = 0;
if (!jcr->job->selection_pattern) {
- Jmsg(jcr, M_FATAL, 0, _("No selection pattern specified.\n"));
+ Jmsg(jcr, M_FATAL, 0, _("No Migration SQL selection pattern specified.\n"));
goto bail_out;
}
+ Dmsg1(000, "SQL=%s\n", jcr->job->selection_pattern);
if (!db_sql_query(jcr->db, query.c_str(), jobid_handler, (void *)JobIds)) {
Jmsg(jcr, M_FATAL, 0,
_("SQL to get Volume failed. ERR=%s\n"), db_strerror(jcr->db));
}
p = JobIds;
+ JobId = 0;
stat = get_next_jobid_from_list(&p, &JobId);
Dmsg2(000, "get_next_jobid stat=%d JobId=%u\n", stat, JobId);
if (stat < 0) {
*/
ok = db_find_next_volume(jcr, jcr->db, index, InChanger, mr);
Dmsg2(100, "catreq after find_next_vol ok=%d FW=%d\n", ok, mr->FirstWritten);
- /*
- * 2. Try pulling a Scratch volume if one exists in the autochanger
- */
- if (!ok && InChanger) {
- ok = get_scratch_volume(jcr, mr, InChanger);
- }
if (!ok) {
/*
- * 3. Try finding a recycled volume
+ * 2. Try finding a recycled volume
*/
ok = find_recycled_volume(jcr, InChanger, mr);
Dmsg2(100, "find_recycled_volume %d FW=%d\n", ok, mr->FirstWritten);
if (!ok) {
/*
- * 4. Try recycling any purged volume
+ * 3. Try recycling any purged volume
*/
ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
if (!ok) {
/*
- * 5. Try pruning Volumes
+ * 4. Try pruning Volumes
*/
prune_volumes(jcr);
ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
+ if (!ok) {
+ /*
+ * 5. Try pulling a volume from the Scratch pool
+ */
+ ok = get_scratch_volume(jcr, mr, InChanger);
+ }
+ /*
+ * If we are using an Autochanger and have not found
+ * a volume, retry looking for any volume.
+ */
if (InChanger) {
InChanger = false;
if (!ok) {
}
}
- if (!ok) {
- /*
- * 6. Try pulling a volume from the Scratch pool
- */
- ok = get_scratch_volume(jcr, mr, InChanger);
- }
if (!ok && create) {
/*
- * 7. Try "creating" a new Volume
+ * 6. Try "creating" a new Volume
*/
ok = newVolume(jcr, mr);
}
UAContext *ua;
Dmsg0(400, "Try purge.\n");
/*
- * 8. Try to purging oldest volume only if not UA calling us.
+ * 7. Try to purging oldest volume only if not UA calling us.
*/
ua = new_ua_context(jcr);
if (jcr->pool->purge_oldest_volume && create) {
Jmsg(jcr, M_INFO, 0, _("Purging oldest volume \"%s\"\n"), mr->VolumeName);
ok = purge_jobs_from_volume(ua, mr);
/*
- * 9. or try recycling the oldest volume
+ * 8. or try recycling the oldest volume
*/
} else if (jcr->pool->recycle_oldest_volume) {
Jmsg(jcr, M_INFO, 0, _("Pruning oldest volume \"%s\"\n"), mr->VolumeName);
/* Keywords understood by parser */
static struct s_keyw keyw[] = {
- {N_("on"), s_none, 0},
- {N_("at"), s_at, 0},
+ {NT_("on"), s_none, 0},
+ {NT_("at"), s_at, 0},
- {N_("sun"), s_wday, 0},
- {N_("mon"), s_wday, 1},
- {N_("tue"), s_wday, 2},
- {N_("wed"), s_wday, 3},
- {N_("thu"), s_wday, 4},
- {N_("fri"), s_wday, 5},
- {N_("sat"), s_wday, 6},
- {N_("jan"), s_month, 0},
- {N_("feb"), s_month, 1},
- {N_("mar"), s_month, 2},
- {N_("apr"), s_month, 3},
- {N_("may"), s_month, 4},
- {N_("jun"), s_month, 5},
- {N_("jul"), s_month, 6},
- {N_("aug"), s_month, 7},
- {N_("sep"), s_month, 8},
- {N_("oct"), s_month, 9},
- {N_("nov"), s_month, 10},
- {N_("dec"), s_month, 11},
+ {NT_("sun"), s_wday, 0},
+ {NT_("mon"), s_wday, 1},
+ {NT_("tue"), s_wday, 2},
+ {NT_("wed"), s_wday, 3},
+ {NT_("thu"), s_wday, 4},
+ {NT_("fri"), s_wday, 5},
+ {NT_("sat"), s_wday, 6},
+ {NT_("jan"), s_month, 0},
+ {NT_("feb"), s_month, 1},
+ {NT_("mar"), s_month, 2},
+ {NT_("apr"), s_month, 3},
+ {NT_("may"), s_month, 4},
+ {NT_("jun"), s_month, 5},
+ {NT_("jul"), s_month, 6},
+ {NT_("aug"), s_month, 7},
+ {NT_("sep"), s_month, 8},
+ {NT_("oct"), s_month, 9},
+ {NT_("nov"), s_month, 10},
+ {NT_("dec"), s_month, 11},
- {N_("sunday"), s_wday, 0},
- {N_("monday"), s_wday, 1},
- {N_("tuesday"), s_wday, 2},
- {N_("wednesday"), s_wday, 3},
- {N_("thursday"), s_wday, 4},
- {N_("friday"), s_wday, 5},
- {N_("saturday"), s_wday, 6},
- {N_("january"), s_month, 0},
- {N_("february"), s_month, 1},
- {N_("march"), s_month, 2},
- {N_("april"), s_month, 3},
- {N_("june"), s_month, 5},
- {N_("july"), s_month, 6},
- {N_("august"), s_month, 7},
- {N_("september"), s_month, 8},
- {N_("october"), s_month, 9},
- {N_("november"), s_month, 10},
- {N_("december"), s_month, 11},
+ {NT_("sunday"), s_wday, 0},
+ {NT_("monday"), s_wday, 1},
+ {NT_("tuesday"), s_wday, 2},
+ {NT_("wednesday"), s_wday, 3},
+ {NT_("thursday"), s_wday, 4},
+ {NT_("friday"), s_wday, 5},
+ {NT_("saturday"), s_wday, 6},
+ {NT_("january"), s_month, 0},
+ {NT_("february"), s_month, 1},
+ {NT_("march"), s_month, 2},
+ {NT_("april"), s_month, 3},
+ {NT_("june"), s_month, 5},
+ {NT_("july"), s_month, 6},
+ {NT_("august"), s_month, 7},
+ {NT_("september"), s_month, 8},
+ {NT_("october"), s_month, 9},
+ {NT_("november"), s_month, 10},
+ {NT_("december"), s_month, 11},
- {N_("daily"), s_daily, 0},
- {N_("weekly"), s_weekly, 0},
- {N_("monthly"), s_monthly, 0},
- {N_("hourly"), s_hourly, 0},
+ {NT_("daily"), s_daily, 0},
+ {NT_("weekly"), s_weekly, 0},
+ {NT_("monthly"), s_monthly, 0},
+ {NT_("hourly"), s_hourly, 0},
- {N_("1st"), s_wom, 0},
- {N_("2nd"), s_wom, 1},
- {N_("3rd"), s_wom, 2},
- {N_("4th"), s_wom, 3},
- {N_("5th"), s_wom, 4},
+ {NT_("1st"), s_wom, 0},
+ {NT_("2nd"), s_wom, 1},
+ {NT_("3rd"), s_wom, 2},
+ {NT_("4th"), s_wom, 3},
+ {NT_("5th"), s_wom, 4},
- {N_("first"), s_wom, 0},
- {N_("second"), s_wom, 1},
- {N_("third"), s_wom, 2},
- {N_("fourth"), s_wom, 3},
- {N_("fifth"), s_wom, 4},
+ {NT_("first"), s_wom, 0},
+ {NT_("second"), s_wom, 1},
+ {NT_("third"), s_wom, 2},
+ {NT_("fourth"), s_wom, 3},
+ {NT_("fifth"), s_wom, 4},
{NULL, s_none, 0}
};
struct cmdstruct { const char *key; int (*func)(UAContext *ua, const char *cmd); const char *help; };
static struct cmdstruct commands[] = {
- { N_("add"), add_cmd, _("add media to a pool")},
- { N_("autodisplay"), autodisplay_cmd, _("autodisplay [on|off] -- console messages")},
- { N_("automount"), automount_cmd, _("automount [on|off] -- after label")},
- { N_("cancel"), cancel_cmd, _("cancel [<jobid=nnn> | <job=name>] -- cancel a job")},
- { N_("create"), create_cmd, _("create DB Pool from resource")},
- { N_("delete"), delete_cmd, _("delete [pool=<pool-name> | media volume=<volume-name>]")},
- { N_("disable"), disable_cmd, _("disable <job=name> -- disable a job")},
- { N_("enable"), enable_cmd, _("enable <job=name> -- enable a job")},
- { N_("estimate"), estimate_cmd, _("performs FileSet estimate, listing gives full listing")},
- { N_("exit"), quit_cmd, _("exit = quit")},
- { N_("gui"), gui_cmd, _("gui [on|off] -- non-interactive gui mode")},
- { N_("help"), help_cmd, _("print this command")},
- { N_("list"), list_cmd, _("list [pools | jobs | jobtotals | media <pool=pool-name> | files <jobid=nn>]; from catalog")},
- { N_("label"), label_cmd, _("label a tape")},
- { N_("llist"), llist_cmd, _("full or long list like list command")},
- { N_("messages"), messagescmd, _("messages")},
- { N_("mount"), mount_cmd, _("mount <storage-name>")},
- { N_("prune"), prunecmd, _("prune expired records from catalog")},
- { N_("purge"), purgecmd, _("purge records from catalog")},
- { N_("python"), python_cmd, _("python control commands")},
- { N_("quit"), quit_cmd, _("quit")},
- { N_("query"), querycmd, _("query catalog")},
- { N_("restore"), restore_cmd, _("restore files")},
- { N_("relabel"), relabel_cmd, _("relabel a tape")},
- { N_("release"), release_cmd, _("release <storage-name>")},
- { N_("reload"), reload_cmd, _("reload conf file")},
- { N_("run"), run_cmd, _("run <job-name>")},
- { N_("status"), status_cmd, _("status [storage | client]=<name>")},
- { N_("setdebug"), setdebug_cmd, _("sets debug level")},
- { N_("setip"), setip_cmd, _("sets new client address -- if authorized")},
- { N_("show"), show_cmd, _("show (resource records) [jobs | pools | ... | all]")},
- { N_("sqlquery"), sqlquerycmd, _("use SQL to query catalog")},
- { N_("time"), time_cmd, _("print current time")},
- { N_("trace"), trace_cmd, _("turn on/off trace to file")},
- { N_("unmount"), unmount_cmd, _("unmount <storage-name>")},
- { N_("umount"), unmount_cmd, _("umount <storage-name> for old-time Unix guys")},
- { N_("update"), update_cmd, _("update Volume, Pool or slots")},
- { N_("use"), use_cmd, _("use catalog xxx")},
- { N_("var"), var_cmd, _("does variable expansion")},
- { N_("version"), version_cmd, _("print Director version")},
- { N_("wait"), wait_cmd, _("wait until no jobs are running [<jobname=name> | <jobid=nnn> | <ujobid=complete_name>]")},
+ { NT_("add"), add_cmd, _("add media to a pool")},
+ { NT_("autodisplay"), autodisplay_cmd, _("autodisplay [on|off] -- console messages")},
+ { NT_("automount"), automount_cmd, _("automount [on|off] -- after label")},
+ { NT_("cancel"), cancel_cmd, _("cancel [<jobid=nnn> | <job=name>] -- cancel a job")},
+ { NT_("create"), create_cmd, _("create DB Pool from resource")},
+ { NT_("delete"), delete_cmd, _("delete [pool=<pool-name> | media volume=<volume-name>]")},
+ { NT_("disable"), disable_cmd, _("disable <job=name> -- disable a job")},
+ { NT_("enable"), enable_cmd, _("enable <job=name> -- enable a job")},
+ { NT_("estimate"), estimate_cmd, _("performs FileSet estimate, listing gives full listing")},
+ { NT_("exit"), quit_cmd, _("exit = quit")},
+ { NT_("gui"), gui_cmd, _("gui [on|off] -- non-interactive gui mode")},
+ { NT_("help"), help_cmd, _("print this command")},
+ { NT_("list"), list_cmd, _("list [pools | jobs | jobtotals | media <pool=pool-name> | files <jobid=nn>]; from catalog")},
+ { NT_("label"), label_cmd, _("label a tape")},
+ { NT_("llist"), llist_cmd, _("full or long list like list command")},
+ { NT_("messages"), messagescmd, _("messages")},
+ { NT_("mount"), mount_cmd, _("mount <storage-name>")},
+ { NT_("prune"), prunecmd, _("prune expired records from catalog")},
+ { NT_("purge"), purgecmd, _("purge records from catalog")},
+ { NT_("python"), python_cmd, _("python control commands")},
+ { NT_("quit"), quit_cmd, _("quit")},
+ { NT_("query"), querycmd, _("query catalog")},
+ { NT_("restore"), restore_cmd, _("restore files")},
+ { NT_("relabel"), relabel_cmd, _("relabel a tape")},
+ { NT_("release"), release_cmd, _("release <storage-name>")},
+ { NT_("reload"), reload_cmd, _("reload conf file")},
+ { NT_("run"), run_cmd, _("run <job-name>")},
+ { NT_("status"), status_cmd, _("status [storage | client]=<name>")},
+ { NT_("setdebug"), setdebug_cmd, _("sets debug level")},
+ { NT_("setip"), setip_cmd, _("sets new client address -- if authorized")},
+ { NT_("show"), show_cmd, _("show (resource records) [jobs | pools | ... | all]")},
+ { NT_("sqlquery"), sqlquerycmd, _("use SQL to query catalog")},
+ { NT_("time"), time_cmd, _("print current time")},
+ { NT_("trace"), trace_cmd, _("turn on/off trace to file")},
+ { NT_("unmount"), unmount_cmd, _("unmount <storage-name>")},
+ { NT_("umount"), unmount_cmd, _("umount <storage-name> for old-time Unix guys")},
+ { NT_("update"), update_cmd, _("update Volume, Pool or slots")},
+ { NT_("use"), use_cmd, _("use catalog xxx")},
+ { NT_("var"), var_cmd, _("does variable expansion")},
+ { NT_("version"), version_cmd, _("print Director version")},
+ { NT_("wait"), wait_cmd, _("wait until no jobs are running [<jobname=name> | <jobid=nnn> | <ujobid=complete_name>]")},
};
#define comsize (sizeof(commands)/sizeof(struct cmdstruct))
JOB *job;
int i;
- i = find_arg_with_value(ua, N_("job"));
+ i = find_arg_with_value(ua, NT_("job"));
if (i < 0) {
job = select_job_resource(ua);
if (!job) {
static int delete_cmd(UAContext *ua, const char *cmd)
{
static const char *keywords[] = {
- N_("volume"),
- N_("pool"),
- N_("jobid"),
+ NT_("volume"),
+ NT_("pool"),
+ NT_("jobid"),
NULL};
if (!open_db(ua)) {
JobId_t JobId;
char *s,*sep,*tok;
- int i = find_arg_with_value(ua, N_("jobid"));
+ int i = find_arg_with_value(ua, NT_("jobid"));
if (i >= 0) {
if (strchr(ua->argv[i], ',') != NULL || strchr(ua->argv[i], '-') != NULL) {
s = bstrdup(ua->argv[i]);
struct cmdstruct { const char *key; int (*func)(UAContext *ua, const char *cmd); const char *help; };
static struct cmdstruct commands[] = {
- { N_(".die"), diecmd, NULL},
- { N_(".jobs"), jobscmd, NULL},
- { N_(".filesets"), filesetscmd, NULL},
- { N_(".clients"), clientscmd, NULL},
- { N_(".msgs"), msgscmd, NULL},
- { N_(".pools"), poolscmd, NULL},
- { N_(".types"), typescmd, NULL},
- { N_(".backups"), backupscmd, NULL},
- { N_(".levels"), levelscmd, NULL},
- { N_(".status"), qstatus_cmd, NULL},
- { N_(".storage"), storagecmd, NULL},
- { N_(".defaults"), defaultscmd, NULL},
- { N_(".messages"), getmsgscmd, NULL},
- { N_(".help"), qhelp_cmd, NULL},
- { N_(".quit"), quit_cmd, NULL},
- { N_(".exit"), quit_cmd, NULL}
+ { NT_(".die"), diecmd, NULL},
+ { NT_(".jobs"), jobscmd, NULL},
+ { NT_(".filesets"), filesetscmd, NULL},
+ { NT_(".clients"), clientscmd, NULL},
+ { NT_(".msgs"), msgscmd, NULL},
+ { NT_(".pools"), poolscmd, NULL},
+ { NT_(".types"), typescmd, NULL},
+ { NT_(".backups"), backupscmd, NULL},
+ { NT_(".levels"), levelscmd, NULL},
+ { NT_(".status"), qstatus_cmd, NULL},
+ { NT_(".storage"), storagecmd, NULL},
+ { NT_(".defaults"), defaultscmd, NULL},
+ { NT_(".messages"), getmsgscmd, NULL},
+ { NT_(".help"), qhelp_cmd, NULL},
+ { NT_(".quit"), quit_cmd, NULL},
+ { NT_(".exit"), quit_cmd, NULL}
};
#define comsize (sizeof(commands)/sizeof(struct cmdstruct))
set_storage(ua->jcr, store);
drive = get_storage_drive(ua, store);
- scan = find_arg(ua, N_("scan")) >= 0;
+ scan = find_arg(ua, NT_("scan")) >= 0;
max_slots = get_num_slots_from_SD(ua);
Dmsg1(100, "max_slots=%d\n", max_slots);
int autodisplay_cmd(UAContext *ua, const char *cmd)
{
static const char *kw[] = {
- N_("on"),
- N_("off"),
+ NT_("on"),
+ NT_("off"),
NULL};
switch (find_arg_keyword(ua, kw)) {
int gui_cmd(UAContext *ua, const char *cmd)
{
static const char *kw[] = {
- N_("on"),
- N_("off"),
+ NT_("on"),
+ NT_("off"),
NULL};
switch (find_arg_keyword(ua, kw)) {
struct showstruct {const char *res_name; int type;};
static struct showstruct reses[] = {
- {N_("directors"), R_DIRECTOR},
- {N_("clients"), R_CLIENT},
- {N_("counters"), R_COUNTER},
- {N_("devices"), R_DEVICE},
- {N_("jobs"), R_JOB},
- {N_("storages"), R_STORAGE},
- {N_("catalogs"), R_CATALOG},
- {N_("schedules"), R_SCHEDULE},
- {N_("filesets"), R_FILESET},
- {N_("pools"), R_POOL},
- {N_("messages"), R_MSGS},
- {N_("all"), -1},
- {N_("help"), -2},
+ {NT_("directors"), R_DIRECTOR},
+ {NT_("clients"), R_CLIENT},
+ {NT_("counters"), R_COUNTER},
+ {NT_("devices"), R_DEVICE},
+ {NT_("jobs"), R_JOB},
+ {NT_("storages"), R_STORAGE},
+ {NT_("catalogs"), R_CATALOG},
+ {NT_("schedules"), R_SCHEDULE},
+ {NT_("filesets"), R_FILESET},
+ {NT_("pools"), R_POOL},
+ {NT_("messages"), R_MSGS},
+ {NT_("all"), -1},
+ {NT_("help"), -2},
{NULL, 0}
};
/* Scan arguments looking for things to do */
for (i=1; i<ua->argc; i++) {
/* List JOBS */
- if (strcasecmp(ua->argk[i], N_("jobs")) == 0) {
+ if (strcasecmp(ua->argk[i], NT_("jobs")) == 0) {
/* Apply any limit */
- j = find_arg_with_value(ua, N_("limit"));
+ j = find_arg_with_value(ua, NT_("limit"));
if (j >= 0) {
jr.limit = atoi(ua->argv[j]);
}
db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist);
/* List JOBTOTALS */
- } else if (strcasecmp(ua->argk[i], N_("jobtotals")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("jobtotals")) == 0) {
db_list_job_totals(ua->jcr, ua->db, &jr, prtit, ua);
/* List JOBID=nn */
- } else if (strcasecmp(ua->argk[i], N_("jobid")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("jobid")) == 0) {
if (ua->argv[i]) {
jobid = str_to_int64(ua->argv[i]);
if (jobid > 0) {
}
/* List JOB=xxx */
- } else if ((strcasecmp(ua->argk[i], N_("job")) == 0 ||
- strcasecmp(ua->argk[i], N_("jobname")) == 0) && ua->argv[i]) {
+ } else if ((strcasecmp(ua->argk[i], NT_("job")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("jobname")) == 0) && ua->argv[i]) {
bstrncpy(jr.Name, ua->argv[i], MAX_NAME_LENGTH);
jr.JobId = 0;
db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist);
/* List UJOBID=xxx */
- } else if (strcasecmp(ua->argk[i], N_("ujobid")) == 0 && ua->argv[i]) {
+ } else if (strcasecmp(ua->argk[i], NT_("ujobid")) == 0 && ua->argv[i]) {
bstrncpy(jr.Job, ua->argv[i], MAX_NAME_LENGTH);
jr.JobId = 0;
db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist);
/* List FILES */
- } else if (strcasecmp(ua->argk[i], N_("files")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("files")) == 0) {
for (j=i+1; j<ua->argc; j++) {
- if (strcasecmp(ua->argk[j], N_("ujobid")) == 0 && ua->argv[j]) {
+ if (strcasecmp(ua->argk[j], NT_("ujobid")) == 0 && ua->argv[j]) {
bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH);
jr.JobId = 0;
db_get_job_record(ua->jcr, ua->db, &jr);
jobid = jr.JobId;
- } else if (strcasecmp(ua->argk[j], N_("jobid")) == 0 && ua->argv[j]) {
+ } else if (strcasecmp(ua->argk[j], NT_("jobid")) == 0 && ua->argv[j]) {
jobid = str_to_int64(ua->argv[j]);
} else {
continue;
}
/* List JOBMEDIA */
- } else if (strcasecmp(ua->argk[i], N_("jobmedia")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("jobmedia")) == 0) {
int done = FALSE;
for (j=i+1; j<ua->argc; j++) {
- if (strcasecmp(ua->argk[j], N_("ujobid")) == 0 && ua->argv[j]) {
+ if (strcasecmp(ua->argk[j], NT_("ujobid")) == 0 && ua->argv[j]) {
bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH);
jr.JobId = 0;
db_get_job_record(ua->jcr, ua->db, &jr);
jobid = jr.JobId;
- } else if (strcasecmp(ua->argk[j], N_("jobid")) == 0 && ua->argv[j]) {
+ } else if (strcasecmp(ua->argk[j], NT_("jobid")) == 0 && ua->argv[j]) {
jobid = str_to_int64(ua->argv[j]);
} else {
continue;
}
/* List POOLS */
- } else if (strcasecmp(ua->argk[i], N_("pool")) == 0 ||
- strcasecmp(ua->argk[i], N_("pools")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("pool")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("pools")) == 0) {
POOL_DBR pr;
memset(&pr, 0, sizeof(pr));
if (ua->argv[i]) {
}
db_list_pool_records(ua->jcr, ua->db, &pr, prtit, ua, llist);
- } else if (strcasecmp(ua->argk[i], N_("clients")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("clients")) == 0) {
db_list_client_records(ua->jcr, ua->db, prtit, ua, llist);
/* List MEDIA or VOLUMES */
- } else if (strcasecmp(ua->argk[i], N_("media")) == 0 ||
- strcasecmp(ua->argk[i], N_("volume")) == 0 ||
- strcasecmp(ua->argk[i], N_("volumes")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("media")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("volume")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("volumes")) == 0) {
bool done = false;
for (j=i+1; j<ua->argc; j++) {
- if (strcasecmp(ua->argk[j], N_("ujobid")) == 0 && ua->argv[j]) {
+ if (strcasecmp(ua->argk[j], NT_("ujobid")) == 0 && ua->argv[j]) {
bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH);
jr.JobId = 0;
db_get_job_record(ua->jcr, ua->db, &jr);
jobid = jr.JobId;
- } else if (strcasecmp(ua->argk[j], N_("jobid")) == 0 && ua->argv[j]) {
+ } else if (strcasecmp(ua->argk[j], NT_("jobid")) == 0 && ua->argv[j]) {
jobid = str_to_int64(ua->argv[j]);
} else {
continue;
}
/* Is a specific pool wanted? */
for (i=1; i<ua->argc; i++) {
- if (strcasecmp(ua->argk[i], N_("pool")) == 0) {
+ if (strcasecmp(ua->argk[i], NT_("pool")) == 0) {
if (!get_pool_dbr(ua, &pr)) {
bsendmsg(ua, _("No Pool specified.\n"));
return 1;
return 1;
}
/* List next volume */
- } else if (strcasecmp(ua->argk[i], N_("nextvol")) == 0 ||
- strcasecmp(ua->argk[i], N_("nextvolume")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("nextvol")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("nextvolume")) == 0) {
n = 1;
- j = find_arg_with_value(ua, N_("days"));
+ j = find_arg_with_value(ua, NT_("days"));
if (j >= 0) {
n = atoi(ua->argv[j]);
if ((n < 0) || (n > 50)) {
}
}
list_nextvol(ua, n);
- } else if (strcasecmp(ua->argk[i], N_("limit")) == 0
- || strcasecmp(ua->argk[i], N_("days")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("limit")) == 0
+ || strcasecmp(ua->argk[i], NT_("days")) == 0) {
/* Ignore it */
} else {
bsendmsg(ua, _("Unknown list keyword: %s\n"), NPRT(ua->argk[i]));
int kw;
static const char *keywords[] = {
- N_("Files"),
- N_("Jobs"),
- N_("Volume"),
+ NT_("Files"),
+ NT_("Jobs"),
+ NT_("Volume"),
NULL};
if (!open_db(ua)) {
MEDIA_DBR mr;
JOB_DBR jr;
static const char *keywords[] = {
- N_("files"),
- N_("jobs"),
- N_("volume"),
+ NT_("files"),
+ NT_("jobs"),
+ NT_("volume"),
NULL};
static const char *files_keywords[] = {
- N_("Job"),
- N_("JobId"),
- N_("Client"),
- N_("Volume"),
+ NT_("Job"),
+ NT_("JobId"),
+ NT_("Client"),
+ NT_("Volume"),
NULL};
static const char *jobs_keywords[] = {
- N_("Client"),
- N_("Volume"),
+ NT_("Client"),
+ NT_("Volume"),
NULL};
bsendmsg(ua, _(
}
/* Volume */
case 2:
- while ((i=find_arg(ua, N_("volume"))) >= 0) {
+ while ((i=find_arg(ua, NT_("volume"))) >= 0) {
if (select_media_dbr(ua, &mr)) {
purge_jobs_from_volume(ua, &mr);
}
job->hdr.name, rx.ClientName, rx.store?rx.store->hdr.name:"",
jcr->RestoreBootstrap, rx.selected_files, ua->catalog->hdr.name);
}
- if (find_arg(ua, N_("yes")) > 0) {
+ if (find_arg(ua, NT_("yes")) > 0) {
pm_strcat(ua->cmd, " yes"); /* pass it on to the run command */
}
Dmsg1(100, "Submitting: %s\n", ua->cmd);
if (!rx->ClientName[0]) {
CLIENT_DBR cr;
/* try command line argument */
- int i = find_arg_with_value(ua, N_("client"));
+ int i = find_arg_with_value(ua, NT_("client"));
if (i >= 0) {
if (!has_value(ua, i)) {
return 0;
/* Check MediaType and select storage that corresponds */
get_storage_from_mediatype(ua, &rx->name_list, rx);
- if (find_arg(ua, N_("done")) < 0) {
+ if (find_arg(ua, NT_("done")) < 0) {
/* Let the user interact in selecting which files to restore */
OK = user_select_files_from_tree(&tree);
}
jcr->cloned = cloned;
- if (find_arg(ua, N_("fdcalled")) > 0) {
+ if (find_arg(ua, NT_("fdcalled")) > 0) {
jcr->file_bsock = dup_bsock(ua->UA_sock);
ua->quit = true;
}
}
/* Run without prompting? */
- if (ua->batch || find_arg(ua, N_("yes")) > 0) {
+ if (ua->batch || find_arg(ua, NT_("yes")) > 0) {
goto start_job;
}
int i;
for (i=1; i<ua->argc; i++) {
- if ((strcasecmp(ua->argk[i], N_("client")) == 0 ||
- strcasecmp(ua->argk[i], N_("fd")) == 0) && ua->argv[i]) {
+ if ((strcasecmp(ua->argk[i], NT_("client")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("fd")) == 0) && ua->argv[i]) {
if (!acl_access_ok(ua, Client_ACL, ua->argv[i])) {
break;
}
uint32_t *ids;
for (i=1; i<ua->argc; i++) {
- if (strcasecmp(ua->argk[i], N_("pool")) == 0 && ua->argv[i] &&
+ if (strcasecmp(ua->argk[i], NT_("pool")) == 0 && ua->argv[i] &&
acl_access_ok(ua, Pool_ACL, ua->argv[i])) {
bstrncpy(pr->Name, ua->argv[i], sizeof(pr->Name));
if (!db_get_pool_record(ua->jcr, ua->db, pr)) {
int i;
for (i=1; i<ua->argc; i++) {
- if (strcasecmp(ua->argk[i], N_("ujobid")) == 0 && ua->argv[i]) {
+ if (strcasecmp(ua->argk[i], NT_("ujobid")) == 0 && ua->argv[i]) {
jr->JobId = 0;
bstrncpy(jr->Job, ua->argv[i], sizeof(jr->Job));
- } else if (strcasecmp(ua->argk[i], N_("jobid")) == 0 && ua->argv[i]) {
+ } else if (strcasecmp(ua->argk[i], NT_("jobid")) == 0 && ua->argv[i]) {
jr->JobId = str_to_int64(ua->argv[i]);
jr->Job[0] = 0;
} else {
jr->Job[0] = 0;
for (i=1; i<ua->argc; i++) {
- if ((strcasecmp(ua->argk[i], N_("jobname")) == 0 ||
- strcasecmp(ua->argk[i], N_("job")) == 0) && ua->argv[i]) {
+ if ((strcasecmp(ua->argk[i], NT_("jobname")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("job")) == 0) && ua->argv[i]) {
jr->JobId = 0;
bstrncpy(jr->Name, ua->argv[i], sizeof(jr->Name));
break;
break;
}
} else {
- if (strcasecmp(ua->argk[i], N_("storage")) == 0 ||
- strcasecmp(ua->argk[i], N_("sd")) == 0) {
+ if (strcasecmp(ua->argk[i], NT_("storage")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("sd")) == 0) {
store_name = ua->argv[i];
break;
- } else if (strcasecmp(ua->argk[i], N_("jobid")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("jobid")) == 0) {
jobid = str_to_int64(ua->argv[i]);
if (jobid <= 0) {
bsendmsg(ua, _("Expecting jobid=nn command, got: %s\n"), ua->argk[i]);
free_jcr(jcr);
break;
- } else if (strcasecmp(ua->argk[i], N_("job")) == 0 ||
- strcasecmp(ua->argk[i], N_("jobname")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("job")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("jobname")) == 0) {
if (!ua->argv[i]) {
bsendmsg(ua, _("Expecting job=xxx, got: %s.\n"), ua->argk[i]);
return NULL;
store = jcr->store;
free_jcr(jcr);
break;
- } else if (strcasecmp(ua->argk[i], N_("ujobid")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("ujobid")) == 0) {
if (!ua->argv[i]) {
bsendmsg(ua, _("Expecting ujobid=xxx, got: %s.\n"), ua->argk[i]);
return NULL;
Dmsg1(20, "status:%s:\n", cmd);
for (i=1; i<ua->argc; i++) {
- if (strcasecmp(ua->argk[i], N_("all")) == 0) {
+ if (strcasecmp(ua->argk[i], NT_("all")) == 0) {
do_all_status(ua);
return 1;
- } else if (strcasecmp(ua->argk[i], N_("dir")) == 0 ||
- strcasecmp(ua->argk[i], N_("director")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("dir")) == 0 ||
+ strcasecmp(ua->argk[i], NT_("director")) == 0) {
do_director_status(ua);
return 1;
- } else if (strcasecmp(ua->argk[i], N_("client")) == 0) {
+ } else if (strcasecmp(ua->argk[i], NT_("client")) == 0) {
client = get_client_resource(ua);
if (client) {
do_client_status(ua, client);
char prmt[MAX_NAME_LENGTH];
start_prompt(ua, _("Status available for:\n"));
- add_prompt(ua, N_("Director"));
- add_prompt(ua, N_("Storage"));
- add_prompt(ua, N_("Client"));
- add_prompt(ua, N_("All"));
+ add_prompt(ua, NT_("Director"));
+ add_prompt(ua, NT_("Storage"));
+ add_prompt(ua, NT_("Client"));
+ add_prompt(ua, NT_("All"));
Dmsg0(20, "do_prompt: select daemon\n");
if ((item=do_prompt(ua, "", _("Select daemon type for status"), prmt, sizeof(prmt))) < 0) {
return 1;
Dmsg0(200, "enter list_sched_jobs()\n");
days = 1;
- i = find_arg_with_value(ua, N_("days"));
+ i = find_arg_with_value(ua, NT_("days"));
if (i >= 0) {
days = atoi(ua->argv[i]);
if ((days < 0) || (days > 50)) {
struct cmdstruct { const char *key; int (*func)(UAContext *ua, TREE_CTX *tree); const char *help; };
static struct cmdstruct commands[] = {
- { N_("cd"), cdcmd, _("change current directory")},
- { N_("count"), countcmd, _("count marked files in and below the cd")},
- { N_("dir"), dircmd, _("long list current directory, wildcards allowed")},
- { N_(".dir"), dot_dircmd, _("long list current directory, wildcards allowed")},
- { N_("done"), donecmd, _("leave file selection mode")},
- { N_("estimate"), estimatecmd, _("estimate restore size")},
- { N_("exit"), donecmd, _("same as done command")},
- { N_("find"), findcmd, _("find files, wildcards allowed")},
- { N_("help"), helpcmd, _("print help")},
- { N_("ls"), lscmd, _("list current directory, wildcards allowed")},
- { N_("lsmark"), lsmarkcmd, _("list the marked files in and below the cd")},
- { N_("mark"), markcmd, _("mark dir/file to be restored recursively, wildcards allowed")},
- { N_("markdir"), markdircmd, _("mark directory name to be restored (no files)")},
- { N_("pwd"), pwdcmd, _("print current working directory")},
- { N_("unmark"), unmarkcmd, _("unmark dir/file to be restored recursively in dir")},
- { N_("unmarkdir"), unmarkdircmd, _("unmark directory name only no recursion")},
- { N_("quit"), quitcmd, _("quit and do not do restore")},
- { N_("?"), helpcmd, _("print help")},
+ { NT_("cd"), cdcmd, _("change current directory")},
+ { NT_("count"), countcmd, _("count marked files in and below the cd")},
+ { NT_("dir"), dircmd, _("long list current directory, wildcards allowed")},
+ { NT_(".dir"), dot_dircmd, _("long list current directory, wildcards allowed")},
+ { NT_("done"), donecmd, _("leave file selection mode")},
+ { NT_("estimate"), estimatecmd, _("estimate restore size")},
+ { NT_("exit"), donecmd, _("same as done command")},
+ { NT_("find"), findcmd, _("find files, wildcards allowed")},
+ { NT_("help"), helpcmd, _("print help")},
+ { NT_("ls"), lscmd, _("list current directory, wildcards allowed")},
+ { NT_("lsmark"), lsmarkcmd, _("list the marked files in and below the cd")},
+ { NT_("mark"), markcmd, _("mark dir/file to be restored recursively, wildcards allowed")},
+ { NT_("markdir"), markdircmd, _("mark directory name to be restored (no files)")},
+ { NT_("pwd"), pwdcmd, _("print current working directory")},
+ { NT_("unmark"), unmarkcmd, _("unmark dir/file to be restored recursively in dir")},
+ { NT_("unmarkdir"), unmarkdircmd, _("unmark directory name only no recursion")},
+ { NT_("quit"), quitcmd, _("quit and do not do restore")},
+ { NT_("?"), helpcmd, _("print help")},
};
#define comsize (sizeof(commands)/sizeof(struct cmdstruct))
int update_cmd(UAContext *ua, const char *cmd)
{
static const char *kw[] = {
- N_("media"), /* 0 */
- N_("volume"), /* 1 */
- N_("pool"), /* 2 */
- N_("slots"), /* 3 */
+ NT_("media"), /* 0 */
+ NT_("volume"), /* 1 */
+ NT_("pool"), /* 2 */
+ NT_("slots"), /* 3 */
NULL};
if (!open_db(ua)) {
{
POOL_MEM query(PM_MESSAGE);
const char *kw[] = {
- N_("Append"),
- N_("Archive"),
- N_("Disabled"),
- N_("Full"),
- N_("Used"),
- N_("Cleaning"),
- N_("Recycle"),
- N_("Read-Only"),
+ NT_("Append"),
+ NT_("Archive"),
+ NT_("Disabled"),
+ NT_("Full"),
+ NT_("Used"),
+ NT_("Cleaning"),
+ NT_("Recycle"),
+ NT_("Read-Only"),
NULL};
bool found = false;
int i;
/* Modify Volume Status */
bsendmsg(ua, _("Current Volume status is: %s\n"), mr.VolStatus);
start_prompt(ua, _("Possible Values are:\n"));
- add_prompt(ua, N_("Append"));
- add_prompt(ua, N_("Archive"));
- add_prompt(ua, N_("Disabled"));
- add_prompt(ua, N_("Full"));
- add_prompt(ua, N_("Used"));
- add_prompt(ua, N_("Cleaning"));
- if (strcmp(mr.VolStatus, N_("Purged")) == 0) {
- add_prompt(ua, N_("Recycle"));
+ add_prompt(ua, NT_("Append"));
+ add_prompt(ua, NT_("Archive"));
+ add_prompt(ua, NT_("Disabled"));
+ add_prompt(ua, NT_("Full"));
+ add_prompt(ua, NT_("Used"));
+ add_prompt(ua, NT_("Cleaning"));
+ if (strcmp(mr.VolStatus, NT_("Purged")) == 0) {
+ add_prompt(ua, NT_("Recycle"));
}
- add_prompt(ua, N_("Read-Only"));
+ add_prompt(ua, NT_("Read-Only"));
if (do_prompt(ua, "", _("Choose new Volume Status"), ua->cmd, sizeof(mr.VolStatus)) < 0) {
return 1;
}
}
/* Now find all the files that are missing -- i.e. all files in
- * the database where the MarkedId != current JobId
+ * the database where the MarkId != current JobId
*/
jcr->fn_printed = false;
bsnprintf(buf, sizeof(buf),
"SELECT Path.Path,Filename.Name FROM File,Path,Filename "
"WHERE File.JobId=%d "
-"AND File.MarkedId!=%d AND File.PathId=Path.PathId "
+"AND File.MarkId!=%d AND File.PathId=Path.PathId "
"AND File.FilenameId=Filename.FilenameId",
JobId, jcr->JobId);
/* missing_handler is called for each file found */
* Version $Id$
*/
/*
- Copyright (C) 2000-2005 Kern Sibbald
+ Copyright (C) 2001-2006 Kern Sibbald
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.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
* Version $Id$
*/
/*
- Copyright (C) 2000-2005 Kern Sibbald
+ Copyright (C) 2000-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#include "filed.h"
#ifdef WIN32_VSS
#include "vss.h"
+static pthread_mutex_t vss_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
extern char my_name[];
static bool term_fileset(JCR *jcr)
{
FF_PKT *ff = jcr->ff;
+
+#ifdef xxx
findFILESET *fileset = ff->fileset;
int i, j, k;
Dmsg1(400, "F %s\n", (char *)incexe->name_list.get(j));
}
}
+#endif
return ff->fileset->state != state_error;
}
}
while (bnet_recv(dir) >= 0) {
strip_trailing_junk(dir->msg);
- Dmsg1(400, "Fileset: %s\n", dir->msg);
+ Dmsg1(500, "Fileset: %s\n", dir->msg);
add_fileset(jcr, dir->msg);
}
if (!term_fileset(jcr)) {
#ifdef WIN32_VSS
/* START VSS ON WIN 32 */
if (g_pVSSClient && enable_vss) {
+ /* Run only one at a time */
+ P(vss_mutex);
if (g_pVSSClient->InitializeForBackup()) {
/* tell vss which drives to snapshot */
char szWinDriveLetters[27];
#ifdef WIN32_VSS
/* STOP VSS ON WIN 32 */
/* tell vss to close the backup session */
- if (g_pVSSClient && enable_vss == 1)
+ if (g_pVSSClient && enable_vss) {
g_pVSSClient->CloseBackup();
+ V(vss_mutex);
+ }
#endif
bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
/* Read-only variables */
static struct s_vars getvars[] = {
- { N_("FDName"), "s"}, /* 0 */
- { N_("Level"), "s"}, /* 1 */
- { N_("Type"), "s"}, /* 2 */
- { N_("JobId"), "i"}, /* 3 */
- { N_("Client"), "s"}, /* 4 */
- { N_("JobName"), "s"}, /* 5 */
- { N_("JobStatus"), "s"}, /* 6 */
+ { NT_("FDName"), "s"}, /* 0 */
+ { NT_("Level"), "s"}, /* 1 */
+ { NT_("Type"), "s"}, /* 2 */
+ { NT_("JobId"), "i"}, /* 3 */
+ { NT_("Client"), "s"}, /* 4 */
+ { NT_("JobName"), "s"}, /* 5 */
+ { NT_("JobStatus"), "s"}, /* 6 */
{ NULL, NULL}
};
/* Writable variables */
static struct s_vars setvars[] = {
- { N_("JobReport"), "s"},
+ { NT_("JobReport"), "s"},
{ NULL, NULL}
};
* Version $Id$
*/
/*
- Copyright (C) 2000-2005 Kern Sibbald
+ Copyright (C) 2000-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
static int our_callback(FF_PKT *ff, void *hpkt, bool top_level);
static bool accept_file(FF_PKT *ff);
-/* Fold case in fnmatch() on Win32 */
-#ifdef WIN32
-static const int fnmode = FNM_CASEFOLD;
-#else
static const int fnmode = 0;
-#endif
-
/*
* Initialize the find files "global" variables
* Kern Sibbald MMI
*/
/*
- Copyright (C) 2001-2005 Kern Sibbald
+ Copyright (C) 2001-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
* first argument to the find_files callback subroutine.
*/
struct FF_PKT {
- char *fname; /* filename */
+ char *fname; /* full filename */
char *link; /* link if file linked */
POOLMEM *sys_fname; /* system filename */
struct stat statp; /* stat packet */
struct cmdstruct { const char *key; void (*func)(); const char *help; };
static struct cmdstruct commands[] = {
- {N_("autochanger"),autochangercmd, _("test autochanger")},
- {N_("bsf"), bsfcmd, _("backspace file")},
- {N_("bsr"), bsrcmd, _("backspace record")},
- {N_("bfill"), bfill_cmd, _("fill tape using Bacula writes")},
- {N_("cap"), capcmd, _("list device capabilities")},
- {N_("clear"), clearcmd, _("clear tape errors")},
- {N_("eod"), eodcmd, _("go to end of Bacula data for append")},
- {N_("eom"), eomcmd, _("go to the physical end of medium")},
- {N_("fill"), fillcmd, _("fill tape, write onto second volume")},
- {N_("unfill"), unfillcmd, _("read filled tape")},
- {N_("fsf"), fsfcmd, _("forward space a file")},
- {N_("fsr"), fsrcmd, _("forward space a record")},
- {N_("help"), helpcmd, _("print this command")},
- {N_("label"), labelcmd, _("write a Bacula label to the tape")},
- {N_("load"), loadcmd, _("load a tape")},
- {N_("quit"), quitcmd, _("quit btape")},
- {N_("rawfill"), rawfill_cmd, _("use write() to fill tape")},
- {N_("readlabel"), readlabelcmd, _("read and print the Bacula tape label")},
- {N_("rectest"), rectestcmd, _("test record handling functions")},
- {N_("rewind"), rewindcmd, _("rewind the tape")},
- {N_("scan"), scancmd, _("read() tape block by block to EOT and report")},
- {N_("scanblocks"),scan_blocks, _("Bacula read block by block to EOT and report")},
- {N_("status"), statcmd, _("print tape status")},
- {N_("test"), testcmd, _("General test Bacula tape functions")},
- {N_("weof"), weofcmd, _("write an EOF on the tape")},
- {N_("wr"), wrcmd, _("write a single Bacula block")},
- {N_("rr"), rrcmd, _("read a single record")},
- {N_("qfill"), qfillcmd, _("quick fill command")}
+ {NT_("autochanger"),autochangercmd, _("test autochanger")},
+ {NT_("bsf"), bsfcmd, _("backspace file")},
+ {NT_("bsr"), bsrcmd, _("backspace record")},
+ {NT_("bfill"), bfill_cmd, _("fill tape using Bacula writes")},
+ {NT_("cap"), capcmd, _("list device capabilities")},
+ {NT_("clear"), clearcmd, _("clear tape errors")},
+ {NT_("eod"), eodcmd, _("go to end of Bacula data for append")},
+ {NT_("eom"), eomcmd, _("go to the physical end of medium")},
+ {NT_("fill"), fillcmd, _("fill tape, write onto second volume")},
+ {NT_("unfill"), unfillcmd, _("read filled tape")},
+ {NT_("fsf"), fsfcmd, _("forward space a file")},
+ {NT_("fsr"), fsrcmd, _("forward space a record")},
+ {NT_("help"), helpcmd, _("print this command")},
+ {NT_("label"), labelcmd, _("write a Bacula label to the tape")},
+ {NT_("load"), loadcmd, _("load a tape")},
+ {NT_("quit"), quitcmd, _("quit btape")},
+ {NT_("rawfill"), rawfill_cmd, _("use write() to fill tape")},
+ {NT_("readlabel"), readlabelcmd, _("read and print the Bacula tape label")},
+ {NT_("rectest"), rectestcmd, _("test record handling functions")},
+ {NT_("rewind"), rewindcmd, _("rewind the tape")},
+ {NT_("scan"), scancmd, _("read() tape block by block to EOT and report")},
+ {NT_("scanblocks"),scan_blocks, _("Bacula read block by block to EOT and report")},
+ {NT_("status"), statcmd, _("print tape status")},
+ {NT_("test"), testcmd, _("General test Bacula tape functions")},
+ {NT_("weof"), weofcmd, _("write an EOF on the tape")},
+ {NT_("wr"), wrcmd, _("write a single Bacula block")},
+ {NT_("rr"), rrcmd, _("read a single record")},
+ {NT_("qfill"), qfillcmd, _("quick fill command")}
};
#define comsize (sizeof(commands)/sizeof(struct cmdstruct))
};
static struct s_vars getvars[] = {
- { N_("Job"), "s"}, /* 0 */
- { N_("SDName"), "s"}, /* 1 */
- { N_("Level"), "s"}, /* 2 */
- { N_("Type"), "s"}, /* 3 */
- { N_("JobId"), "i"}, /* 4 */
- { N_("Client"), "s"}, /* 5 */
- { N_("Pool"), "s"}, /* 6 */
- { N_("MediaType"), "s"}, /* 7 */
- { N_("JobName"), "s"}, /* 8 */
- { N_("JobStatus"), "s"}, /* 9 */
- { N_("VolumeName"), "s"}, /* 10 */
- { N_("Device"), "s"}, /* 11 */
+ { NT_("Job"), "s"}, /* 0 */
+ { NT_("SDName"), "s"}, /* 1 */
+ { NT_("Level"), "s"}, /* 2 */
+ { NT_("Type"), "s"}, /* 3 */
+ { NT_("JobId"), "i"}, /* 4 */
+ { NT_("Client"), "s"}, /* 5 */
+ { NT_("Pool"), "s"}, /* 6 */
+ { NT_("MediaType"), "s"}, /* 7 */
+ { NT_("JobName"), "s"}, /* 8 */
+ { NT_("JobStatus"), "s"}, /* 9 */
+ { NT_("VolumeName"), "s"}, /* 10 */
+ { NT_("Device"), "s"}, /* 11 */
{ NULL, NULL}
};
/* Writable variables */
static struct s_vars setvars[] = {
- { N_("JobReport"), "s"},
+ { NT_("JobReport"), "s"},
{ NULL, NULL}
};
DIRCONFOBJS = ../dird/dird_conf.o ../dird/run_conf.o ../dird/inc_conf.o
NODIRTOOLS = bsmtp
-DIRTOOLS = bsmtp dbcheck fstype testfind testls regex
+DIRTOOLS = bsmtp dbcheck fstype testfind testls regex wild
TOOLS = $(@DIR_TOOLS@)
INSNODIRTOOLS = bsmtp
$(CXX) -g $(LDFLAGS) -L. -L../lib -o $@ regex.o \
$(DLIB) -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
+wild: ../findlib/libfind.a ../lib/libbac.a wild.o
+ $(CXX) -g $(LDFLAGS) -L. -L../lib -o $@ wild.o \
+ $(DLIB) -lbac -lm $(LIBS) $(GETTEXT_LIBS) $(OPENSSL_LIBS)
+
+
Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
cd $(topdir) \
--- /dev/null
+/*
+ * Test program for testing wild card expressions
+ */
+/*
+ Copyright (C) 2006 Kern Sibbald
+
+ 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 amended with additional clauses defined in the
+ file LICENSE in the main source directory.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
+
+ */
+
+#include "bacula.h"
+#include "lib/fnmatch.h"
+
+
+static void usage()
+{
+ fprintf(stderr,
+"\n"
+"Usage: wild [-d debug_level] -f <data-file>\n"
+" -f specify file of data to be matched\n"
+" -i use case insenitive match\n"
+" -l suppress line numbers\n"
+" -n print lines that do not match\n"
+" -? print this message.\n"
+"\n\n");
+
+ exit(1);
+}
+
+/* Fold case in fnmatch() on Win32 */
+#ifdef WIN32
+static const int fnmode = FNM_CASEFOLD;
+#else
+static const int fnmode = 0;
+#endif
+
+int main(int argc, char *const *argv)
+{
+ char *fname = NULL;
+ int rc, ch;
+ char data[1000];
+ char pat[500];
+ FILE *fd;
+ bool match_only = true;
+ int lineno;
+ bool no_linenos = false;
+ int ic = 0;
+
+
+ setlocale(LC_ALL, "");
+ bindtextdomain("bacula", LOCALEDIR);
+ textdomain("bacula");
+
+ while ((ch = getopt(argc, argv, "d:f:in?")) != -1) {
+ switch (ch) {
+ case 'd': /* set debug level */
+ debug_level = atoi(optarg);
+ if (debug_level <= 0) {
+ debug_level = 1;
+ }
+ break;
+
+ case 'f': /* data */
+ fname = optarg;
+ break;
+
+ case 'i': /* ignore case */
+ ic = FNM_CASEFOLD;
+ break;
+
+ case 'l':
+ no_linenos = true;
+ break;
+
+ case 'n':
+ match_only = false;
+ break;
+
+ case '?':
+ default:
+ usage();
+
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (!fname) {
+ printf("A data file must be specified.\n");
+ usage();
+ }
+
+ for ( ;; ) {
+ printf("Enter a wild-card: ");
+ if (fgets(pat, sizeof(pat)-1, stdin) == NULL) {
+ break;
+ }
+ strip_trailing_newline(pat);
+ if (pat[0] == 0) {
+ exit(0);
+ }
+ fd = fopen(fname, "r");
+ if (!fd) {
+ printf(_("Could not open data file: %s\n"), fname);
+ exit(1);
+ }
+ lineno = 0;
+ while (fgets(data, sizeof(data)-1, fd)) {
+ strip_trailing_newline(data);
+ lineno++;
+ rc = fnmatch(pat, data, fnmode | ic);
+ if ((match_only && rc == 0) || (!match_only && rc != 0)) {
+ if (no_linenos) {
+ printf("%s\n", data);
+ } else {
+ printf("%5d: %s\n", lineno, data);
+ }
+ }
+ }
+ fclose(fd);
+ }
+ exit(0);
+}
#undef VERSION
#define VERSION "1.39.7"
-#define BDATE "08 April 2006"
-#define LSMDATE "08Apr06"
+#define BDATE "11 April 2006"
+#define LSMDATE "11Apr06"
/* Debug flags */
#undef DEBUG