示例#1
0
文件: upda.c 项目: gefla/empserver
/*
 * Tell what the update policy is, and when the next update
 * is likely to be.
 */
int
upda(void)
{
    time_t now, next, stop;

    if (updates_disabled())
	pr("UPDATES ARE DISABLED!\n");

    (void)time(&now);
    next = update_time[0];
    if (next) {
	pr("\nUpdates occur at times specified by the ETU rates.\n\n");
	pr("The next update is at %19.19s.\n", ctime(&next));
    } else {
	pr("There are no regularly scheduled updates.\n");
    }
    pr("The current time is   %19.19s.\n\n", ctime(&now));

    if (next && update_window) {
	pr("The next update window starts at %19.19s.\n", ctime(&next));
	stop = next + update_window;
	pr("The next update window stops at %19.19s.\n", ctime(&stop));
    }

    switch (update_demand) {
    case UPD_DEMAND_NONE:
    default:
	break;
    case UPD_DEMAND_SCHED:
	pr("Demand updates occur at update CHECK times.\n");
	if (next) {
	    pr("The next update check is at %19.19s.\n", ctime(&next));
	}
	pr("Demand updates require %d country(s) to want one.\n",
	   update_wantmin);
	break;
    case UPD_DEMAND_ASYNC:
	pr("Demand updates occur right after the demand is set.\n");
	if (*update_demandtimes != 0) {
	    pr("Demand updates are allowed during: %s\n",
	       update_demandtimes);
	}
	pr("Demand updates require %d country(s) to want one.\n",
	   update_wantmin);
    }

    if (*game_days != 0)
	pr("Game days are: %s\n", game_days);
    if (*game_hours != 0)
	pr("Game hours are: %s\n", game_hours);

    pr("\nThis command is obsolete and will go away in a future version.\n"
       "Please use \"show updates\".\n");
    return 0;
}
示例#2
0
文件: forc.c 项目: gefla/empserver
int
force(void)
{
    if (shutdown_pending) {
	pr("Shutdown is pending\n");
	return RET_FAIL;
    }
    if (updates_disabled()) {
	pr("Updates are disabled\n");
	return RET_FAIL;
    }
    if (update_trigger() < 0)
	return RET_FAIL;
    return RET_OK;
}
示例#3
0
文件: shut.c 项目: fstltna/empserver
int
shut(void)
{
    int shutdown_minutes;
    int shutdown_was_pending;
    char buf[1024];
    char *p;

    shutdown_minutes =
	onearg(player->argp[1],
	       "Time until shutdown in minutes (-1 to abort shutdown sequence)? ");
    if (player->aborted)
	return RET_SYN;
    if (!updates_disabled()) {
	p = getstarg(player->argp[2], "Disable update [y]? ", buf);
	if (!p)
	    return RET_SYN;
	if (*p != 'n')
	    disa();
    }

    shutdown_was_pending = shutdown_initiate(shutdown_minutes);
    if (shutdown_was_pending < 0)
	return RET_FAIL;

    if (shutdown_minutes >= 0) {
	if (shutdown_was_pending)
	    pr("The shutdown time has been changed to %d minutes!\n",
	       shutdown_minutes);
	else
	    pr("Shutdown sequence begun.\n");
    } else {
	if (shutdown_was_pending)
	    pr("The server shutdown has been cancelled!\n");
	else {
	    pr("No shutdown to abort\n");
	    return RET_FAIL;
	}
    }
    return RET_OK;
}