]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/show.c
Update copyright notice
[empserver] / src / lib / subs / show.c
index c243baa4a03674359e3cad0d26f55ca1c60b526f..5ae01ca94dbc2d08442723bca0fc30ef86090c00 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -140,9 +140,8 @@ show_bridge(int tlev)
 {
     if (tlev < buil_bt)
        return;
-    pr("Bridges require %g tech,", buil_bt);
-    pr(" %d hcm,", buil_bh);
-    pr(" %d workers,\n", 0);
+    pr("Bridges require %g tech, %d hcm, 0 workers,\n",
+       buil_bt, buil_bh);
     pr("%d available workforce, and cost $%g\n",
        (SCT_BLD_WORK(0, buil_bh) * SCT_MINEFF + 99) / 100,
        buil_bc);
@@ -153,9 +152,8 @@ show_tower(int tlev)
 {
     if (tlev < buil_tower_bt)
        return;
-    pr("Bridge Towers require %g tech,", buil_tower_bt);
-    pr(" %d hcm,", buil_tower_bh);
-    pr(" %d workers,\n", 0);
+    pr("Bridge Towers require %g tech, %d hcm, 0 workers,\n",
+       buil_tower_bt, buil_tower_bh);
     pr("%d available workforce, and cost $%g\n",
        (SCT_BLD_WORK(0, buil_tower_bh) * SCT_MINEFF + 99) / 100,
        buil_tower_bc);
@@ -246,23 +244,17 @@ show_ship_stats(int tlev)
     int scount;
     int techdiff;
 
-    pr("%25s      s  v  s  r  f  l  p", "");
-    pr("  h");
-    pr("  x");
+    pr("%25s      s  v  s  r  f  l  p  h  x", "");
     if (opt_FUEL)
        pr("  fuel");
     pr("\n");
 
-    pr("%25s      p  i  p  n  i  n  l", "");
-    pr("  e");
-    pr("  p");
+    pr("%25s      p  i  p  n  i  n  l  e  p", "");
     if (opt_FUEL)
        pr("   c/u");
     pr("\n");
 
-    pr("%25s def  d  s  y  g  r  d  n", "");
-    pr("  l");
-    pr("  l");
+    pr("%25s def  d  s  y  g  r  d  n  l  l", "");
     if (opt_FUEL)
        pr("      ");
     pr("\n");
@@ -724,25 +716,25 @@ fmttime2822(time_t t)
     int nn;
     TIME_ZONE_INFORMATION tzi;
     long time_offset;
-    struct tm time;
+    struct tm *time;
     
-    localtime_s(&time, &t);
+    time = localtime(&t);
 
-    n = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S", &time);
+    n = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S", time);
     if (CANT_HAPPEN(n == 0)) {
        buf[0] = 0;
        return buf;
     }
     GetTimeZoneInformation(&tzi);
     time_offset = -(tzi.Bias +
-       (time.tm_isdst ? tzi.DaylightBias : tzi.StandardBias));
+       (time->tm_isdst ? tzi.DaylightBias : tzi.StandardBias));
 
-    nn = _snprintf_s(buf + n, sizeof(buf) - n, sizeof(buf) - n -1,
-       " %+03d%02d",   time_offset/60, abs(time_offset) % 60);
-    if (CANT_HAPPEN(nn <= 0))
+    nn = _snprintf(buf + n, sizeof(buf) - n, " %+03d%02d",
+       time_offset/60, abs(time_offset) % 60);
+    if (CANT_HAPPEN(nn <= 0 || nn + n >= sizeof(buf)))
        buf[0] = 0;
 #else
-    size_t int n = strftime(buf, sizeof(buf), "%a, %d %b %Y %T %z",
+    size_t n = strftime(buf, sizeof(buf), "%a, %d %b %Y %T %z",
                     localtime(&t));
     if (CANT_HAPPEN(n == 0))
        buf[0] = 0;