* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: conf.c,v 1.60 2002-10-06 17:08:05 thib Exp $ */
+ /* $Id: conf.c,v 1.61 2002-10-28 17:54:19 thib Exp $ */
#include "fcron.h"
}
-
-/* save_file() error management */
-#define Save_type(FD, TYPE) \
- { \
- if ( save_type(FD, TYPE) != OK ) { \
- error_e("Could not write type : file has not been saved."); \
- close(FD); \
- remove(file->cf_user); \
- goto next_file; \
- } \
- }
-
-#define Save_str(FD, TYPE, STR) \
- { \
- if ( save_str(FD, TYPE, STR) != OK ) { \
- error_e("Could not write str : file has not been saved."); \
- close(FD); \
- remove(file->cf_user); \
- goto next_file; \
- } \
- }
-
-#define Save_strn(FD, TYPE, STR, SIZE) \
- { \
- if ( save_strn(FD, TYPE, STR, SIZE) != OK ) { \
- error_e("Could not write strn : file has not been saved."); \
- close(FD); \
- remove(file->cf_user); \
- goto next_file; \
- } \
- }
-
-#define Save_lint(FD, TYPE, VALUE) \
- { \
- if ( save_lint(FD, TYPE, VALUE) != OK ) { \
- error_e("Could not write lint : file has not been saved."); \
- close(FD); \
- remove(file->cf_user); \
- goto next_file; \
- } \
- }
-
void
save_file(cf_t *arg_file)
/* Store the informations relatives to the executions
* of tasks at a defined frequency of system's running time */
{
cf_t *file = NULL;
- cl_t *line = NULL;
int fd;
cf_t *start_file = NULL;
- env_t *env = NULL;
if (arg_file != NULL)
start_file = arg_file;
fd = open(file->cf_user, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, S_IRUSR|S_IWUSR);
if ( fd == -1 ) {
error_e("Could not open %s", file->cf_user);
- goto next_file;
}
+ else {
- /* chown the file to root:root : this file should only be read and
- * modified by fcron (not fcrontab) */
- if (fchown(fd, ROOTUID, ROOTGID) != 0)
- error_e("Could not fchown \"%s\"", file->cf_user);
-
- /* save file : */
-
- /* put program's version : it permit to daemon not to load
- * a file which he won't understand the syntax, for exemple
- * a file using a depreciated format generated by an old fcrontab,
- * if the syntax has changed */
- /* an binary fcrontab *must* start by such a header */
- Save_lint(fd, S_HEADER_T, S_FILEVERSION );
-
- /* put the user's name : needed to check if his uid has not changed */
- /* S_USER_T *must* be the 2nd field of a binary fcrontab */
- Save_str(fd, S_USER_T, file->cf_user);
-
- /* put the time & date of saving : this is use for calcutating
- * the system down time. As it is a new file, we set it to 0 */
- /* S_USER_T *must* be the 3rd field of a binary fcrontab */
- Save_lint(fd, S_TIMEDATE_T, now);
-
- /* Save the time diff between local (real) and system hour (if any) */
- if ( file->cf_tzdiff != 0 )
- Save_lint(fd, S_TZDIFF_T, file->cf_tzdiff);
-
- /* env variables, */
- for (env = file->cf_env_base; env; env = env->e_next)
- Save_str(fd, S_ENVVAR_T, env->e_val);
-
- /* then, lines. */
- for (line = file->cf_line_base; line; line = line->cl_next) {
-
- /* this ones are saved for every lines */
- Save_str(fd, S_SHELL_T, line->cl_shell);
- Save_str(fd, S_RUNAS_T, line->cl_runas);
- Save_str(fd, S_MAILTO_T, line->cl_mailto);
- Save_strn(fd, S_OPTION_T, line->cl_option, OPTION_SIZE);
-
- /* the following are saved only if needed */
- if ( is_volatile(line->cl_option) && is_freq(line->cl_option) ) {
- Save_lint(fd, S_FIRST_T, line->cl_first);
- }
- else
- Save_lint(fd, S_NEXTEXE_T, line->cl_nextexe);
- if ( line->cl_numexe )
- Save_strn(fd, S_NUMEXE_T, &line->cl_numexe, 1);
- if ( is_lavg(line->cl_option) )
- Save_strn(fd, S_LAVG_T, line->cl_lavg, LAVG_SIZE);
- if ( line->cl_until > 0 )
- Save_lint(fd, S_UNTIL_T, line->cl_until);
- if ( line->cl_nice != 0 )
- Save_strn(fd, S_NICE_T, &line->cl_nice, 1);
- if ( line->cl_runfreq > 0 ) {
- Save_lint(fd, S_RUNFREQ_T, line->cl_runfreq);
- Save_lint(fd, S_REMAIN_T, line->cl_remain);
- }
-
- if ( is_freq(line->cl_option) ) {
- /* save the frequency to run the line */
- Save_lint(fd, S_TIMEFREQ_T, line->cl_timefreq)
+ /* chown the file to root:root : this file should only be read and
+ * modified by fcron (not fcrontab) */
+ if (fchown(fd, ROOTUID, ROOTGID) != 0) {
+ error_e("Could not fchown \"%s\"", file->cf_user);
+ close(fd);
}
else {
- /* save the time and date bit fields */
- Save_strn(fd, S_MINS_T, line->cl_mins, bitstr_size(60));
- Save_strn(fd, S_HRS_T, line->cl_hrs, bitstr_size(24));
- Save_strn(fd, S_DAYS_T, line->cl_days, bitstr_size(32));
- Save_strn(fd, S_MONS_T, line->cl_mons, bitstr_size(12));
- Save_strn(fd, S_DOW_T, line->cl_dow, bitstr_size(8));
+ /* save file : */
+ if ( write_file_to_disk(fd, file, now) == ERR ) {
+ close(fd);
+ remove(file->cf_user);
+ }
+ else
+ close(fd);
}
-
- /* This field *must* be the last of each line */
- Save_type(fd, S_ENDLINE_T);
}
- close(fd);
-
if (arg_file != NULL)
/* we have to save only a single file */
break ;
-
- next_file:
}
}
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fileconf.c,v 1.65 2002-10-06 16:56:22 thib Exp $ */
+ /* $Id: fileconf.c,v 1.66 2002-10-28 17:53:31 thib Exp $ */
#include "fcrontab.h"
* and continue over an "\" followed by an "\n" char */
{
size_t size_max = size - 1 ;
- register int i=0;
+ int i=0;
int c;
while (i < size_max ) {
}
/* line is too long : goto next line and return ERR */
- while ( ((c = getc(file)) != EOF ) && (c != (int) '\n') )
+ while ( ( (c = getc(file)) != EOF ) && ( (char)c != '\n') )
;
line++;
need_correction = 1;
}
-/* save_file() error management */
-#define Save_type(FD, TYPE) \
- { \
- if ( save_type(FD, TYPE) != OK ) { \
- error_e("Could not write type : file has not been installed."); \
- close(FD); \
- remove(path); \
- return ERR; \
- } \
- }
-
-#define Save_str(FD, TYPE, STR) \
- { \
- if ( save_str(FD, TYPE, STR) != OK ) { \
- error_e("Could not write str : file has not been installed."); \
- close(FD); \
- remove(path); \
- return ERR; \
- } \
- }
-
-#define Save_strn(FD, TYPE, STR, SIZE) \
- { \
- if ( save_strn(FD, TYPE, STR, SIZE) != OK ) { \
- error_e("Could not write strn : file has not been installed."); \
- close(FD); \
- remove(path); \
- return ERR; \
- } \
- }
-
-#define Save_lint(FD, TYPE, VALUE) \
- { \
- if ( save_lint(FD, TYPE, VALUE) != OK ) { \
- error_e("Could not write lint : file has not been installed."); \
- close(FD); \
- remove(path); \
- return ERR; \
- } \
- }
-
int
save_file(char *path)
/* Store the informations relatives to the executions
* of tasks at a defined frequency of system's running time */
{
cf_t *file = NULL;
- cl_t *line = NULL;
int fd;
- env_t *env = NULL;
if (debug_opt)
fprintf(stderr, "Saving ...\n");
}
/* save file : */
-
- /* put program's version : it permit to daemon not to load
- * a file which he won't understand the syntax, for exemple
- * a file using a depreciated format generated by an old fcrontab,
- * if the syntax has changed */
- /* an binary fcrontab *must* start by such a header */
- Save_lint(fd, S_HEADER_T, S_FILEVERSION );
-
- /* put the user's name : needed to check if his uid has not changed */
- /* S_USER_T *must* be the 2nd field of a binary fcrontab */
- Save_str(fd, S_USER_T, user);
-
- /* put the time & date of saving : this is use for calcutating
- * the system down time. As it is a new file, we set it to 0 */
- /* S_USER_T *must* be the 3rd field of a binary fcrontab */
- Save_lint(fd, S_TIMEDATE_T, 0);
-
- /* Save the time diff between local (real) and system hour (if any) */
- if ( file->cf_tzdiff != 0 )
- Save_lint(fd, S_TZDIFF_T, file->cf_tzdiff);
-
- /* env variables, */
- for (env = file->cf_env_base; env; env = env->e_next)
- Save_str(fd, S_ENVVAR_T, env->e_val);
-
- /* then, lines. */
- for (line = file->cf_line_base; line; line = line->cl_next) {
-
- /* this ones are saved for every lines */
- Save_str(fd, S_SHELL_T, line->cl_shell);
- Save_str(fd, S_RUNAS_T, line->cl_runas);
- Save_str(fd, S_MAILTO_T, line->cl_mailto);
- Save_strn(fd, S_OPTION_T, line->cl_option, OPTION_SIZE);
-
- /* the following are saved only if needed */
- if ( line->cl_numexe )
- Save_strn(fd, S_NUMEXE_T, &line->cl_numexe, 1);
- if ( is_lavg(line->cl_option) )
- Save_strn(fd, S_LAVG_T, line->cl_lavg, LAVG_SIZE);
- if ( line->cl_until > 0 )
- Save_lint(fd, S_UNTIL_T, line->cl_until);
- if ( line->cl_nice != 0 )
- Save_strn(fd, S_NICE_T, &line->cl_nice, 1);
- if ( line->cl_runfreq > 0 ) {
- Save_lint(fd, S_RUNFREQ_T, line->cl_runfreq);
- Save_lint(fd, S_REMAIN_T, line->cl_remain);
- }
-
- if ( is_freq(line->cl_option) ) {
- /* save the frequency and the first wait time */
- Save_lint(fd, S_FIRST_T, line->cl_first);
- Save_lint(fd, S_TIMEFREQ_T, line->cl_timefreq);
- }
- else {
- /* save the time and date bit fields */
- Save_strn(fd, S_MINS_T, line->cl_mins, bitstr_size(60));
- Save_strn(fd, S_HRS_T, line->cl_hrs, bitstr_size(24));
- Save_strn(fd, S_DAYS_T, line->cl_days, bitstr_size(32));
- Save_strn(fd, S_MONS_T, line->cl_mons, bitstr_size(12));
- Save_strn(fd, S_DOW_T, line->cl_dow, bitstr_size(8));
- }
-
- /* This field *must* be the last of each line */
- {
- Save_type(fd, S_ENDLINE_T);
- }
+ if ( write_file_to_disk(fd, file, 0) == ERR ) {
+ close(fd);
+ remove(path);
+ return ERR;
}
close(fd);
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: global.h,v 1.38 2002-10-06 17:02:05 thib Exp $ */
+ /* $Id: global.h,v 1.39 2002-10-28 17:53:59 thib Exp $ */
/*
#include "pam.h"
#endif
-
#include "bitstring.h" /* bit arrays */
#include "option.h" /* manage fcrontab's options */
-/* constants for fcrontabs needed to load and save the fcrontabs to disk */
-#include "save.h"
-/* log part */
-#include "log.h"
-/* functions used by fcrontab, fcrondyn, and fcron */
-#include "subs.h"
-
/* you should not change this (nor need to do it) */
#define ERR -1
#define OK 0
die_e("Could not calloc.");
#define Set(VAR, VALUE) \
+ { \
free(VAR); \
- VAR = strdup2(VALUE);
+ VAR = strdup2(VALUE); \
+ }
#define Flush(VAR) \
+ { \
free(VAR); \
- VAR = NULL;
+ VAR = NULL; \
+ }
#define Skip_blanks(PTR) \
while((*(PTR) == ' ') || (*(PTR) == '\t')) \
pid_t e_job_pid; /* pid of the job itself */
} exe_t;
+
+/* local header files : we include here the headers which may use some types defined
+ * above. */
+
+/* constants for fcrontabs needed to load and save the fcrontabs to disk */
+#include "save.h"
+/* log part */
+#include "log.h"
+/* functions used by fcrontab, fcrondyn, and fcron */
+#include "subs.h"
+
+
#endif /* __GLOBAL_H__ */
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: save.c,v 1.2 2002-09-07 13:12:10 thib Exp $ */
+ /* $Id: save.c,v 1.3 2002-10-28 17:56:29 thib Exp $ */
#include "global.h"
#include "save.h"
extern char debug_opt;
+int write_buf_to_disk(int fd, char *write_buf, int *buf_used);
+int save_type(int fd, short int type, char *write_buf, int *buf_used);
+int save_str(int fd, short int type, char *str, char *write_buf, int *buf_used);
+int save_strn(int fd, short int type, char *str, short int size, char *write_buf,
+ int *buf_used);
+int save_lint(int fd, short int type, long int value, char *write_buf, int *buf_used);
+
int
-save_type(int fd, short int type)
+save_type(int fd, short int type, char *write_buf, int *buf_used)
/* save a single type (with no data attached) in a binary fcrontab file */
{
short int size = 0;
+ int write_len = sizeof(type) + sizeof(size);
- if ( write(fd, &type, sizeof(type)) < sizeof(type) ) goto err;
- if ( write(fd, &size, sizeof(size)) < sizeof(size) ) goto err;
-
- return OK;
+ if ( write_len > WRITE_BUF_LEN - *buf_used )
+ if ( write_buf_to_disk(fd, write_buf, buf_used) == ERR )
+ return ERR;
- err:
- return ERR;
+ memcpy((write_buf+*buf_used), &type, sizeof(type));
+ *buf_used += sizeof(type);
+ memcpy((write_buf+*buf_used), &size, sizeof(size));
+ *buf_used += sizeof(size);
+
+ return OK;
}
int
-save_str(int fd, short int type, char *str)
+save_str(int fd, short int type, char *str, char *write_buf, int *buf_used)
/* save a string of type "type" in a binary fcrontab file */
{
- short int size = 0;
- size = strlen(str);
+ short int size = strlen(str);
+ int write_len = sizeof(type) + sizeof(size) + size;
- if ( write(fd, &type, sizeof(type)) < sizeof(type) ) goto err;
- if ( write(fd, &size, sizeof(size)) < sizeof(size) ) goto err;
- if ( write(fd, str, size) < size ) goto err;
+ if ( write_len > WRITE_BUF_LEN - *buf_used )
+ if ( write_buf_to_disk(fd, write_buf, buf_used) == ERR )
+ return ERR;
- return OK;
+ memcpy((write_buf+*buf_used), &type, sizeof(type));
+ *buf_used += sizeof(type);
+ memcpy((write_buf+*buf_used), &size, sizeof(size));
+ *buf_used += sizeof(size);
+ memcpy((write_buf+*buf_used), str, size);
+ *buf_used += size;
- err:
- return ERR;
-
+ return OK;
}
int
-save_strn(int fd, short int type, char *str, short int size)
+save_strn(int fd, short int type, char *str, short int size, char *write_buf,
+ int *buf_used)
/* save a "size"-length string of type "type" in a binary fcrontab file */
{
+ int write_len = sizeof(type) + sizeof(size) + size;
- if ( write(fd, &type, sizeof(type)) < sizeof(type) ) goto err;
- if ( write(fd, &size, sizeof(size)) < sizeof(size) ) goto err;
- if ( write(fd, str, size) < size ) goto err;
+ if ( write_len > WRITE_BUF_LEN - *buf_used )
+ if ( write_buf_to_disk(fd, write_buf, buf_used) == ERR )
+ return ERR;
- return OK;
+ memcpy((write_buf+*buf_used), &type, sizeof(type));
+ *buf_used += sizeof(type);
+ memcpy((write_buf+*buf_used), &size, sizeof(size));
+ *buf_used += sizeof(size);
+ memcpy((write_buf+*buf_used), str, size);
+ *buf_used += size;
- err:
- return ERR;
-
+ return OK;
}
int
-save_lint(int fd, short int type, long int value)
+save_lint(int fd, short int type, long int value, char *write_buf, int *buf_used)
/* save an integer of type "type" in a binary fcrontab file */
{
short int size = sizeof(value);
+ int write_len = sizeof(type) + sizeof(size) + size;
+
+ if ( write_len > WRITE_BUF_LEN - *buf_used )
+ if ( write_buf_to_disk(fd, write_buf, buf_used) == ERR )
+ return ERR;
- if ( write(fd, &type, sizeof(type)) < sizeof(type) ) goto err;
- if ( write(fd, &size, sizeof(size)) < sizeof(size) ) goto err;
- if ( write(fd, &value, size) < size ) goto err;
+ memcpy((write_buf+*buf_used), &type, sizeof(type));
+ *buf_used += sizeof(type);
+ memcpy((write_buf+*buf_used), &size, sizeof(size));
+ *buf_used += sizeof(size);
+ memcpy((write_buf+*buf_used), &value, size);
+ *buf_used += size;
return OK;
+}
+
+
+int
+write_buf_to_disk(int fd, char *write_buf, int *buf_used)
+/* write the buffer to disk */
+{
+ ssize_t to_write = *buf_used;
+ ssize_t written = 0;
+ ssize_t return_val;
+ int num_retries = 0;
+
+ while ( written < to_write ) {
+ if ( num_retries++ > (int)(to_write / 2) ) {
+ error("too many retries (%d) to write buf to disk : giving up.",num_retries);
+ return ERR;
+ }
+ return_val = write(fd, (write_buf+written), to_write - written);
+ if ( return_val == -1 ) {
+ error_e("could not write() buf to disk");
+ return ERR;
+ }
+ written += return_val;
+ }
+
+ /* */
+ debug("write_buf_to_disk() : written %d/%d, %d retry(ies)", written, to_write,
+ num_retries);
+ /* */
+
+ if ( written == to_write ) {
+ *buf_used = 0;
+ return OK;
+ }
+ else {
+ error("write_buf_to_disk() : written %d bytes for %d requested.",
+ written, to_write);
+ return ERR;
+ }
+}
- err:
- return ERR;
-
+
+/* write_file_to_disk() error management */
+#define Save_type(FD, TYPE, BUF, BUF_USED) \
+ { \
+ if ( save_type(FD, TYPE, BUF, BUF_USED) != OK ) { \
+ error_e("Could not write type : file %s has not been saved.", \
+ file->cf_user); \
+ return ERR; \
+ } \
+ }
+
+#define Save_str(FD, TYPE, STR, BUF, BUF_USED) \
+ { \
+ if ( save_str(FD, TYPE, STR, BUF, BUF_USED) != OK ) { \
+ error_e("Could not write str : file %s has not been saved.", \
+ file->cf_user); \
+ return ERR; \
+ } \
+ }
+
+#define Save_strn(FD, TYPE, STR, SIZE, BUF, BUF_USED) \
+ { \
+ if ( save_strn(FD, TYPE, STR, SIZE, BUF, BUF_USED) != OK ) { \
+ error_e("Could not write strn : file %s has not been saved.", \
+ file->cf_user); \
+ return ERR; \
+ } \
+ }
+
+#define Save_lint(FD, TYPE, VALUE, BUF, BUF_USED) \
+ { \
+ if ( save_lint(FD, TYPE, VALUE, BUF, BUF_USED) != OK ) { \
+ error_e("Could not write lint : file %s has not been saved.", \
+ file->cf_user); \
+ return ERR; \
+ } \
+ }
+
+int
+write_file_to_disk(int fd, struct cf_t *file, time_t time_date)
+/* write the data on the disk */
+{
+ cl_t *line = NULL;
+ env_t *env = NULL;
+ char write_buf[WRITE_BUF_LEN];
+ int write_buf_used = 0;
+
+ /* put program's version : it permits to daemon not to load
+ * a file which he won't understand the syntax, for exemple
+ * a file using a depreciated format generated by an old fcrontab,
+ * if the syntax has changed */
+ /* an binary fcrontab *must* start by such a header */
+ Save_lint(fd, S_HEADER_T, S_FILEVERSION, write_buf, &write_buf_used);
+
+ /* put the user's name : needed to check if his uid has not changed */
+ /* S_USER_T *must* be the 2nd field of a binary fcrontab */
+ Save_str(fd, S_USER_T, file->cf_user, write_buf, &write_buf_used);
+
+ /* put the time & date of saving : this is use for calcutating
+ * the system down time. As it is a new file, we set it to 0 */
+ /* S_USER_T *must* be the 3rd field of a binary fcrontab */
+ Save_lint(fd, S_TIMEDATE_T, time_date, write_buf, &write_buf_used);
+
+ /* Save the time diff between local (real) and system hour (if any) */
+ if ( file->cf_tzdiff != 0 )
+ Save_lint(fd, S_TZDIFF_T, file->cf_tzdiff, write_buf, &write_buf_used);
+
+ /* env variables, */
+ for (env = file->cf_env_base; env; env = env->e_next)
+ Save_str(fd, S_ENVVAR_T, env->e_val, write_buf, &write_buf_used);
+
+ /* then, lines. */
+ for (line = file->cf_line_base; line; line = line->cl_next) {
+
+ /* this ones are saved for every lines */
+ Save_str(fd, S_SHELL_T, line->cl_shell, write_buf, &write_buf_used);
+ Save_str(fd, S_RUNAS_T, line->cl_runas, write_buf, &write_buf_used);
+ Save_str(fd, S_MAILTO_T, line->cl_mailto, write_buf, &write_buf_used);
+ Save_strn(fd, S_OPTION_T, line->cl_option, OPTION_SIZE,
+ write_buf, &write_buf_used);
+
+ /* the following are saved only if needed */
+ if ( is_volatile(line->cl_option) && is_freq(line->cl_option) ) {
+ Save_lint(fd, S_FIRST_T, line->cl_first, write_buf, &write_buf_used);
+ }
+ else
+ Save_lint(fd, S_NEXTEXE_T, line->cl_nextexe, write_buf, &write_buf_used);
+ if ( line->cl_numexe )
+ Save_strn(fd, S_NUMEXE_T, &line->cl_numexe, 1, write_buf, &write_buf_used);
+ if ( is_lavg(line->cl_option) )
+ Save_strn(fd, S_LAVG_T, line->cl_lavg, LAVG_SIZE,
+ write_buf, &write_buf_used);
+ if ( line->cl_until > 0 )
+ Save_lint(fd, S_UNTIL_T, line->cl_until, write_buf, &write_buf_used);
+ if ( line->cl_nice != 0 )
+ Save_strn(fd, S_NICE_T, &line->cl_nice, 1, write_buf, &write_buf_used);
+ if ( line->cl_runfreq > 0 ) {
+ Save_lint(fd, S_RUNFREQ_T, line->cl_runfreq, write_buf, &write_buf_used);
+ Save_lint(fd, S_REMAIN_T, line->cl_remain, write_buf, &write_buf_used);
+ }
+
+ if ( is_freq(line->cl_option) ) {
+ /* save the frequency to run the line */
+ Save_lint(fd, S_TIMEFREQ_T, line->cl_timefreq, write_buf, &write_buf_used);
+ }
+ else {
+ /* save the time and date bit fields */
+ Save_strn(fd, S_MINS_T, line->cl_mins, bitstr_size(60),
+ write_buf, &write_buf_used);
+ Save_strn(fd, S_HRS_T, line->cl_hrs, bitstr_size(24),
+ write_buf, &write_buf_used);
+ Save_strn(fd, S_DAYS_T, line->cl_days, bitstr_size(32),
+ write_buf, &write_buf_used);
+ Save_strn(fd, S_MONS_T, line->cl_mons, bitstr_size(12),
+ write_buf, &write_buf_used);
+ Save_strn(fd, S_DOW_T, line->cl_dow, bitstr_size(8),
+ write_buf, &write_buf_used);
+ }
+
+ /* This field *must* be the last of each line */
+ Save_type(fd, S_ENDLINE_T, write_buf, &write_buf_used);
+ }
+
+ if ( write_buf_to_disk(fd, write_buf, &write_buf_used) == ERR )
+ return ERR;
+
+ return OK;
}
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: save.h,v 1.6 2002-09-07 13:12:13 thib Exp $ */
+ /* $Id: save.h,v 1.7 2002-10-28 17:56:40 thib Exp $ */
#ifndef __SAVE_H__
#define __SAVE_H__
/* functions defined by save.c */
-extern int save_type(int fd, short int type);
-extern int save_str(int fd, short int type, char *str);
-extern int save_strn(int fd, short int type, char *str, short int size);
-extern int save_lint(int fd, short int type, long int value);
-
+extern int write_file_to_disk(int fd, struct cf_t *file, time_t time_date);
/* here is the format fcron(tab) uses to save the fcrontabs :
* type(short int)
* size(short int)
* data
- * unless for the options, which only have a type */
+ * unless for some special tags, which don't have data (size set to 0) */
/* kept for backward compatibility : we now have an extended