Masanobu Yasui authored on 2009/01/13 21:44:08
Showing 6 changed files
... ...
@@ -1,5 +1,6 @@
1 1
 1.1.3:
2 2
  - sort msync --members by hostname
3
+ - fix: msync failed for FreeBSD and MacOSX
3 4
 
4 5
 1.1.2:
5 6
  - fix: not send shutdown message 
... ...
@@ -53,6 +53,9 @@
53 53
 /* Define to 1 if you have the `gethostname' function. */
54 54
 #undef HAVE_GETHOSTNAME
55 55
 
56
+/* getopt has optreset support */
57
+#undef HAVE_GETOPT_OPTRESET
58
+
56 59
 /* Define to 1 if you have the `gettimeofday' function. */
57 60
 #undef HAVE_GETTIMEOFDAY
58 61
 
... ...
@@ -8592,7 +8592,66 @@ _ACEOF
8592 8592
 fi
8593 8593
 done
8594 8594
 
8595
+{ echo "$as_me:$LINENO: checking whether getopt has optreset support" >&5
8596
+echo $ECHO_N "checking whether getopt has optreset support... $ECHO_C" >&6; }
8597
+if test "${ac_cv_have_getopt_optreset+set}" = set; then
8598
+  echo $ECHO_N "(cached) $ECHO_C" >&6
8599
+else
8595 8600
 
8601
+	cat >conftest.$ac_ext <<_ACEOF
8602
+/* confdefs.h.  */
8603
+_ACEOF
8604
+cat confdefs.h >>conftest.$ac_ext
8605
+cat >>conftest.$ac_ext <<_ACEOF
8606
+/* end confdefs.h.  */
8607
+#include <unistd.h>
8608
+int
8609
+main ()
8610
+{
8611
+extern int optreset; optreset = 0;
8612
+  ;
8613
+  return 0;
8614
+}
8615
+_ACEOF
8616
+rm -f conftest.$ac_objext conftest$ac_exeext
8617
+if { (ac_try="$ac_link"
8618
+case "(($ac_try" in
8619
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8620
+  *) ac_try_echo=$ac_try;;
8621
+esac
8622
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
8623
+  (eval "$ac_link") 2>conftest.er1
8624
+  ac_status=$?
8625
+  grep -v '^ *+' conftest.er1 >conftest.err
8626
+  rm -f conftest.er1
8627
+  cat conftest.err >&5
8628
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
8629
+  (exit $ac_status); } && {
8630
+	 test -z "$ac_c_werror_flag" ||
8631
+	 test ! -s conftest.err
8632
+       } && test -s conftest$ac_exeext &&
8633
+       $as_test_x conftest$ac_exeext; then
8634
+   ac_cv_have_getopt_optreset="yes"
8635
+else
8636
+  echo "$as_me: failed program was:" >&5
8637
+sed 's/^/| /' conftest.$ac_ext >&5
8638
+
8639
+	 ac_cv_have_getopt_optreset="no"
8640
+fi
8641
+
8642
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8643
+      conftest$ac_exeext conftest.$ac_ext
8644
+
8645
+fi
8646
+{ echo "$as_me:$LINENO: result: $ac_cv_have_getopt_optreset" >&5
8647
+echo "${ECHO_T}$ac_cv_have_getopt_optreset" >&6; }
8648
+if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
8649
+
8650
+cat >>confdefs.h <<\_ACEOF
8651
+#define HAVE_GETOPT_OPTRESET 1
8652
+_ACEOF
8653
+
8654
+fi
8596 8655
 ac_config_files="$ac_config_files Makefile"
8597 8656
 
8598 8657
 cat >confcache <<\_ACEOF
... ...
@@ -1,6 +1,3 @@
1
-#                                               -*- Autoconf -*-
2
-# Process this file with autoconf to produce a configure script.
3
-AC_PREREQ(2.61)
4 1
 AC_INIT(makuosan, 1.1.3, info-makuosan@klab.jp)
5 2
 AM_INIT_AUTOMAKE
6 3
 AC_CONFIG_SRCDIR([makuosan.c])
... ...
@@ -50,7 +47,12 @@ AC_FUNC_SELECT_ARGTYPES
50 50
 AC_FUNC_UTIME_NULL
51 51
 AC_FUNC_VPRINTF
52 52
 AC_CHECK_FUNCS([ftime getcwd gethostname gettimeofday inet_ntoa memmove memset mkdir realpath rmdir select setenv socket tzset utime])
53
-
53
+AC_CACHE_CHECK([whether getopt has optreset support], ac_cv_have_getopt_optreset,[
54
+	AC_TRY_LINK([#include <unistd.h>], extern int optreset; optreset = 0;, [ ac_cv_have_getopt_optreset="yes" ], [ ac_cv_have_getopt_optreset="no" ])
55
+])
56
+if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
57
+	AC_DEFINE(HAVE_GETOPT_OPTRESET, 1, [getopt has optreset support])
58
+fi
54 59
 AC_CONFIG_FILES([Makefile])
55 60
 AC_OUTPUT
56 61
 
... ...
@@ -273,6 +273,7 @@ extern char *optarg;
273 273
 extern int optind;
274 274
 extern int opterr;
275 275
 extern int optopt;
276
+extern int optreset;
276 277
 extern int loop_flag;
277 278
 extern char *tzname[2];
278 279
 extern int daylight;
... ...
@@ -314,10 +314,16 @@ int mexec_send(mcomm *c, int n, int sync)
314 314
     cprintf(0, c, "error: this server can't send\n");
315 315
     return(0);
316 316
   }
317
-  for(i=0;i<c->argc[n];i++)
317
+  for(i=0;i<c->argc[n];i++){
318 318
     argv[i] = c->parse[n][i];
319
+  }
319 320
   argv[i] = NULL;
321
+#ifdef HAVE_GETOPT_OPTRESET
322
+  optind   = 1;
323
+  optreset = 1;
324
+#else
320 325
   optind = 0;
326
+#endif;
321 327
   while((i=getopt(c->argc[n], argv, "g:t:nr")) != -1){
322 328
     switch(i){
323 329
       case 'n':