summaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-20 02:35:46 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-20 02:35:46 +0100
commitceed357001a7543c62468c5b943cf80c2a644252 (patch)
treee090c9e85a953615d3a108f2bc64a9fbc763acc8 /job.c
parente5b5ae50f02d7814f37b15329da2adce0fb30825 (diff)
improve dump output
Diffstat (limited to 'job.c')
-rw-r--r--job.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/job.c b/job.c
index 3e8cca1e8f..ec0baba5ee 100644
--- a/job.c
+++ b/job.c
@@ -52,7 +52,7 @@ JobDependency* job_dependency_new(Job *subject, Job *object, bool matters) {
* this means the 'anchor' job (i.e. the one the user
* explcitily asked for) is the requester. */
- if (!(l = new(JobDependency, 1)))
+ if (!(l = new0(JobDependency, 1)))
return NULL;
l->subject = subject;
@@ -127,7 +127,7 @@ void job_dependency_delete(Job *subject, Job *object, bool *matters) {
job_dependency_free(l);
}
-void job_dump(Job *j, FILE*f) {
+void job_dump(Job *j, FILE*f, const char *prefix) {
static const char* const job_type_table[_JOB_TYPE_MAX] = {
[JOB_START] = "start",
@@ -148,11 +148,13 @@ void job_dump(Job *j, FILE*f) {
assert(j);
assert(f);
- fprintf(f, "Job %u (%s) → %s in state %s\n",
- j->id,
- name_id(j->name),
- job_type_table[j->type],
- job_state_table[j->state]);
+ fprintf(f,
+ "%sJob %u:\n"
+ "%s\tAction: %s → %s\n"
+ "%s\tState: %s\n",
+ prefix, j->id,
+ prefix, name_id(j->name), job_type_table[j->type],
+ prefix, job_state_table[j->state]);
}
bool job_is_anchor(Job *j) {