Răsfoiți Sursa

* Ported [2653] to 1.2.9 (more buildts fixes)

svn: 2654
Bryan Drewery 20 ani în urmă
părinte
comite
666ae68a71
3 a modificat fișierele cu 13 adăugiri și 4 ștergeri
  1. 2 1
      build
  2. 4 2
      misc/getts.sh
  3. 7 1
      misc/ts.c

+ 2 - 1
build

@@ -17,7 +17,8 @@ fi
 
 ver="?.?.?"
 ver=`grep "char" src/main.c | $AWK '/egg_version/ {print $5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
-gcc -O2 -o ts misc/ts.c
+rm -f ts ts.exe
+gcc -o ts misc/ts.c
 BUILDTS=`./ts \`misc/getdate.sh\``
 builddate=`./ts ${BUILDTS}`
 rm -f ts ts.exe

+ 4 - 2
misc/getts.sh

@@ -1,5 +1,7 @@
 #! /bin/sh
 
-gcc -O2 -o ts misc/ts.c
-./ts `misc/getdate.sh`
+rm -f ts ts.exe
+gcc -o ts misc/ts.c
+date=$(misc/getdate.sh)
+./ts $date
 rm -f ts ts.exe

+ 7 - 1
misc/ts.c

@@ -11,12 +11,18 @@ int main(int argc, char *argv[])
     const char *Format = "%Y-%m-%d %H:%M:%S";
     struct tm ts;
     size_t siz = strlen(argv[1]) + strlen(argv[2]) + 1 + 1;
+    time_t tim = 0;
 
     Time = calloc(1, siz);
+#ifdef __openbsd__
     snprintf(Time, siz, "%s %s", argv[1], argv[2]);
+#else
+    sprintf(Time, "%s %s", argv[1], argv[2]);
+#endif
     strptime(Time, Format, &ts);
     free(Time);
-    printf("%ld\n", mktime(&ts));
+    tim = mktime(&ts);
+    printf("%ld\n", tim);
   } else if (argc == 2) { //18734563281
     const time_t tm = atol(argv[1]);
     char s[11] = "";