#!/bin/sh
#
#     tiger - A UN*X security checking system
#     Copyright (C) 1993 Douglas Lee Schales, David K. Hess, David R. Safford
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 1, or (at your option)
#    any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#     Please see the file `COPYING' for the complete copyright notice.
#
# UNICOS/gen_mounts - 07/31/97
#
#-----------------------------------------------------------------------------
#


LOCAL_ONLY=$1
CHKRO=$2

ronly()
{
  RO=1
  case "$1" in
    *[,\(]ro[,\)]*) RO=0
      ;;
  esac
  return $RO
}

localfs()
{
  LOCAL=1
  [ "$1" = "NC1FS" ] && LOCAL=0

  return $LOCAL
}

/etc/mount |
while read fs o mtpoint t fstype opts
do
  PRINT=1
  [ "$CHKRO" = "rw" ] && { ronly "$opts" && PRINT=0; }
  [ "$LOCAL_ONLY" = "local" ] && { localfs "$fstype" || PRINT=0; }
  [ "$PRINT" = "1" ] && echo "$mtpoint $fstype $fs"
done

