1: /* Copyright 1988,1990,1993,1994 by Paul Vixie
2: * All rights reserved
3: *
4: * Distribute freely, except: don't remove my name from the source or
5: * documentation (don't take credit for my work), mark your changes (don't
6: * get me blamed for your possible bugs), don't alter or remove this
7: * notice. May be sold if buildable source is provided to buyer. No
8: * warrantee of any kind, express or implied, is included with this
9: * software; use at your own risk, responsibility for damages (if any) to
10: * anyone resulting from the use of this software rests entirely with the
11: * user.
12: *
13: * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
14: * I'll try to keep a version up to date. I can be reached as follows:
15: * Paul Vixie <paul@vix.com> uunet!decwrl!vixie!paul
16: */
17:
18: #if !defined(lint) && !defined(LINT)
19: static char rcsid[] = "$Id: job.c,v 1.6 1994/01/15 20:43:43 vixie Exp $";
20: #endif
21:
22:
23: #include "cron.h"
24:
25:
26: typedef struct _job {
27: struct _job *next;
28: entry *e;
29: user *u;
30: } job;
31:
32:
33: static job *jhead = NULL, *jtail = NULL;
34:
35:
36: void
37: job_add(e, u)
38: register entry *e;
39: register user *u;
40: {
41: register job *j;
42:
43: /* if already on queue, keep going */
44: for (j=jhead; j; j=j->next)
45: if (j->e == e && j->u == u) { return; }
46:
47: /* build a job queue element */
48: j = (job*)malloc(sizeof(job));
49: j->next = (job*) NULL;
50: j->e = e;
51: j->u = u;
52:
53: /* add it to the tail */
54: if (!jhead) { jhead=j; }
55: else { jtail->next=j; }
56: jtail = j;
57: }
58:
59:
60: int
61: job_runqueue()
62: {
63: register job *j, *jn;
64: register int run = 0;
65:
66: for (j=jhead; j; j=jn) {
67: do_command(j->e, j->u);
68: jn = j->next;
69: free(j);
70: run++;
71: }
72: jhead = jtail = NULL;
73: return run;
74: }
Defined functions
Defined variables
jhead
defined in line
33; used 5 times
rcsid
defined in line
19;
never used
Defined struct's
_job
defined in line
26; used 2 times
Defined typedef's
job
defined in line
30; used 6 times