blob: c6f307147e926001fbe5072411aff57bd7620fb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/* SPDX-License-Identifier: ISC */
#ifndef GCROND_H
#define GCROND_H
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <limits.h>
#include <signal.h>
#include <dirent.h>
#include <stdarg.h>
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <time.h>
#include "config.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
typedef struct crontab_t {
struct crontab_t *next;
char *exec;
uint64_t minute;
uint32_t hour;
uint32_t dayofmonth;
uint16_t month;
uint8_t dayofweek;
} crontab_t;
typedef struct {
const char *filename; /* input file name */
size_t lineno; /* current line number */
FILE *fp;
char *line;
} rdline_t;
int rdline_init(rdline_t *t, int dirfd, const char *filename);
void rdline_complain(rdline_t *t, const char *msg, ...);
void rdline_cleanup(rdline_t *t);
int rdline(rdline_t *t);
crontab_t *rdcron(int dirfd, const char *filename);
void delcron(crontab_t *cron);
int cronscan(const char *directory, crontab_t **list);
void cron_tm_to_mask(crontab_t *out, struct tm *t);
bool cron_should_run(const crontab_t *t, const crontab_t *mask);
int runjob(crontab_t *tab);
#endif /* GCROND_H */
|