msgdump.c
author viric@mandarina
Wed, 18 Feb 2009 23:25:21 +0100
changeset 267 11631dd11ff8
parent 231 558b281b88f5
child 286 f648473fd056
permissions -rw-r--r--
Updating copyright years in the source.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49
09bb8a5583e9 Added the license.
lbatlle@npdl268.bpo.hp.com
parents: 44
diff changeset
     1
/*
09bb8a5583e9 Added the license.
lbatlle@npdl268.bpo.hp.com
parents: 44
diff changeset
     2
    Task Spooler - a task queue system for the unix user
267
11631dd11ff8 Updating copyright years in the source.
viric@mandarina
parents: 231
diff changeset
     3
    Copyright (C) 2007-2009  LluĂ­s Batlle i Rossell
49
09bb8a5583e9 Added the license.
lbatlle@npdl268.bpo.hp.com
parents: 44
diff changeset
     4
09bb8a5583e9 Added the license.
lbatlle@npdl268.bpo.hp.com
parents: 44
diff changeset
     5
    Please find the license in the provided COPYING file.
09bb8a5583e9 Added the license.
lbatlle@npdl268.bpo.hp.com
parents: 44
diff changeset
     6
*/
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
     7
#include <stdio.h>
146
5e689cb593aa Bones of the "-i" parameter, job info.
viric@llimona
parents: 117
diff changeset
     8
#include <sys/time.h>
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
     9
#include "main.h"
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    10
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    11
void msgdump(FILE *f, const struct msg *m)
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    12
{
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    13
    fprintf(f, "msgdump:\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    14
    switch(m->type)
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    15
    {
31
1a6c732b0b71 The command line parsing has been simplified.
viric@llimona
parents: 21
diff changeset
    16
        case KILL_SERVER:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    17
            fprintf(f, " KILL SERVER\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    18
            break;
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    19
        case NEWJOB:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    20
            fprintf(f, " NEWJOB\n");
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    21
            fprintf(f, " Commandsize: %i\n", m->u.newjob.command_size);
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    22
            break;
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    23
        case NEWJOB_OK:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    24
            fprintf(f, " NEWJOB_OK\n");
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    25
            fprintf(f, " JobID: '%i'\n", m->u.jobid);
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    26
            break;
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    27
        case RUNJOB:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    28
            fprintf(f, " RUNJOB\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    29
            break;
32
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    30
        case RUNJOB_OK:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    31
            fprintf(f, " RUNJOB_OK\n");
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    32
            fprintf(f, " Outputsize: %i\n", m->u.output.ofilename_size);
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    33
            fprintf(f, " pid: %i\n", m->u.output.pid);
32
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    34
            break;
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    35
        case ENDJOB:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    36
            fprintf(f, " ENDJOB\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    37
            break;
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    38
        case LIST:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    39
            fprintf(f, " LIST\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    40
            break;
5
bc5e251418f3 The LIST_LINEs are outputed by the client.
viric@llimona
parents: 4
diff changeset
    41
        case LIST_LINE:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    42
            fprintf(f, " LIST_LINE\n");
146
5e689cb593aa Bones of the "-i" parameter, job info.
viric@llimona
parents: 117
diff changeset
    43
            fprintf(f, " Linesize: %i\n", m->u.size);
32
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    44
            break;
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    45
        case ASK_OUTPUT:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    46
            fprintf(f, " ASK_OUTPUT\n");
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    47
            fprintf(f, " Jobid: %i\n", m->u.jobid);
32
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    48
            break;
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    49
        case ANSWER_OUTPUT:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    50
            fprintf(f, " ANSWER_OUTPUT\n");
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    51
            fprintf(f, " Outputsize: %i\n", m->u.output.ofilename_size);
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    52
            fprintf(f, " PID: %i\n", m->u.output.pid);
5
bc5e251418f3 The LIST_LINEs are outputed by the client.
viric@llimona
parents: 4
diff changeset
    53
            break;
44
4dcf05746ece Better include files.
viric@llimona
parents: 35
diff changeset
    54
        default:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    55
            fprintf(f, " Unknown message: %i\n", m->type);
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    56
    }
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    57
}