msgdump.c
author viric@llimona
Fri, 13 Apr 2007 20:50:31 +0200
changeset 125 b60f173b1489
parent 117 db479ef293d3
child 146 5e689cb593aa
permissions -rw-r--r--
Copyright for list.c
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
09bb8a5583e9 Added the license.
lbatlle@npdl268.bpo.hp.com
parents: 44
diff changeset
     3
    Copyright (C) 2007  LluĂ­s Batlle i Rossell
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>
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
     8
#include "main.h"
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
     9
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    10
void msgdump(FILE *f, const struct msg *m)
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    11
{
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    12
    fprintf(f, "msgdump:\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    13
    switch(m->type)
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    14
    {
31
1a6c732b0b71 The command line parsing has been simplified.
viric@llimona
parents: 21
diff changeset
    15
        case KILL_SERVER:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    16
            fprintf(f, " KILL SERVER\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    17
            break;
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    18
        case NEWJOB:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    19
            fprintf(f, " NEWJOB\n");
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    20
            fprintf(f, " Commandsize: %i\n", m->u.newjob.command_size);
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    21
            break;
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    22
        case NEWJOB_OK:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    23
            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
    24
            fprintf(f, " JobID: '%i'\n", m->u.jobid);
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    25
            break;
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    26
        case RUNJOB:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    27
            fprintf(f, " RUNJOB\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    28
            break;
32
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    29
        case RUNJOB_OK:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    30
            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
    31
            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
    32
            fprintf(f, " pid: %i\n", m->u.output.pid);
32
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    33
            break;
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    34
        case ENDJOB:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    35
            fprintf(f, " ENDJOB\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    36
            break;
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    37
        case LIST:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    38
            fprintf(f, " LIST\n");
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    39
            break;
5
bc5e251418f3 The LIST_LINEs are outputed by the client.
viric@llimona
parents: 4
diff changeset
    40
        case LIST_LINE:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    41
            fprintf(f, " LIST_LINE\n");
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    42
            fprintf(f, " Linesize: %i\n", m->u.line_size);
32
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    43
            break;
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    44
        case ASK_OUTPUT:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    45
            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
    46
            fprintf(f, " Jobid: %i\n", m->u.jobid);
32
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    47
            break;
3531439f2770 Tail works.
viric@llimona
parents: 31
diff changeset
    48
        case ANSWER_OUTPUT:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    49
            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
    50
            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
    51
            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
    52
            break;
44
4dcf05746ece Better include files.
viric@llimona
parents: 35
diff changeset
    53
        default:
111
d6bc62904b5a Fixed a buffer overflow in jobs.c, when sending the lines for LISTJOBS.
viric@mandarina
parents: 92
diff changeset
    54
            fprintf(f, " Unknown message: %i\n", m->type);
3
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    55
    }
2fb8a6bdd024 More code.
viric@llimona
parents:
diff changeset
    56
}