#!/bin/sh
#
# Copyright (C) 1998-2000 VMware, Inc.  All Rights Reserved.
#
# This script is VMware's wrapper for smbpasswd

argc="$#"
this="$0"

usage() {
  echo "Usage: `basename "$this"` <virtual interface> [options] [username] [password]"
  echo 'virtual interface:'
  echo '  vmnetX               where 0 <= X <= 3'
  "$this".bin -h | awk 'BEGIN {n=0;} {n++; if (n >= 2) {print;};}'
  exit 1
}

if [ "$argc" -lt "1" ]; then
  usage
fi

vmnet="$1"
shift

if [ ! -r /etc/vmware/"$vmnet"/smb/smb.conf ]; then
  echo 'Unknown virtual interface "'"$vmnet"'".'
  usage
fi

"$this".bin -l /etc/vmware/"$vmnet"/smb/smb.conf "$@"
