1
0
Fork 0
mirror of https://github.com/pygos/cron synced 2024-12-26 22:50:51 +01:00
cron/gcrond.h

63 lines
1.2 KiB
C
Raw Normal View History

/* 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>
#ifdef HAVE_LIBBSD
#include <bsd/bsd.h>
#endif
#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;
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 */