Skip to content

Commit

Permalink
Refactor "prtit" to "printit"
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz committed Mar 27, 2015
1 parent e1e34be commit 1c435ae
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/dird/protos.h
Expand Up @@ -291,7 +291,7 @@ void update_inchanger_for_export(UAContext *ua, STORERES *store, dlist *vol_list

/* ua_output.c */
void bsendmsg(void *ua_ctx, const char *fmt, ...);
void prtit(void *ctx, const char *msg);
void printit(void *ctx, const char *msg);
bool complete_jcr_for_job(JCR *jcr, JOBRES *job, POOLRES *pool);
RUNRES *find_next_run(RUNRES *run, JOBRES *job, utime_t &runtime, int ndays);

Expand Down
36 changes: 18 additions & 18 deletions src/dird/ua_output.c
Expand Up @@ -391,19 +391,19 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
for (i = 1; i < ua->argc; i++) {
/* List JOBS */
if (bstrcasecmp(ua->argk[i], NT_("jobs"))) {
db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist);
db_list_job_records(ua->jcr, ua->db, &jr, printit, ua, llist);

/* List JOBTOTALS */
} else if (bstrcasecmp(ua->argk[i], NT_("jobtotals"))) {
db_list_job_totals(ua->jcr, ua->db, &jr, prtit, ua);
db_list_job_totals(ua->jcr, ua->db, &jr, printit, ua);

/* List JOBID=nn */
} else if (bstrcasecmp(ua->argk[i], NT_("jobid"))) {
if (ua->argv[i]) {
jobid = str_to_int64(ua->argv[i]);
if (jobid > 0) {
jr.JobId = jobid;
db_list_job_records(ua->jcr, ua->db, &jr, prtit, ua, llist);
db_list_job_records(ua->jcr, ua->db, &jr, printit, ua, llist);
}
}

Expand All @@ -412,13 +412,13 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
bstrcasecmp(ua->argk[i], NT_("jobname"))) && 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);
db_list_job_records(ua->jcr, ua->db, &jr, printit, ua, llist);

/* List UJOBID=xxx */
} else if (bstrcasecmp(ua->argk[i], NT_("ujobid")) && 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);
db_list_job_records(ua->jcr, ua->db, &jr, printit, ua, llist);

/* List Base files */
} else if (bstrcasecmp(ua->argk[i], NT_("basefiles"))) {
Expand All @@ -436,7 +436,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
continue;
}
if (jobid > 0) {
db_list_base_files_for_job(ua->jcr, ua->db, jobid, prtit, ua);
db_list_base_files_for_job(ua->jcr, ua->db, jobid, printit, ua);
}
}

Expand All @@ -457,7 +457,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
continue;
}
if (jobid > 0) {
db_list_files_for_job(ua->jcr, ua->db, jobid, prtit, ua);
db_list_files_for_job(ua->jcr, ua->db, jobid, printit, ua);
}
}

Expand All @@ -477,12 +477,12 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
} else {
continue;
}
db_list_jobmedia_records(ua->jcr, ua->db, jobid, prtit, ua, llist);
db_list_jobmedia_records(ua->jcr, ua->db, jobid, printit, ua, llist);
done = true;
}
if (!done) {
/* List for all jobs (jobid=0) */
db_list_jobmedia_records(ua->jcr, ua->db, 0, prtit, ua, llist);
db_list_jobmedia_records(ua->jcr, ua->db, 0, printit, ua, llist);
}

/* List JOBLOG */
Expand All @@ -501,12 +501,12 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
} else {
continue;
}
db_list_joblog_records(ua->jcr, ua->db, jobid, prtit, ua, llist);
db_list_joblog_records(ua->jcr, ua->db, jobid, printit, ua, llist);
done = true;
}
if (!done) {
/* List for all jobs (jobid=0) */
db_list_joblog_records(ua->jcr, ua->db, 0, prtit, ua, llist);
db_list_joblog_records(ua->jcr, ua->db, 0, printit, ua, llist);
}


Expand All @@ -518,10 +518,10 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
if (ua->argv[i]) {
bstrncpy(pr.Name, ua->argv[i], sizeof(pr.Name));
}
db_list_pool_records(ua->jcr, ua->db, &pr, prtit, ua, llist);
db_list_pool_records(ua->jcr, ua->db, &pr, printit, ua, llist);

} else if (bstrcasecmp(ua->argk[i], NT_("clients"))) {
db_list_client_records(ua->jcr, ua->db, prtit, ua, llist);
db_list_client_records(ua->jcr, ua->db, printit, ua, llist);

/* List MEDIA or VOLUMES */
} else if (bstrcasecmp(ua->argk[i], NT_("media")) ||
Expand Down Expand Up @@ -554,7 +554,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
/* List a specific volume? */
if (ua->argv[i]) {
bstrncpy(mr.VolumeName, ua->argv[i], sizeof(mr.VolumeName));
db_list_media_records(ua->jcr, ua->db, &mr, prtit, ua, llist);
db_list_media_records(ua->jcr, ua->db, &mr, printit, ua, llist);
return 1;
}
/* Is a specific pool wanted? */
Expand All @@ -565,7 +565,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
return 1;
}
mr.PoolId = pr.PoolId;
db_list_media_records(ua->jcr, ua->db, &mr, prtit, ua, llist);
db_list_media_records(ua->jcr, ua->db, &mr, printit, ua, llist);
return 1;
}
}
Expand All @@ -585,7 +585,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
ua->send_msg(_("Pool: %s\n"), pr.Name);
}
mr.PoolId = ids[i];
db_list_media_records(ua->jcr, ua->db, &mr, prtit, ua, llist);
db_list_media_records(ua->jcr, ua->db, &mr, printit, ua, llist);
}
free(ids);
return 1;
Expand Down Expand Up @@ -615,7 +615,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
limit = atoi(ua->argv[j]);
}
}
db_list_copies_records(ua->jcr,ua->db,limit,jobids,prtit,ua,llist);
db_list_copies_records(ua->jcr,ua->db,limit,jobids,printit,ua,llist);
} else if (bstrcasecmp(ua->argk[i], NT_("limit"))
|| bstrcasecmp(ua->argk[i], NT_("days"))) {
/* Ignore it */
Expand Down Expand Up @@ -904,7 +904,7 @@ int messages_cmd(UAContext *ua, const char *cmd)
/*
* Callback routine for "printing" database file listing
*/
void prtit(void *ctx, const char *msg)
void printit(void *ctx, const char *msg)
{
UAContext *ua = (UAContext *)ctx;

Expand Down
10 changes: 5 additions & 5 deletions src/dird/ua_query.c
Expand Up @@ -126,8 +126,8 @@ int query_cmd(UAContext *ua, const char *cmd)
query = substitute_prompts(ua, query, prompt, nprompt);
Dmsg1(100, "Query2=%s\n", query);
if (query[0] == '!') {
db_list_sql_query(ua->jcr, ua->db, query+1, prtit, ua, false, VERT_LIST);
} else if (!db_list_sql_query(ua->jcr, ua->db, query, prtit, ua, true, HORZ_LIST)) {
db_list_sql_query(ua->jcr, ua->db, query+1, printit, ua, false, VERT_LIST);
} else if (!db_list_sql_query(ua->jcr, ua->db, query, printit, ua, true, HORZ_LIST)) {
ua->send_msg("%s\n", query);
}
query[0] = 0;
Expand All @@ -138,8 +138,8 @@ int query_cmd(UAContext *ua, const char *cmd)
query = substitute_prompts(ua, query, prompt, nprompt);
Dmsg1(100, "Query2=%s\n", query);
if (query[0] == '!') {
db_list_sql_query(ua->jcr, ua->db, query+1, prtit, ua, false, VERT_LIST);
} else if (!db_list_sql_query(ua->jcr, ua->db, query, prtit, ua, true, HORZ_LIST)) {
db_list_sql_query(ua->jcr, ua->db, query+1, printit, ua, false, VERT_LIST);
} else if (!db_list_sql_query(ua->jcr, ua->db, query, printit, ua, true, HORZ_LIST)) {
ua->error_msg("%s\n", query);
}
}
Expand Down Expand Up @@ -271,7 +271,7 @@ int sqlquery_cmd(UAContext *ua, const char *cmd)
if (ua->cmd[len-1] == ';') {
ua->cmd[len-1] = 0; /* zap ; */
/* Submit query */
db_list_sql_query(ua->jcr, ua->db, query.c_str(), prtit, ua, true, HORZ_LIST);
db_list_sql_query(ua->jcr, ua->db, query.c_str(), printit, ua, true, HORZ_LIST);
*query.c_str() = 0; /* start new query */
msg = _("Enter SQL query: ");
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/dird/ua_restore.c
Expand Up @@ -349,7 +349,7 @@ static void get_and_display_basejobs(UAContext *ua, RESTORE_CTX *rx)

Mmsg(q, uar_print_jobs, jobids.list);
ua->send_msg(_("The restore will use the following job(s) as Base\n"));
db_list_sql_query(ua->jcr, ua->db, q.c_str(), prtit, ua, true, HORZ_LIST);
db_list_sql_query(ua->jcr, ua->db, q.c_str(), printit, ua, true, HORZ_LIST);
}
pm_strcpy(rx->BaseJobIds, jobids.list);
}
Expand Down Expand Up @@ -645,7 +645,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
}
gui_save = ua->jcr->gui;
ua->jcr->gui = true;
db_list_sql_query(ua->jcr, ua->db, uar_list_jobs, prtit, ua, true, HORZ_LIST);
db_list_sql_query(ua->jcr, ua->db, uar_list_jobs, printit, ua, true, HORZ_LIST);
ua->jcr->gui = gui_save;
done = false;
break;
Expand All @@ -663,7 +663,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
free(fname);
gui_save = ua->jcr->gui;
ua->jcr->gui = true;
db_list_sql_query(ua->jcr, ua->db, rx->query, prtit, ua, true, HORZ_LIST);
db_list_sql_query(ua->jcr, ua->db, rx->query, printit, ua, true, HORZ_LIST);
ua->jcr->gui = gui_save;
done = false;
break;
Expand All @@ -683,7 +683,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
}
gui_save = ua->jcr->gui;
ua->jcr->gui = true;
db_list_sql_query(ua->jcr, ua->db, ua->cmd, prtit, ua, true, HORZ_LIST);
db_list_sql_query(ua->jcr, ua->db, ua->cmd, printit, ua, true, HORZ_LIST);
ua->jcr->gui = gui_save;
done = false;
break;
Expand Down Expand Up @@ -1455,13 +1455,13 @@ static bool select_backups_before_date(UAContext *ua, RESTORE_CTX *rx, char *dat
* Display a list of all copies
*/
db_list_copies_records(ua->jcr, ua->db, 0, rx->JobIds,
prtit, ua, HORZ_LIST);
printit, ua, HORZ_LIST);
}

/*
* Display a list of Jobs selected for this restore
*/
db_list_sql_query(ua->jcr, ua->db, uar_list_temp, prtit, ua, true, HORZ_LIST);
db_list_sql_query(ua->jcr, ua->db, uar_list_temp, printit, ua, true, HORZ_LIST);
ok = true;
} else {
ua->warning_msg(_("No jobs found.\n"));
Expand Down
4 changes: 2 additions & 2 deletions src/dird/ua_select.c
Expand Up @@ -674,7 +674,7 @@ int select_media_dbr(UAContext *ua, MEDIA_DBR *mr)
goto bail_out;
}
mr->PoolId = pr.PoolId;
db_list_media_records(ua->jcr, ua->db, mr, prtit, ua, HORZ_LIST);
db_list_media_records(ua->jcr, ua->db, mr, printit, ua, HORZ_LIST);
if (!get_cmd(ua, _("Enter *MediaId or Volume name: "))) {
goto bail_out;
}
Expand Down Expand Up @@ -750,7 +750,7 @@ POOLRES *get_pool_resource(UAContext *ua)
*/
int select_job_dbr(UAContext *ua, JOB_DBR *jr)
{
db_list_job_records(ua->jcr, ua->db, jr, prtit, ua, HORZ_LIST);
db_list_job_records(ua->jcr, ua->db, jr, printit, ua, HORZ_LIST);
if (!get_pint(ua, _("Enter the JobId to select: "))) {
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dird/ua_update.c
Expand Up @@ -899,7 +899,7 @@ static bool update_pool(UAContext *ua)
}
query = get_pool_memory(PM_MESSAGE);
Mmsg(query, list_pool, edit_int64(pr.PoolId, ed1));
db_list_sql_query(ua->jcr, ua->db, query, prtit, ua, true, HORZ_LIST);
db_list_sql_query(ua->jcr, ua->db, query, printit, ua, true, HORZ_LIST);
free_pool_memory(query);
ua->info_msg(_("Pool DB record updated from resource.\n"));
return true;
Expand Down

0 comments on commit 1c435ae

Please sign in to comment.