diff options
author | Manoj Srivastava <srivasta@golden-gryphon.com> | 2014-04-27 18:05:39 -0700 |
---|---|---|
committer | Manoj Srivastava <srivasta@golden-gryphon.com> | 2014-04-27 18:05:39 -0700 |
commit | 7d4c02d5c9108aa413fbb0ffa1dc8a39bc5f54a1 (patch) | |
tree | 2abb9ad01d397bc1e208f57f528c1ec529761392 /mcon/U/d_setpgrp.U | |
parent | 5c913c35c09a82eead2c07534baa709a5dead3e7 (diff) | |
parent | 8f5e5726134ce5b4bd436b16f367796d851df553 (diff) |
Merge branch 'upstream'
Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
Conflicts:
jmake/jmake.man
Diffstat (limited to 'mcon/U/d_setpgrp.U')
-rw-r--r-- | mcon/U/d_setpgrp.U | 102 |
1 files changed, 41 insertions, 61 deletions
diff --git a/mcon/U/d_setpgrp.U b/mcon/U/d_setpgrp.U index 351038b..a1dbfd6 100644 --- a/mcon/U/d_setpgrp.U +++ b/mcon/U/d_setpgrp.U @@ -1,11 +1,11 @@ -?RCS: $Id: d_setpgrp.U 1 2006-08-24 12:32:52Z rmanfredi $ +?RCS: $Id: d_setpgrp.U 167 2013-05-08 17:58:00Z rmanfredi $ ?RCS: ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ?RCS: -?RCS: You may redistribute only under the terms of the Artistic Licence, +?RCS: You may redistribute only under the terms of the Artistic License, ?RCS: as specified in the README file that comes with the distribution. ?RCS: You may reuse parts of this distribution only within the terms of -?RCS: that same Artistic Licence; a copy of which may be found at the root +?RCS: that same Artistic License; a copy of which may be found at the root ?RCS: of the source tree for dist 4.0. ?RCS: ?RCS: $Log: d_setpgrp.U,v $ @@ -24,8 +24,7 @@ ?RCS: Revision 3.0 1993/08/18 12:07:09 ram ?RCS: Baseline for dist 3.0 netwide release. ?RCS: -?MAKE:d_setpgrp d_bsdsetpgrp: cat rm +cc +libs +ccflags \ - +ldflags Inlibc Guess Setvar i_unistd +?MAKE:d_setpgrp d_bsdsetpgrp: Trylink Setvar cat i_unistd ?MAKE: -pick add $@ %< ?S:d_setpgrp: ?S: This variable conditionally defines HAS_SETPGRP if setpgrp() is @@ -48,69 +47,50 @@ ?H:#$d_setpgrp HAS_SETPGRP /**/ ?H:#$d_bsdsetpgrp USE_BSD_SETPGRP /**/ ?H:. -?F:!set.c !set -?T:xxx ?LINT:set d_setpgrp d_bsdsetpgrp : see if setpgrp exists -set setpgrp d_setpgrp -eval $inlibc - -@if USE_BSD_SETPGRP || d_bsdsetpgrp -case "$d_setpgrp" in -"$define") - echo " " - echo "Checking to see which flavor of setpgrp is in use..." - $cat >set.c <<EOP -#$i_unistd I_UNISTD +$cat >try.c <<EOC #include <sys/types.h> +#$i_unistd I_UNISTD #ifdef I_UNISTD -# include <unistd.h> +#include <unistd.h> #endif -int main() +int main(void) { - if (getuid() == 0) { - printf("(I see you are running Configure as super-user...)\n"); - setuid(1); - } -#ifdef TRY_BSD_PGRP - if (-1 == setpgrp(1, 1)) - exit(0); -#else - if (setpgrp() != -1) - exit(0); + static pid_t ret, pid, pgrp; + ret |= setpgrp(pid, pgrp); + return ret ? 0 : 1; +} +EOC +cyn="whether you have the BSD flavour of setpgrp()" +set d_bsdsetpgrp +eval $trylink + +case "$d_bsdsetpgrp" in +$define) + val="$define" + set d_setpgrp + eval $setvar + ;; +*) + $cat >try.c <<EOC +#include <sys/types.h> +#$i_unistd I_UNISTD +#ifdef I_UNISTD +#include <unistd.h> #endif - exit(1); +int main(void) +{ + static pid_t ret; + ret |= setpgrp(); + if (ret) + return 1; + return 0; } -EOP - if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then - echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4 - val="$define" - elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then - echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4 - val="$undef" - else - echo "(I can't seem to compile and run the test program.)" - if ./usg; then - xxx="a USG one, i.e. you use setpgrp()." - else - # SVR4 systems can appear rather BSD-ish. - case "$i_unistd" in - $undef) - xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)." - val="$define" - ;; - $define) - xxx="probably a USG one, i.e. you use setpgrp()." - val="$undef" - ;; - esac - fi - echo "Assuming your setpgrp is $xxx" >&4 - fi +EOC + cyn="whether you have the USG flavour of setpgrp() then" + set d_setpgrp + eval $trylink ;; -*) val="$undef";; esac -set d_bsdsetpgrp -eval $setvar -$rm -f set set.c -@end + |