1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
|
Fix autoconf errors
--- a/Makefile.in
+++ b/Makefile.in
@@ -49,7 +49,7 @@
rm -rf *.o daemonize testdaemon *.ps
distclean: clean
- rm -rf config.status config.log config.cache config.h Makefile autom?te.cache
+ rm -rf config.status config.log config.cache auto_config.h Makefile autom?te.cache
# Copy stuff to the gh-pages directory. I doubt you want to use this target,
# unless you're maintaining the web site (i.e., unless you're me).
--- /dev/null
+++ b/config.h
@@ -0,0 +1,103 @@
+/*---------------------------------------------------------------------------*\
+ Site-specific configuration file for run-as utility
+
+ Input to `autoheader'
+
+ This source code is released under a BSD-style license. See the LICENSE
+ file for details.
+\*---------------------------------------------------------------------------*/
+
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+
+#include <auto_config.h>
+#include <sys/types.h>
+
+#ifndef HAVE_BYTE_TYPE
+typedef unsigned char byte; /* 8 bit unsigned critter */
+#endif /* HAVE_BYTE_TYPE */
+
+#ifndef HAVE_SIG_T
+typedef void __sighandler_t (int);
+typedef __sighandler_t *sig_t;
+#endif /* HAVE_SIG_T */
+
+#ifndef HAVE_FALSE
+#define FALSE (0)
+#endif /* FALSE */
+
+#ifndef HAVE_TRUE
+#define TRUE (1)
+#endif /* TRUE */
+
+#ifndef HAVE_SETSID
+#define setsid() ((pid_t) -1)
+#endif /* HAVE_SETSID */
+
+#ifndef HAVE_SYSCONF
+#define sysconf(name) ((long) -1)
+#endif /* HAVE_SYSCONF */
+
+#ifndef HAVE_STRERROR
+extern char *strerror (int errnum);
+#endif /* HAVE_STRERROR */
+
+extern int x_getopt (int argc, char **argv, const char *opts);
+extern int x_opterr;
+extern int x_optind;
+extern int x_optopt;
+extern char *x_optarg;
+
+#ifndef HAVE_DAEMON
+extern int daemon (int nochdir, int noclose);
+#endif
+
+#ifdef HAVE_VFORK
+#ifdef HAVE_VFORK_H
+#include <vfork.h>
+#endif
+#else /* HAVE_VFORK */
+#undef vfork
+#define vfork fork
+#endif /* HAVE_VFORK */
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#else
+extern int errno;
+#endif
+
+#ifndef STDC_HEADERS
+#error "Must have standard C headers. Sorry."
+#endif
+
+/*
+ Password field: If only one of `pw_comment' and `pw_gecos' is present,
+ define the missing one in terms of the existing one. If neither is
+ present, define both in terms of `pw_name'.
+*/
+#if !defined(HAVE_PW_COMMENT) && !defined(HAVE_PW_GECOS)
+#define pw_comment pw_name
+#define pw_gecos pw_name
+#else
+#if defined(HAVE_PW_COMMENT) && !defined(HAVE_PW_GECOS)
+#define pw_gecos pw_comment
+#else
+#if defined(HAVE_PW_GECOS) && !defined(HAVE_PW_COMMENT)
+#define pw_comment pw_gecos
+#endif
+#endif
+#endif
+
+#include <sys/types.h>
+#if HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+#endif /* _CONFIG_H_ */
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,287 @@
+dnl Copyright (c) 2003-2009 Brian M. Clapper.
+dnl All rights reserved.
+dnl
+dnl Redistribution and use in source and binary forms, with or without
+dnl modification, are permitted provided that the following conditions are met:
+dnl
+dnl * Redistributions of source code must retain the above copyright
+dnl notice, this list of conditions and the following disclaimer.
+dnl
+dnl * Redistributions in binary form must reproduce the above copyright
+dnl notice, this list of conditions and the following disclaimer in the
+dnl documentation and/or other materials provided with the distribution.
+dnl
+dnl * Neither the name of the clapper.org nor the names of its
+dnl contributors may be used to endorse or promote products derived from
+dnl this software without specific prior written permission.
+dnl
+dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+dnl ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+dnl LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+dnl CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+dnl POSSIBILITY OF SUCH DAMAGE.
+dnl ---------------------------------------------------------------------------
+
+
+dnl ---------------------------------------------------------------------------
+dnl Autoconf file for daemonize
+dnl
+dnl Process this file with autoconf to produce a configure script.
+dnl ---------------------------------------------------------------------------
+
+AC_INIT(daemonize.c)
+AC_CONFIG_HEADER(auto_config.h)
+
+dnl ---------------------------------------------------------------------------
+dnl Autoconf template
+dnl ---------------------------------------------------------------------------
+
+AH_TEMPLATE([HAVE_BASENAME])
+AH_TEMPLATE([HAVE_FLOCK])
+AH_TEMPLATE([HAVE_GETPGRP])
+AH_TEMPLATE([HAVE_INITGROUPS])
+AH_TEMPLATE([HAVE_PW_COMMENT])
+AH_TEMPLATE([HAVE_PW_GECOS])
+AH_TEMPLATE([HAVE_SETENV])
+AH_TEMPLATE([HAVE_SETPGRP])
+AH_TEMPLATE([bool])
+AH_TEMPLATE([HAVE_DAEMON])
+AH_TEMPLATE([HAVE_FALSE])
+AH_TEMPLATE([HAVE_SETSID])
+AH_TEMPLATE([HAVE_SIG_T])
+AH_TEMPLATE([HAVE_STRERROR])
+AH_TEMPLATE([HAVE_TRUE])
+
+dnl ---------------------------------------------------------------------------
+dnl Directories and package-specific vars
+dnl ---------------------------------------------------------------------------
+
+LOCAL_TOP_LEVEL=`pwd`
+
+dnl ---------------------------------------------------------------------------
+dnl Compiler- and language-specific programs. Must precede the UNIX tests.
+dnl ---------------------------------------------------------------------------
+
+AC_PROG_CC
+AC_PROG_CPP
+
+AC_SUBST(CC)
+AC_SUBST(CPP)
+
+dnl ---------------------------------------------------------------------------
+dnl UNIX variant hacks
+dnl ---------------------------------------------------------------------------
+
+AC_AIX
+
+dnl ---------------------------------------------------------------------------
+dnl Checks for programs via standard macros.
+dnl ---------------------------------------------------------------------------
+
+AC_PROG_INSTALL
+
+dnl ---------------------------------------------------------------------------
+dnl Checks for header files.
+dnl ---------------------------------------------------------------------------
+
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(errno.h)
+AC_CHECK_HEADERS(libgen.h)
+
+export CPPFLAGS
+
+dnl ---------------------------------------------------------------------------
+dnl Checks for libraries.
+dnl ---------------------------------------------------------------------------
+
+dnl ---------------------------------------------------------------------------
+dnl Checks for typedefs, structures, and compiler characteristics.
+dnl ---------------------------------------------------------------------------
+
+AC_C_CONST
+
+AC_TYPE_UID_T
+AC_TYPE_MODE_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+
+AC_CHECK_TYPE(ssize_t, int)
+
+dnl ***
+dnl FreeBSD and some others define "sig_t" as the return type for a signal
+dnl handler. Use it if it's there; #define it otherwise.
+
+AC_CACHE_CHECK([for 'sig_t' typedef], local_cv_have_sig_t,
+ AC_EGREP_HEADER(sig_t, signal.h,
+ local_cv_have_sig_t=yes,
+ local_cv_have_sig_t=no))
+if test "$local_cv_have_sig_t" = "yes" ; then
+ AC_DEFINE(HAVE_SIG_T)
+fi
+
+dnl ***
+dnl Password file stuff
+
+AC_CACHE_CHECK([for 'struct passwd'], local_cv_have_struct_pw,
+ AC_TRY_COMPILE([#include <pwd.h>],
+ [struct passwd *pw;],
+ local_cv_have_struct_pw=yes,
+ local_cv_have_struct_pw=no))
+if test "$local_cv_have_struct_pw" = "no" ; then
+ AC_MSG_ERROR([Sorry, but I need 'struct passwd'.])
+else
+dnl pw_comment or pw_gecos? Neither is required by X/Open or POSIX.
+
+ AC_CACHE_CHECK([for 'pw_comment' field], wclib_cv_have_pw_comment,
+ AC_TRY_COMPILE([#include <pwd.h>],
+ [struct passwd *pw;
+ char *s = (char *) pw->pw_comment;],
+ wclib_cv_have_pw_comment=yes,
+ wclib_cv_have_pw_comment=no))
+
+ AC_CACHE_CHECK([for 'pw_gecos' field], wclib_cv_have_pw_gecos,
+ AC_TRY_COMPILE([#include <pwd.h>],
+ [struct passwd *pw;
+ char *s = (char *) pw->pw_gecos;],
+ wclib_cv_have_pw_gecos=yes,
+ wclib_cv_have_pw_gecos=no))
+
+ if test "$wclib_cv_have_pw_comment" = "yes" ; then
+ AC_DEFINE(HAVE_PW_COMMENT)
+ fi
+ if test "$wclib_cv_have_pw_gecos" = "yes" ; then
+ AC_DEFINE(HAVE_PW_GECOS)
+ fi
+fi
+
+
+dnl ***
+dnl Predefined `bool' type and various related constants
+
+AC_CACHE_CHECK([for predefined 'bool' type], local_cv_have_bool,
+ AC_TRY_COMPILE([
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>],
+ [bool flag;],
+ local_cv_have_bool=yes,
+ local_cv_have_bool=no))
+if test "$local_cv_have_bool" = "no" ; then
+ AC_DEFINE(bool, short)
+fi
+
+dnl ***
+dnl TRUE?
+
+AC_CACHE_CHECK([for TRUE constant in standard headers], local_cv_have_true,
+ AC_TRY_COMPILE([
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>],
+ [if (TRUE) ;],
+ local_cv_have_true=yes,
+ local_cv_have_true=no))
+if test "$local_cv_have_true" = "yes" ; then
+ AC_DEFINE(HAVE_TRUE)
+fi
+
+dnl ***
+dnl FALSE?
+
+AC_CACHE_CHECK([for FALSE constant in standard headers], local_cv_have_false,
+ AC_TRY_COMPILE([
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>],
+ [if (FALSE) ;],
+ local_cv_have_false=yes,
+ local_cv_have_false=no))
+if test "$local_cv_have_false" = "yes" ; then
+ AC_DEFINE(HAVE_FALSE)
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl Checks for library functions.
+dnl ---------------------------------------------------------------------------
+
+AC_CHECK_FUNC(initgroups, AC_DEFINE(HAVE_INITGROUPS))
+AC_CHECK_FUNC(getpgrp, AC_DEFINE(HAVE_GETPGRP))
+AC_CHECK_FUNC(setpgrp, AC_DEFINE(HAVE_SETPGRP))
+
+dnl setsid(2) appears to be defined for all reasonable (and some unreasonable)
+dnl Unices. Hell, even the Single Unix Specification (formerly X/Open, see
+dnl `http://www.rdg.opengroup.org/onlinepubs/7908799/toc.htm') has it.
+dnl If it isn't there, we define a macro that fails.
+
+AC_CHECK_FUNC(setsid, AC_DEFINE(HAVE_SETSID))
+
+dnl AC_FUNC_GETPGRP defines GETPGRP_VOID if getpgrp() takes no parameters.
+AC_FUNC_GETPGRP
+
+AC_FUNC_SETPGRP
+AC_FUNC_VPRINTF
+AC_CHECK_FUNC(vfork, AC_DEFINE(HAVE_VFORK))
+AC_FUNC_VFORK
+
+dnl ***
+dnl Generate a list of missing functions that we desperately require.
+dnl Any missing functions, below, will be replaced with emulators if
+dnl necessary; the value of RUNAS_MISSING_SOURCES will be substituted into
+dnl the "portability" Makefile.
+
+AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR),
+ LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} strerror.c")
+
+dnl Some Unices don't have a daemon(3) function. If it's missing, we
+dnl supply our own emulation version.
+
+AC_CHECK_FUNC(daemon, AC_DEFINE(HAVE_DAEMON),
+ LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} daemon.c")
+
+AC_CHECK_FUNC(basename, AC_DEFINE(HAVE_BASENAME),
+ LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} basename.c")
+
+AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV),
+ LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} setenv.c")
+
+AC_CHECK_FUNC(flock, AC_DEFINE(HAVE_FLOCK),
+ LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} flock.c")
+
+AC_SUBST(LOCAL_MISSING_SOURCES)
+
+dnl ---------------------------------------------------------------------------
+dnl System services
+dnl ---------------------------------------------------------------------------
+
+AC_SYS_LONG_FILE_NAMES
+
+dnl ---------------------------------------------------------------------------
+dnl Final configuration constants that depend on the previous stuff.
+dnl ---------------------------------------------------------------------------
+
+dnl ---------------------------------------------------------------------------
+dnl Output and variable substitutions
+dnl ---------------------------------------------------------------------------
+
+dnl ***
+dnl Individual Makefiles
+
+AC_OUTPUT(Makefile)
+
+dnl ---------------------------------------------------------------------------
+dnl Copyrights and such
+dnl ---------------------------------------------------------------------------
+
+echo ""
+echo "***"
+echo "*** daemonize is released under a BSD-style license."
+echo "*** See the LICENSE file distributed with the source code for details."
+echo "***"
+echo ""
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
*.o
daemonize
daemonize.html
-config.h
+auto_config.h
config.log
config.status
config.cache
--- a/acconfig.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*---------------------------------------------------------------------------*\
- Site-specific configuration file for run-as utility
-
- Input to `autoheader'
-
- This source code is released under a BSD-style license. See the LICENSE
- file for details.
-\*---------------------------------------------------------------------------*/
-
-#ifndef _CONFIG_H_
-#define _CONFIG_H_
-
-#include <sys/types.h>
-
-@@TOP@@
-
-/* define if your C compiler lacks a built-in `bool' type */
-#undef bool
-
-/* define to `int' if your system lacks `ssize_t' */
-#undef ssize_t
-
-/* define to `unsigned short' if your system lacks `ushort' */
-#undef ushort
-
-/*
- Define if you have the `sig_t' type in <signal.h> or <sys/signal.h>
- (e.g., FreeBSD)
-*/
-#undef HAVE_SIG_T
-
-/*
- Define if your compiler supports a native "byte" type that holds at least
- eight bits.
-*/
-#undef HAVE_BYTE_TYPE
-
-/* Define if you have the getpgrp() function. */
-#undef HAVE_GETPGRP
-
-/* Define if you have the setpgrp() function. */
-#undef HAVE_SETPGRP
-
-/* Define if you have the initgroups() function. */
-#undef HAVE_INITGROUPS
-
-/* Define if you have the setsid() function. Almost everyone does. */
-#undef HAVE_SETSID
-
-/* Define if you have the sysconf() function. */
-#undef HAVE_SYSCONF
-
-/* Define if you have the daemon() function. */
-#undef HAVE_DAEMON
-
-/* Define if you have the strerror() function. */
-#undef HAVE_STRERROR
-
-/* Define if you have vfork() */
-#undef HAVE_VFORK
-
-/* Define if you have vprintf() */
-#undef HAVE_VPRINTF
-
-/* Define if you have the `pw_comment' field in `struct passwd' (pwd.h) */
-#undef HAVE_PW_COMMENT
-
-/* Define if you have the `pw_gecos' field in `struct passwd' (pwd.h) */
-#undef HAVE_PW_GECOS
-
-/* Define to `long' if you don't have `off_t' */
-#undef off_t
-
-/* Define to `int' if you don't have `mode_t' */
-#undef mode_t
-
-/* Define to `int' if you don't have `pid_t' */
-#undef pid_t
-
-/* Define to `int' if you don't have `gid_t' and `uid_t' */
-#undef uid_t
-#undef gid_t
-
-/* Define to `unsigned' if you don't have `size_t' */
-#undef size_t
-
-/* Define if you have <errno.h> */
-#undef HAVE_ERRNO_H
-
-@@BOTTOM@@
-
-/*****************************************************************************\
- DON'T TOUCH ANYTHING BELOW HERE!
-\*****************************************************************************/
-
-#ifndef HAVE_BYTE_TYPE
-typedef unsigned char byte; /* 8 bit unsigned critter */
-#endif /* HAVE_BYTE_TYPE */
-
-#ifndef HAVE_SIG_T
-typedef void __sighandler_t (int);
-typedef __sighandler_t *sig_t;
-#endif /* HAVE_SIG_T */
-
-#ifndef HAVE_FALSE
-#define FALSE (0)
-#endif /* FALSE */
-
-#ifndef HAVE_TRUE
-#define TRUE (1)
-#endif /* TRUE */
-
-#ifndef HAVE_SETSID
-#define setsid() ((pid_t) -1)
-#endif /* HAVE_SETSID */
-
-#ifndef HAVE_SYSCONF
-#define sysconf(name) ((long) -1)
-#endif /* HAVE_SYSCONF */
-
-#ifndef HAVE_STRERROR
-extern char *strerror (int errnum);
-#endif /* HAVE_STRERROR */
-
-extern int x_getopt (int argc, char **argv, const char *opts);
-extern int x_opterr;
-extern int x_optind;
-extern int x_optopt;
-extern char *x_optarg;
-
-#ifndef HAVE_DAEMON
-extern int daemon (int nochdir, int noclose);
-#endif
-
-#ifdef HAVE_VFORK
-#ifdef HAVE_VFORK_H
-#include <vfork.h>
-#endif
-#else /* HAVE_VFORK */
-#undef vfork
-#define vfork fork
-#endif /* HAVE_VFORK */
-
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#else
-extern int errno;
-#endif
-
-#ifndef STDC_HEADERS
-#error "Must have standard C headers. Sorry."
-#endif
-
-/*
- Password field: If only one of `pw_comment' and `pw_gecos' is present,
- define the missing one in terms of the existing one. If neither is
- present, define both in terms of `pw_name'.
-*/
-#if !defined(HAVE_PW_COMMENT) && !defined(HAVE_PW_GECOS)
-#define pw_comment pw_name
-#define pw_gecos pw_name
-#else
-#if defined(HAVE_PW_COMMENT) && !defined(HAVE_PW_GECOS)
-#define pw_gecos pw_comment
-#else
-#if defined(HAVE_PW_GECOS) && !defined(HAVE_PW_COMMENT)
-#define pw_comment pw_gecos
-#endif
-#endif
-#endif
-
-#include <sys/types.h>
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-
-#endif /* _CONFIG_H_ */
--- a/config.h.in
+++ /dev/null
@@ -1,254 +0,0 @@
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
-/*---------------------------------------------------------------------------*\
- Site-specific configuration file for run-as utility
-
- Input to `autoheader': $Id$
-\*---------------------------------------------------------------------------*/
-
-#ifndef _CONFIG_H_
-#define _CONFIG_H_
-
-#include <sys/types.h>
-
-
-/* Define if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
-#ifndef _ALL_SOURCE
-#undef _ALL_SOURCE
-#endif
-
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define if the `getpgrp' function takes no argument. */
-#undef GETPGRP_VOID
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef gid_t
-
-/* Define if you don't have vprintf but do have _doprnt. */
-#undef HAVE_DOPRNT
-
-/* Define if you support file names longer than 14 characters. */
-#undef HAVE_LONG_FILE_NAMES
-
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
-#undef HAVE_SYS_WAIT_H
-
-/* Define if you have <vfork.h>. */
-#undef HAVE_VFORK_H
-
-/* Define if you have the vprintf function. */
-#undef HAVE_VPRINTF
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef mode_t
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef pid_t
-
-/* Define if the `setpgrp' function takes no argument. */
-#undef SETPGRP_VOID
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-#undef size_t
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef uid_t
-
-/* Define vfork as fork if vfork does not work. */
-#undef vfork
-
-/* define if your C compiler lacks a built-in `bool' type */
-#undef bool
-
-/* define to `int' if your system lacks `ssize_t' */
-#undef ssize_t
-
-/*
- Define if you have the `sig_t' type in <signal.h> or <sys/signal.h>
- (e.g., FreeBSD)
-*/
-#undef HAVE_SIG_T
-
-/*
- Define if your compiler supports a native "byte" type that holds at least
- eight bits.
-*/
-#undef HAVE_BYTE_TYPE
-
-/* Define if you have the getpgrp() function. */
-#undef HAVE_GETPGRP
-
-/* Define if you have the setpgrp() function. */
-#undef HAVE_SETPGRP
-
-/* Define if you have the setsid() function. Almost everyone does. */
-#undef HAVE_SETSID
-
-/* Define if you have the daemon() function. */
-#undef HAVE_DAEMON
-
-/* Define if you have the basename() function. */
-#undef HAVE_BASENAME
-
-/* Define if you have <libgen.h> */
-#undef HAVE_LIBGEN_H
-
-/* Define if you have the strerror() function. */
-#undef HAVE_STRERROR
-
-/* Define if you have initgroups() */
-#undef HAVE_INITGROUPS
-
-/* Define if you have vfork() */
-#undef HAVE_VFORK
-
-/* Define if you have vprintf() */
-#undef HAVE_VPRINTF
-
-/* Define if you have the `pw_comment' field in `struct passwd' (pwd.h) */
-#undef HAVE_PW_COMMENT
-
-/* Define if you have the `pw_gecos' field in `struct passwd' (pwd.h) */
-#undef HAVE_PW_GECOS
-
-/* Define to `int' if you don't have `mode_t' */
-#undef mode_t
-
-/* Define to `int' if you don't have `pid_t' */
-#undef pid_t
-
-/* Define to `int' if you don't have `gid_t' and `uid_t' */
-#undef uid_t
-#undef gid_t
-
-/* Define to `unsigned' if you don't have `size_t' */
-#undef size_t
-
-/* Define if you have the <errno.h> header file. */
-#undef HAVE_ERRNO_H
-
-/* Define if you have the setenv(3) function. */
-#undef HAVE_SETENV
-
-/* Define if you have the flock(3) function. */
-#undef HAVE_FLOCK
-
-/*****************************************************************************\
- DON'T TOUCH ANYTHING BELOW HERE!
-\*****************************************************************************/
-
-#ifndef HAVE_BYTE_TYPE
-typedef unsigned char byte; /* 8 bit unsigned critter */
-#endif /* HAVE_BYTE_TYPE */
-
-#ifndef HAVE_SIG_T
-typedef void __sighandler_t (int);
-typedef __sighandler_t *sig_t;
-#endif /* HAVE_SIG_T */
-
-#ifndef HAVE_FALSE
-#define FALSE (0)
-#endif /* FALSE */
-
-#ifndef HAVE_TRUE
-#define TRUE (1)
-#endif /* TRUE */
-
-#ifndef HAVE_SETSID
-#define setsid() ((pid_t) -1)
-#endif /* HAVE_SETSID */
-
-#ifndef HAVE_SYSCONF
-#define sysconf(name) ((long) -1)
-#endif /* HAVE_SYSCONF */
-
-#ifndef HAVE_INITGROUPS
-#define initgroups(name, gid) (0)
-#endif
-
-#ifndef HAVE_STRERROR
-extern char *strerror (int errnum);
-#endif /* HAVE_STRERROR */
-
-extern int x_getopt (int argc, char **argv, const char *opts);
-extern int x_opterr;
-extern int x_optind;
-extern int x_optopt;
-extern char *x_optarg;
-
-#ifndef HAVE_DAEMON
-extern int daemon (int nochdir, int noclose);
-#endif
-
-#ifdef HAVE_VFORK
-#ifdef HAVE_VFORK_H
-#include <vfork.h>
-#endif
-#else /* HAVE_VFORK */
-#undef vfork
-#define vfork fork
-#endif /* HAVE_VFORK */
-
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#else
-extern int errno;
-#endif
-
-#ifndef HAVE_SETENV
-extern int setenv(const char *name, const char *value, int overwrite);
-#endif
-
-#ifndef STDC_HEADERS
-#error "Must have standard C headers. Sorry."
-#endif
-
-/*
- Password field: If only one of `pw_comment' and `pw_gecos' is present,
- define the missing one in terms of the existing one. If neither is
- present, define both in terms of `pw_name'.
-*/
-#if !defined(HAVE_PW_COMMENT) && !defined(HAVE_PW_GECOS)
-#define pw_comment pw_name
-#define pw_gecos pw_name
-#else
-#if defined(HAVE_PW_COMMENT) && !defined(HAVE_PW_GECOS)
-#define pw_gecos pw_comment
-#else
-#if defined(HAVE_PW_GECOS) && !defined(HAVE_PW_COMMENT)
-#define pw_comment pw_gecos
-#endif
-#endif
-#endif
-
-#include <sys/types.h>
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-
-#ifndef HAVE_BASENAME
-extern char *basename (char *path);
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
-#ifndef HAVE_FLOCK
-#include "flock.h"
-#endif
-
-#endif /* _CONFIG_H_ */
--- a/configure.in
+++ /dev/null
@@ -1,267 +0,0 @@
-dnl Copyright (c) 2003-2009 Brian M. Clapper.
-dnl All rights reserved.
-dnl
-dnl Redistribution and use in source and binary forms, with or without
-dnl modification, are permitted provided that the following conditions are met:
-dnl
-dnl * Redistributions of source code must retain the above copyright
-dnl notice, this list of conditions and the following disclaimer.
-dnl
-dnl * Redistributions in binary form must reproduce the above copyright
-dnl notice, this list of conditions and the following disclaimer in the
-dnl documentation and/or other materials provided with the distribution.
-dnl
-dnl * Neither the name of the clapper.org nor the names of its
-dnl contributors may be used to endorse or promote products derived from
-dnl this software without specific prior written permission.
-dnl
-dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-dnl ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-dnl LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-dnl INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-dnl CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-dnl POSSIBILITY OF SUCH DAMAGE.
-dnl ---------------------------------------------------------------------------
-
-
-dnl ---------------------------------------------------------------------------
-dnl Autoconf file for daemonize
-dnl
-dnl Process this file with autoconf to produce a configure script.
-dnl ---------------------------------------------------------------------------
-
-AC_INIT(daemonize.c)
-AC_CONFIG_HEADER(config.h)
-
-dnl ---------------------------------------------------------------------------
-dnl Directories and package-specific vars
-dnl ---------------------------------------------------------------------------
-
-LOCAL_TOP_LEVEL=`pwd`
-
-dnl ---------------------------------------------------------------------------
-dnl Compiler- and language-specific programs. Must precede the UNIX tests.
-dnl ---------------------------------------------------------------------------
-
-AC_PROG_CC
-AC_PROG_CPP
-
-AC_SUBST(CC)
-AC_SUBST(CPP)
-
-dnl ---------------------------------------------------------------------------
-dnl UNIX variant hacks
-dnl ---------------------------------------------------------------------------
-
-AC_AIX
-
-dnl ---------------------------------------------------------------------------
-dnl Checks for programs via standard macros.
-dnl ---------------------------------------------------------------------------
-
-AC_PROG_INSTALL
-
-dnl ---------------------------------------------------------------------------
-dnl Checks for header files.
-dnl ---------------------------------------------------------------------------
-
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(errno.h)
-AC_CHECK_HEADERS(libgen.h)
-
-export CPPFLAGS
-
-dnl ---------------------------------------------------------------------------
-dnl Checks for libraries.
-dnl ---------------------------------------------------------------------------
-
-dnl ---------------------------------------------------------------------------
-dnl Checks for typedefs, structures, and compiler characteristics.
-dnl ---------------------------------------------------------------------------
-
-AC_C_CONST
-
-AC_TYPE_UID_T
-AC_TYPE_MODE_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-
-AC_CHECK_TYPE(ssize_t, int)
-
-dnl ***
-dnl FreeBSD and some others define "sig_t" as the return type for a signal
-dnl handler. Use it if it's there; #define it otherwise.
-
-AC_CACHE_CHECK([for 'sig_t' typedef], local_cv_have_sig_t,
- AC_EGREP_HEADER(sig_t, signal.h,
- local_cv_have_sig_t=yes,
- local_cv_have_sig_t=no))
-if test "$local_cv_have_sig_t" = "yes" ; then
- AC_DEFINE(HAVE_SIG_T)
-fi
-
-dnl ***
-dnl Password file stuff
-
-AC_CACHE_CHECK([for 'struct passwd'], local_cv_have_struct_pw,
- AC_TRY_COMPILE([#include <pwd.h>],
- [struct passwd *pw;],
- local_cv_have_struct_pw=yes,
- local_cv_have_struct_pw=no))
-if test "$local_cv_have_struct_pw" = "no" ; then
- AC_MSG_ERROR([Sorry, but I need 'struct passwd'.])
-else
-dnl pw_comment or pw_gecos? Neither is required by X/Open or POSIX.
-
- AC_CACHE_CHECK([for 'pw_comment' field], wclib_cv_have_pw_comment,
- AC_TRY_COMPILE([#include <pwd.h>],
- [struct passwd *pw;
- char *s = (char *) pw->pw_comment;],
- wclib_cv_have_pw_comment=yes,
- wclib_cv_have_pw_comment=no))
-
- AC_CACHE_CHECK([for 'pw_gecos' field], wclib_cv_have_pw_gecos,
- AC_TRY_COMPILE([#include <pwd.h>],
- [struct passwd *pw;
- char *s = (char *) pw->pw_gecos;],
- wclib_cv_have_pw_gecos=yes,
- wclib_cv_have_pw_gecos=no))
-
- if test "$wclib_cv_have_pw_comment" = "yes" ; then
- AC_DEFINE(HAVE_PW_COMMENT)
- fi
- if test "$wclib_cv_have_pw_gecos" = "yes" ; then
- AC_DEFINE(HAVE_PW_GECOS)
- fi
-fi
-
-
-dnl ***
-dnl Predefined `bool' type and various related constants
-
-AC_CACHE_CHECK([for predefined 'bool' type], local_cv_have_bool,
- AC_TRY_COMPILE([
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>],
- [bool flag;],
- local_cv_have_bool=yes,
- local_cv_have_bool=no))
-if test "$local_cv_have_bool" = "no" ; then
- AC_DEFINE(bool, short)
-fi
-
-dnl ***
-dnl TRUE?
-
-AC_CACHE_CHECK([for TRUE constant in standard headers], local_cv_have_true,
- AC_TRY_COMPILE([
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>],
- [if (TRUE) ;],
- local_cv_have_true=yes,
- local_cv_have_true=no))
-if test "$local_cv_have_true" = "yes" ; then
- AC_DEFINE(HAVE_TRUE)
-fi
-
-dnl ***
-dnl FALSE?
-
-AC_CACHE_CHECK([for FALSE constant in standard headers], local_cv_have_false,
- AC_TRY_COMPILE([
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>],
- [if (FALSE) ;],
- local_cv_have_false=yes,
- local_cv_have_false=no))
-if test "$local_cv_have_false" = "yes" ; then
- AC_DEFINE(HAVE_FALSE)
-fi
-
-dnl ---------------------------------------------------------------------------
-dnl Checks for library functions.
-dnl ---------------------------------------------------------------------------
-
-AC_CHECK_FUNC(initgroups, AC_DEFINE(HAVE_INITGROUPS))
-AC_CHECK_FUNC(getpgrp, AC_DEFINE(HAVE_GETPGRP))
-AC_CHECK_FUNC(setpgrp, AC_DEFINE(HAVE_SETPGRP))
-
-dnl setsid(2) appears to be defined for all reasonable (and some unreasonable)
-dnl Unices. Hell, even the Single Unix Specification (formerly X/Open, see
-dnl `http://www.rdg.opengroup.org/onlinepubs/7908799/toc.htm') has it.
-dnl If it isn't there, we define a macro that fails.
-
-AC_CHECK_FUNC(setsid, AC_DEFINE(HAVE_SETSID))
-
-dnl AC_FUNC_GETPGRP defines GETPGRP_VOID if getpgrp() takes no parameters.
-AC_FUNC_GETPGRP
-
-AC_FUNC_SETPGRP
-AC_FUNC_VPRINTF
-AC_CHECK_FUNC(vfork, AC_DEFINE(HAVE_VFORK))
-AC_FUNC_VFORK
-
-dnl ***
-dnl Generate a list of missing functions that we desperately require.
-dnl Any missing functions, below, will be replaced with emulators if
-dnl necessary; the value of RUNAS_MISSING_SOURCES will be substituted into
-dnl the "portability" Makefile.
-
-AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR),
- LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} strerror.c")
-
-dnl Some Unices don't have a daemon(3) function. If it's missing, we
-dnl supply our own emulation version.
-
-AC_CHECK_FUNC(daemon, AC_DEFINE(HAVE_DAEMON),
- LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} daemon.c")
-
-AC_CHECK_FUNC(basename, AC_DEFINE(HAVE_BASENAME),
- LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} basename.c")
-
-AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV),
- LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} setenv.c")
-
-AC_CHECK_FUNC(flock, AC_DEFINE(HAVE_FLOCK),
- LOCAL_MISSING_SOURCES="${LOCAL_MISSING_SOURCES} flock.c")
-
-AC_SUBST(LOCAL_MISSING_SOURCES)
-
-dnl ---------------------------------------------------------------------------
-dnl System services
-dnl ---------------------------------------------------------------------------
-
-AC_SYS_LONG_FILE_NAMES
-
-dnl ---------------------------------------------------------------------------
-dnl Final configuration constants that depend on the previous stuff.
-dnl ---------------------------------------------------------------------------
-
-dnl ---------------------------------------------------------------------------
-dnl Output and variable substitutions
-dnl ---------------------------------------------------------------------------
-
-dnl ***
-dnl Individual Makefiles
-
-AC_OUTPUT(Makefile)
-
-dnl ---------------------------------------------------------------------------
-dnl Copyrights and such
-dnl ---------------------------------------------------------------------------
-
-echo ""
-echo "***"
-echo "*** daemonize is released under a BSD-style license."
-echo "*** See the LICENSE file distributed with the source code for details."
-echo "***"
-echo ""
|