#!/bin/sh

PROG="${0##*/}" #program name


print_version()
{
	cat <<EOF
$PROG version 0.0.2

Written by Stanislav Ievlev

Copyright (C) 2003-2004 ALT Linux Team
EOF
	exit
}


print_usage()
{
	[ "$1" = 0 ] || exec >&2
	cat <<EOF
Usage: $PROG

get device name for root filesystem, according fstab settings

Valid options are:
  -h, --help	display help screen
  -v, --version	display version information

Report bugs to <inger@altlinux.org>
EOF
	[ -n "$1" ] && exit "$1" || exit
}


TEMP=`getopt -n $PROG -o h,v,d,p  -l help,version,device,partition -- "$@"` || print_usage
eval set -- "$TEMP"

pattern="[[:space:]]*[[:print:]][[:space:]]/[[:space:]]"

while :; do
	case "$1" in
		-h|--help) print_usage 0
			;;
		-v|--version) print_version; exit 0
			;;
		--) shift; break
			;;
		*) Fatal "unrecognized option: $1"
			;;
	esac
	shift
done

cat /etc/fstab|grep $pattern|cut -f1 -d' '
