diff -ruP oldsad-snapshot-2011-04-07.orig/files/libtai/patch-check.c oldsad-snapshot-2011-04-07/files/libtai/patch-check.c
--- oldsad-snapshot-2011-04-07.orig/files/libtai/patch-check.c	1970-01-01 09:00:00.000000000 +0900
+++ oldsad-snapshot-2011-04-07/files/libtai/patch-check.c	2011-04-07 16:24:44.130647703 +0900
@@ -0,0 +1,18 @@
+--- check.c.orig	1998-10-14 01:52:20.000000000 +0900
++++ check.c	2011-04-07 15:27:02.319458427 +0900
+@@ -11,7 +11,7 @@
+ char out[101];
+ char x[TAI_PACK];
+ 
+-main()
++int main()
+ {
+   struct tai t;
+   struct tai t2;
+@@ -46,5 +46,5 @@
+       }
+       printf("\n");
+     }
+-  exit(0);
++  return 0;
+ }
diff -ruP oldsad-snapshot-2011-04-07.orig/files/libtai/patch-easter.c oldsad-snapshot-2011-04-07/files/libtai/patch-easter.c
--- oldsad-snapshot-2011-04-07.orig/files/libtai/patch-easter.c	1970-01-01 09:00:00.000000000 +0900
+++ oldsad-snapshot-2011-04-07/files/libtai/patch-easter.c	2011-04-07 16:25:00.646462328 +0900
@@ -0,0 +1,27 @@
+--- easter.c.orig	1998-10-14 01:52:20.000000000 +0900
++++ easter.c	2011-04-07 15:28:02.181642074 +0900
+@@ -1,11 +1,12 @@
+ #include <stdio.h>
++#include <stdlib.h>
+ #include "caldate.h"
+ 
+ char *dayname[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" } ;
+ 
+ char out[101];
+ 
+-main(argc,argv)
++int main(argc,argv)
+ int argc;
+ char **argv;
+ {
+@@ -23,8 +24,8 @@
+       caldate_frommjd(&cd,day,&weekday,&yearday);
+       if (caldate_fmt((char *) 0,&cd) + 1 >= sizeof out) exit(1);
+       out[caldate_fmt(out,&cd)] = 0;
+-      printf("%s %s  yearday %d  mjd %d\n",dayname[weekday],out,yearday,day);
++      printf("%s %s  yearday %d  mjd %ld\n",dayname[weekday],out,yearday,day);
+     }
+   }
+-  exit(0);
++  return 0;
+ }
diff -ruP oldsad-snapshot-2011-04-07.orig/files/libtai/patch-leapsecs.c oldsad-snapshot-2011-04-07/files/libtai/patch-leapsecs.c
--- oldsad-snapshot-2011-04-07.orig/files/libtai/patch-leapsecs.c	1970-01-01 09:00:00.000000000 +0900
+++ oldsad-snapshot-2011-04-07/files/libtai/patch-leapsecs.c	2011-04-07 16:26:21.976897483 +0900
@@ -0,0 +1,18 @@
+--- leapsecs.c.orig	1998-10-14 01:52:20.000000000 +0900
++++ leapsecs.c	2011-04-07 15:25:30.509191308 +0900
+@@ -9,7 +9,7 @@
+ 
+ char line[100];
+ 
+-main()
++int main(void)
+ {
+   struct caldate cd;
+   struct tai t;
+@@ -24,5 +24,5 @@
+ 	fwrite(x,TAI_PACK,1,stdout);
+       }
+       
+-  exit(0);
++  return 0;
+ }
diff -ruP oldsad-snapshot-2011-04-07.orig/files/libtai/patch-leapsecs_read.c oldsad-snapshot-2011-04-07/files/libtai/patch-leapsecs_read.c
--- oldsad-snapshot-2011-04-07.orig/files/libtai/patch-leapsecs_read.c	2007-12-11 21:03:46.000000000 +0900
+++ oldsad-snapshot-2011-04-07/files/libtai/patch-leapsecs_read.c	2011-04-07 16:27:12.921386040 +0900
@@ -1,6 +1,16 @@
---- leapsecs_read.c.orig	Fri Jun 16 22:44:31 2000
-+++ leapsecs_read.c	Fri Jun 16 22:45:17 2000
-@@ -18,7 +18,7 @@
+--- leapsecs_read.c.orig	2011-04-07 16:23:10.950431620 +0900
++++ leapsecs_read.c	2011-04-07 15:35:10.708419552 +0900
+@@ -2,7 +2,8 @@
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <errno.h>
+-extern int errno;
++#include <stdlib.h>
++#include <unistd.h>
+ #include "tai.h"
+ #include "leapsecs.h"
+ 
+@@ -18,7 +19,7 @@
    int i;
    struct tai u;
  
diff -ruP oldsad-snapshot-2011-04-07.orig/files/libtai/patch-nowutc.c oldsad-snapshot-2011-04-07/files/libtai/patch-nowutc.c
--- oldsad-snapshot-2011-04-07.orig/files/libtai/patch-nowutc.c	1970-01-01 09:00:00.000000000 +0900
+++ oldsad-snapshot-2011-04-07/files/libtai/patch-nowutc.c	2011-04-07 16:27:38.015501673 +0900
@@ -0,0 +1,32 @@
+--- nowutc.c.orig	2011-04-07 16:24:00.316433907 +0900
++++ nowutc.c	2011-04-07 15:31:32.811624883 +0900
+@@ -10,11 +10,11 @@
+ 
+ char x[TAIA_FMTFRAC];
+ 
+-main()
++int main()
+ {
+   if (leapsecs_init() == -1) {
+     fprintf(stderr,"utcnow: fatal: unable to init leapsecs\n");
+-    exit(111);
++    return 111;
+   }
+     
+   taia_now(&now);
+@@ -23,7 +23,7 @@
+   taia_tai(&now,&sec);
+   caltime_utc(&ct,&sec,(int *) 0,(int *) 0);
+ 
+-  printf("%d-%02d-%02d %02d:%02d:%02d.%s\n"
++  printf("%ld-%02d-%02d %02d:%02d:%02d.%s\n"
+     ,ct.date.year
+     ,ct.date.month
+     ,ct.date.day
+@@ -33,5 +33,5 @@
+     ,x
+     );
+ 
+-  exit(0);
++  return 0;
+ }
diff -ruP oldsad-snapshot-2011-04-07.orig/files/libtai/patch-yearcal.c oldsad-snapshot-2011-04-07/files/libtai/patch-yearcal.c
--- oldsad-snapshot-2011-04-07.orig/files/libtai/patch-yearcal.c	1970-01-01 09:00:00.000000000 +0900
+++ oldsad-snapshot-2011-04-07/files/libtai/patch-yearcal.c	2011-04-07 16:28:05.048445663 +0900
@@ -0,0 +1,24 @@
+--- yearcal.c.orig	1998-10-14 01:52:20.000000000 +0900
++++ yearcal.c	2011-04-07 15:28:43.551156183 +0900
+@@ -1,4 +1,5 @@
+ #include <stdio.h>
++#include <stdlib.h>
+ #include "caldate.h"
+ 
+ char *montab[] = {
+@@ -16,7 +17,7 @@
+ , "December"
+ } ;
+ 
+-void main(argc,argv)
++int main(argc,argv)
+ int argc;
+ char **argv;
+ {
+@@ -63,5 +64,5 @@
+     printf("\n");
+   }
+ 
+-  exit(0);
++  return 0;
+ }
diff -ruP oldsad-snapshot-2011-04-07.orig/files/libtai/set-0.60 oldsad-snapshot-2011-04-07/files/libtai/set-0.60
--- oldsad-snapshot-2011-04-07.orig/files/libtai/set-0.60	2008-04-03 21:20:44.000000000 +0900
+++ oldsad-snapshot-2011-04-07/files/libtai/set-0.60	2011-04-07 16:28:10.960204324 +0900
@@ -3,10 +3,16 @@
 patch-caltime.h
 patch-leapsecs.3
 patch-leapsecs.h
-patch-leapsecs_read.c
 patch-tai.h
 patch-tai_now.c
 patch-taia.h
 patch-taia_now.3
 patch-taia_now.c
 patch-tryclock_gettime.c
+patch-check.c
+patch-easter.c
+patch-leapsecs.c
+patch-leapsecs_read.c
+patch-nowutc.c
+patch-yearcal.c
+
diff -ruP oldsad-snapshot-2011-04-07.orig/src/sim/sad_signal.h oldsad-snapshot-2011-04-07/src/sim/sad_signal.h
--- oldsad-snapshot-2011-04-07.orig/src/sim/sad_signal.h	2009-10-03 12:46:55.000000000 +0900
+++ oldsad-snapshot-2011-04-07/src/sim/sad_signal.h	2011-04-07 15:56:48.970014917 +0900
@@ -4,7 +4,9 @@
 #include <sim/sad_f2c.h>
 #ifdef CYGWIN
 #else
+#ifndef _XOPEN_SOURCE
 #define _XOPEN_SOURCE 1
+#endif
 #include <ucontext.h>
 #endif
 
