ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/main.C
(Generate patch)

Comparing deliantra/server/server/main.C (file contents):
Revision 1.114 by root, Wed Sep 5 05:48:36 2007 UTC vs.
Revision 1.115 by root, Sat Sep 8 09:15:50 2007 UTC

393 cfperl_cleanup (make_core); 393 cfperl_cleanup (make_core);
394 _exit (1); 394 _exit (1);
395 } 395 }
396 else 396 else
397 { 397 {
398 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_GREEN, 0, 0, "Maps and players successfully saved, exiting."); 398 new_draw_info_format (NDI_REPLY | NDI_UNIQUE | NDI_ALL | NDI_GREEN, 0, 0, "Maps and players successfully saved, exiting.");
399 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_GREEN, 0, 0, "And again: " CLEANUP_MESSAGE); 399 new_draw_info_format (NDI_REPLY | NDI_UNIQUE | NDI_ALL | NDI_GREEN, 0, 0, "And again: " CLEANUP_MESSAGE);
400 client::flush_sockets (); 400 client::flush_sockets ();
401 cfperl_cleanup (make_core); 401 cfperl_cleanup (make_core);
402 _exit (0); 402 _exit (0);
403 } 403 }
404}
405
406int
407forbid_play (void)
408{
409#if !defined(_IBMR2) && !defined(___IBMR2) && defined(PERM_FILE)
410 char buf[MAX_BUF], day[MAX_BUF];
411 FILE *fp;
412 time_t clock;
413 struct tm *tm;
414 int i, start, stop, forbit = 0, comp;
415
416 clock = time (NULL);
417 tm = (struct tm *) localtime (&clock);
418
419 sprintf (buf, "%s/%s", settings.confdir, PERM_FILE);
420 if ((fp = open_and_uncompress (buf, 0, &comp)) == NULL)
421 return 0;
422
423 while (fgets (buf, MAX_BUF, fp))
424 {
425 if (buf[0] == '#')
426 continue;
427
428 if (!strncmp (buf, "msg", 3))
429 {
430 if (forbit)
431 while (fgets (buf, MAX_BUF, fp)) /* print message */
432 fputs (buf, logfile);
433 break;
434 }
435 else if (sscanf (buf, "%s %d%*c%d\n", day, &start, &stop) != 3)
436 {
437 LOG (llevDebug, "Warning: Incomplete line in permission file ignored.\n");
438 continue;
439 }
440
441 for (i = 0; i < 7; i++)
442 {
443 if (!strncmp (buf, days[i], 3) && (tm->tm_wday == i) && (tm->tm_hour >= start) && (tm->tm_hour < stop))
444 forbit = 1;
445 }
446 }
447
448 close_and_delete (fp, comp);
449
450 return forbit;
451#else
452 return 0;
453#endif
454} 404}
455 405
456/* 406/*
457 * do_specials() is a collection of functions to call from time to time. 407 * do_specials() is a collection of functions to call from time to time.
458 * Modified 2000-1-14 MSW to use the global pticks count to determine how 408 * Modified 2000-1-14 MSW to use the global pticks count to determine how

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines