commit ec1847f018c265c12f0aae381051bef3bd5e4869 from: Alexander Barton date: Sun Dec 17 13:49:49 2006 UTC Added support for Solaris 11. [from HEAD] commit - 0af8fafdfba6236794d12106a6731f35d03a36b4 commit + ec1847f018c265c12f0aae381051bef3bd5e4869 blob - 17d717494fe6f833db31629e210e59d67737d183 blob + 572688ba82d9bf5cbaf5541d2641f97944dc3105 --- 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.4.6.1 2006/12/17 13:49:49 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