commit 6eb3f3055d41dab4a395fcea2301034993977722 from: Alexander Barton date: Sat Aug 05 00:15:28 2006 UTC Added support for Solaris 11. commit - c888c81adf0964e12ae2961550836a52da7c3678 commit + 6eb3f3055d41dab4a395fcea2301034993977722 blob - 17d717494fe6f833db31629e210e59d67737d183 blob + 0d9451920d938200583d3edd9a20e52e906e8c41 --- src/testsuite/getpid.sh +++ src/testsuite/getpid.sh @@ -1,16 +1,17 @@ #!/bin/sh # ngIRCd Test Suite -# $Id: getpid.sh,v 1.4 2003/08/22 11:31:18 alex Exp $ +# $Id: getpid.sh,v 1.5 2006/08/05 00:15:28 alex Exp $ # did we get a name? [ $# -ne 1 ] && exit 1 # detect flags for "ps" and "head" -if [ `uname` = "FreeBSD" ]; then +UNAME=`uname` +if [ $UNAME = "FreeBSD" -o $UNAME = "SunOS" ]; then PS_FLAGS="-a"; PS_PIDCOL="1"; HEAD_FLAGS="-n 1" -elif [ `uname` = "A/UX" ]; then +elif [ $UNAME = "A/UX" ]; then PS_FLAGS="-ae"; PS_PIDCOL="1"; HEAD_FLAGS="-1" -elif [ `uname` = "GNU" ]; then +elif [ $UNAME = "GNU" ]; then PS_FLAGS="-ax"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1" else PS_FLAGS="-f"; PS_PIDCOL="2"; HEAD_FLAGS="-n 1" @@ -19,13 +20,17 @@ else fi # debug output +#echo "$0: UNAME=$UNAME" #echo "$0: PS_FLAGS=$PS_FLAGS" #echo "$0: PS_PIDCOL=$PS_PIDCOL" #echo "$0: HEAD_FLAGS=$HEAD_FLAGS" # search PID ps $PS_FLAGS > procs.tmp -cat procs.tmp | grep -v "$0" | grep "$1" | awk "{print \$$PS_PIDCOL}" | sort -n > pids.tmp +cat procs.tmp | \ + grep -v "$0" | grep "$1" | \ + awk "{print \$$PS_PIDCOL}" | \ + sort -n > pids.tmp pid=`head $HEAD_FLAGS pids.tmp` rm -rf procs.tmp pids.tmp