From f7804c608e017fe547b76190750337bddab8d596 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 23 Dec 2015 22:47:45 +0100 Subject: implement satq and satr, just sends a command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/satq.c | 17 ++++++++++++++++- src/satr.c | 19 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/satq.c b/src/satq.c index 3d87d1c..6fafba4 100644 --- a/src/satq.c +++ b/src/satq.c @@ -21,6 +21,9 @@ */ #include #include +#include + +#include "client.h" @@ -43,6 +46,16 @@ usage(void) } +/** + * Print all queued jobs. + * + * @param argc Should be 1 or 0. + * @param argv The command line, should only include the name of the process. + * @return 0 The process was successful. + * @return 1 The process failed queuing the job. + * @return 2 User error, you do not know what you are doing. + * @return 3 satd(1) failed. + */ int main(int argc, char *argv[]) { @@ -52,6 +65,8 @@ main(int argc, char *argv[]) argv0 = argv[0]; } - /* TODO print the job queue */ + if (send_command(0, NULL)) + return errno ? (perror(argv0), 1) : 3; + return 0; } diff --git a/src/satr.c b/src/satr.c index 1d6c1ce..739e432 100644 --- a/src/satr.c +++ b/src/satr.c @@ -19,6 +19,11 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +#include +#include +#include + +#include "client.h" @@ -41,6 +46,16 @@ usage(void) } +/** + * Run all queued jobs even if it is not time yet. + * + * @param argc Should be 1 or 0. + * @param argv The command line, should only include the name of the process. + * @return 0 The process was successful. + * @return 1 The process failed queuing the job. + * @return 2 User error, you do not know what you are doing. + * @return 3 satd(1) failed. + */ int main(int argc, char *argv[]) { @@ -50,6 +65,8 @@ main(int argc, char *argv[]) argv0 = argv[0]; } - /* TODO tell the daemon to start running jobs even if it is not time yet. */ + if (send_command(1, NULL)) + return errno ? (perror(argv0), 1) : 3; + return 0; } -- cgit v1.2.3-70-g09d2