#!/bin/sh
#
# $Author: ylee $  
# $Revision: 1.7 $  
# $Date: 2004/04/09 19:46:46 $  
#
# Name: ath_cli
# 
# COPYRIGHT NOTICE:
#   This software is protected as an unpublished work under the
#   Copyright Act of 1976.
#
# PROPRIETARY RIGHTS of Stellcom Technologies are involved in
# the subject matter of this material and all manufacturing,
# reproduction, use and sales rights pertaining to such subject
# matter are expressly reserved.  This material is submitted in
# confidence for a specified purpose, and the recipient, by
# accepting this material, agrees that this material will not be
# used, copied or reproduced in whole or in part, nor its
# contents revealed in any manner, or to any person, except for
# the purpose delivered.
#
# U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND
# Use, duplication or disclosure by the Government is subject to
# restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph
# (c)(1)(ii) of the Rights in Technical Data and Computer Software clause
# at DFARS 252.227-7013 and/or in similar or successor clauses in the
# FAR, or the DOD or NASA FAR Supplement. Contractor/manufacturer is
# Stellcom, 12670 High Bluff Drive, San Diego, CA 92130-2013.
#
# Description:
#
#	Interactive shell for the Atheros command line interface
#
#-----------------------------------------------------------------------------


#
# Setup the constant strings
#

cli_file="/proc/net/ath/ap_cli"
cli_prompt_file="/proc/net/ath/ap_cli_prompt"

#
# First clear out any messages that are still in the
# command line interface buffer before getting the
# first command from the user
#

cat $cli_file

#
# Start an infinite loop getting input from the user
# and passing the results to the Atheros command line
# interpreter in the kernel driver
#

while : 
do

    #
    # Get an input command from the user
    #

    read cli_prompt < $cli_prompt_file    
    read -p "$cli_prompt " cmd_line


    # 
    # Make sure the input command is valid
    #
    
    if [ $? -ne 0 ] ; then
        echo
        break
    fi

    # Send the command line to the command line interpreter
    #
    
    echo "$cmd_line" > $cli_file

    #
    # Display the response from the CLI
    #
    
    cat $cli_file 

    if [ "$cmd_line" = "exit" ] ; then
        break
    fi

    if [ "$cmd_line" = "quit" ] ; then
        break
    fi


done


