* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: config.h.in,v 1.60 2007-01-23 22:51:22 thib Exp $ */
+ /* $Id: config.h.in,v 1.61 2007-04-14 17:02:34 thib Exp $ */
/* *********************************************************** */
#define O_SYNC O_FSYNC
#endif
+/* These SIZEOF_* constants are defined by the AC_CHECK_SIZEOF macro */
+#undef SIZEOF_TIME_T
+#undef SIZEOF_PID_T
+#undef SIZEOF_SHORT_INT
+#undef SIZEOF_INT
+#undef SIZEOF_LONG_INT
+#undef SIZEOF_LONG_LONG_INT
+
+/* We need all these types in global.h to know which conversion string we whould
+ * use when reading a pid_t or a time_t */
+#ifndef SIZEOF_PID_T
+#error "sizeof pid_t unknown."
+#endif
+
+#ifndef SIZEOF_TIME_T
+#error "sizeof time_t unknown."
+#endif
+
+#ifndef SIZEOF_SHORT_INT
+#error "sizeof short int unknown."
+#endif
+
+#ifndef SIZEOF_INT
+#error "sizeof int unknown."
+#endif
+
+#ifndef SIZEOF_LONG_INT
+#error "sizeof long int unknown."
+#endif
+
+#ifndef SIZEOF_LONG_LONG_INT
+#error "sizeof long long int unknown."
+#endif
+
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: convert-fcrontab.c,v 1.21 2006-05-20 16:27:46 thib Exp $ */
+ /* $Id: convert-fcrontab.c,v 1.22 2007-04-14 17:03:00 thib Exp $ */
#include "convert-fcrontab.h"
-#include "global.h"
-char rcs_info[] = "$Id: convert-fcrontab.c,v 1.21 2006-05-20 16:27:46 thib Exp $";
+char rcs_info[] = "$Id: convert-fcrontab.c,v 1.22 2007-04-14 17:03:00 thib Exp $";
void info(void);
void usage(void);
if ((file->cf_user = read_str(f, buf, sizeof(buf))) == NULL)
die_e("Cannot read user's name");
- if ( fscanf(f, "%ld", (long int *) &t_save) != 1 )
+ if ( fscanf(f, "%" ATTR_SIZE_TIMET "d", CAST_TIMET_PTR &t_save) != 1 )
error("could not get time and date of saving");
/* read env variables */
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fcronsighup.c,v 1.11 2007-01-01 18:49:43 thib Exp $ */
+ /* $Id: fcronsighup.c,v 1.12 2007-04-14 16:59:02 thib Exp $ */
#include "fcronsighup.h"
#include "global.h"
#include "allow.h"
-char rcs_info[] = "$Id: fcronsighup.c,v 1.11 2007-01-01 18:49:43 thib Exp $";
+char rcs_info[] = "$Id: fcronsighup.c,v 1.12 2007-04-14 16:59:02 thib Exp $";
void usage(void);
void sig_daemon(void);
pid_t pid = 0;
if ((fp = fopen(pidfile, "r")) != NULL) {
- if ( fscanf(fp, "%d", (int *) &pid) < 1 )
+ if ( fscanf(fp, "%" ATTR_SIZE_PIDT "d", CAST_PIDT_PTR &pid) < 1 )
error("Unable to read fcron daemon's pid (fscanf(fp,...))");
fclose(fp);
}
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: global.h,v 1.47 2007-01-23 22:49:03 thib Exp $ */
+ /* $Id: global.h,v 1.48 2007-04-14 17:02:20 thib Exp $ */
/*
} exe_t;
+#if SIZEOF_TIME_T == SIZEOF_SHORT_INT
+#define ATTR_SIZE_TIMET "h"
+#define CAST_TIMET_PTR (short int *)
+#elif SIZEOF_TIME_T == SIZEOF_INT
+#define ATTR_SIZE_TIMET ""
+#define CAST_TIMET_PTR (int *)
+#elif SIZEOF_TIME_T == SIZEOF_LONG_INT
+#define ATTR_SIZE_TIMET "l"
+#define CAST_TIMET_PTR (long int *)
+#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG_INT
+#define ATTR_SIZE_TIMET "ll"
+#define CAST_TIMET_PTR (long long int *)
+#else
+#error "SIZEOF_TIME_T does not correspond with a known format."
+#endif
+
+#if SIZEOF_PID_T == SIZEOF_SHORT_INT
+#define ATTR_SIZE_PIDT "h"
+#define CAST_PIDT_PTR (short int *)
+#elif SIZEOF_PID_T == SIZEOF_INT
+#define ATTR_SIZE_PIDT ""
+#define CAST_PIDT_PTR (int *)
+#elif SIZEOF_PID_T == SIZEOF_LONG_INT
+#define ATTR_SIZE_PIDT "l"
+#define CAST_PIDT_PTR (long int *)
+#elif SIZEOF_PID_T == SIZEOF_LONG_LONG_INT
+#define ATTR_SIZE_PIDT "ll"
+#define CAST_PIDT_PTR (long long int *)
+#else
+#error "SIZEOF_PID_T does not correspond with a known format."
+#endif
+
+
/* local header files : we include here the headers which may use some types defined
* above. */