/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* empsched.c: Show the update schedule
- *
+ *
* Known contributors to this file:
* Markus Armbruster, 2007
*/
#include <config.h>
-#if defined(_WIN32)
-#include "../lib/gen/getopt.h"
-#else
#include <unistd.h>
-#endif
#include <stdio.h>
#include <time.h>
#include "optlist.h"
char *config_file = NULL;
char *in_file;
unsigned long n = DFLT_N;
- time_t sched[MAX_N + 1];
+ time_t sched[MAX_N + 1], anchor;
int opt, i;
while ((opt = getopt(argc, argv, "e:n:hv")) != EOF) {
printf("%s\n\n%s", version, legal);
exit(0);
default:
- print_usage(argv[0]);
+ fprintf(stderr, "Try -h for help.\n");
exit(1);
}
}
else
in_file = argv[optind];
- read_schedule(in_file, sched, n + 1, 0, 0/* FIXME */);
+ anchor = (time(NULL) + 59) / 60 * 60;
+ if (read_schedule(in_file, sched, n + 1, 0, anchor) < 0)
+ exit(1);
for (i = 0; sched[i]; i++)
printf("%s", ctime(&sched[i]));