#! /bin/sh
MANPATH=`pwd`/man
export MANPATH

exitcode=0
check_manpage() {
  man -s$1 $2 > /dev/null 2>&1
   if [ $? -ne 0 ]
   then
      echo "Missing: $2($1)" >&2
      exitcode=1
   fi
}

check_manpage 3lib libcouchbase
check_manpage 3head couchbase
check_manpage 3head couchbase.h

libname=
for f in .libs/libcouchbase.so .libs/libcouchbase.dylib
do
  if [ -f $f ]
  then
    libname=$f
  fi
done

if [ "x$libname" = "x" ]
then
  echo "Could not locate library"
  exit 0
fi

for f in `nm -P $libname | grep ' T ' | egrep -v '_init|_fini' | cut -f 1 -d\ `
do
   check_manpage 3couchbase $f
done

exit $exitcode

#! /bin/sh

MAN="man -s"
man -s1 man > /dev/null 2>&1
if [ $? -ne 0 ]
then
    MAN="man -S"
fi

MANPATH=`pwd`/man
export MANPATH

exitcode=0
check_manpage() {
   ${MAN}$1 $2 > /dev/null 2>&1
   if [ $? -ne 0 ]
   then
      echo "Missing: $2($1)" >&2
      exitcode=1
   fi
}

check_manpage 3lib libcouchbase
check_manpage 3head couchbase
check_manpage 3head couchbase.h

libname=
for f in .libs/libcouchbase.so .libs/libcouchbase.dylib
do
  if [ -f $f ]
  then
    libname=$f
  fi
done

if [ "x$libname" = "x" ]
then
  echo "Could not locate library"
  exit 0
fi

for f in `nm -P $libname | grep ' T ' | egrep -v '_init|_fini' | cut -f 1 -d\ `
do
   check_manpage 3couchbase $f
done

exit $exitcode

Use 'man -S' when 'man -s' unavailable (FreeBSD)
Use 'man -S' when 'man -s' unavailable (FreeBSD)

Change-Id: I19f7b00928762bf4f266fce53ed8faecff9d1754
Reviewed-on: http://review.couchbase.org/11181
Tested-by: Sergey Avseyev <87f6d5e4fd3644c3c20800cde7fd3ad1569370b3@gmail.com>
Reviewed-by: Sergey Avseyev <87f6d5e4fd3644c3c20800cde7fd3ad1569370b3@gmail.com>
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
