vfs: check userland buffers before reading them.
[haiku.git] / src / bin / pkgman / JobStateListener.cpp
blob3b35a615af137679aab9f6cd0e960d796294cc0a
1 /*
2 * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
3 * Distributed under the terms of the MIT License.
4 */
7 #include <stdio.h>
9 #include "JobStateListener.h"
10 #include "pkgman.h"
13 using BSupportKit::BJob;
16 JobStateListener::JobStateListener(uint32 flags)
18 fFlags(flags)
23 void
24 JobStateListener::JobStarted(BJob* job)
26 printf("%s ...\n", job->Title().String());
30 void
31 JobStateListener::JobSucceeded(BJob* job)
36 void
37 JobStateListener::JobFailed(BJob* job)
39 BString error = job->ErrorString();
40 if (error.Length() > 0) {
41 error.ReplaceAll("\n", "\n*** ");
42 fprintf(stderr, "%s", error.String());
44 if ((fFlags & EXIT_ON_ERROR) != 0)
45 DIE(job->Result(), "failed!");
49 void
50 JobStateListener::JobAborted(BJob* job)
52 if ((fFlags & EXIT_ON_ABORT) != 0)
53 DIE(job->Result(), "aborted");