#!/usr/bin/env perl
# +-======-+ 
#  Copyright (c) 2003-2007 United States Government as represented by 
#  the Admistrator of the National Aeronautics and Space Administration.  
#  All Rights Reserved.
#  
#  THIS OPEN  SOURCE  AGREEMENT  ("AGREEMENT") DEFINES  THE  RIGHTS  OF USE,
#  REPRODUCTION,  DISTRIBUTION,  MODIFICATION AND REDISTRIBUTION OF CERTAIN 
#  COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS 
#  REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY").  
#  THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN 
#  INTENDED  THIRD-PARTY  BENEFICIARY  OF  ALL  SUBSEQUENT DISTRIBUTIONS OR 
#  REDISTRIBUTIONS  OF THE  SUBJECT  SOFTWARE.  ANYONE WHO USES, REPRODUCES, 
#  DISTRIBUTES, MODIFIES  OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED 
#  HEREIN, OR ANY PART THEREOF,  IS,  BY THAT ACTION, ACCEPTING IN FULL THE 
#  RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT.
#  
#  Government Agency: National Aeronautics and Space Administration
#  Government Agency Original Software Designation: GSC-15354-1
#  Government Agency Original Software Title:  GEOS-5 GCM Modeling Software
#  User Registration Requested.  Please Visit http://opensource.gsfc.nasa.gov
#  Government Agency Point of Contact for Original Software:  
#  			Dale Hithon, SRA Assistant, (301) 286-2691
#  
# +-======-+ 
#=======================================================================
# name - extract_config.pl
# purpose - Wrapper for extract_config subroutine in Extract_config.pm
#
# !Revision History
# 20110812  TOwens Initial Version 
#=======================================================================
use strict;
use warnings;


# main program
#-------------
{
    use FindBin;
    use lib "$FindBin::Bin";
    use Extract_config;
    my @result;

    usage() unless @ARGV;
    @result = extract_config @ARGV;
    print "@result\n";
}

#=======================================================================
# name - usage
# purpose - print usage information
#=======================================================================
sub usage {

  print <<"EOF";
NAME
     extract_config  - extracts config values from rc files 

SYNOPSIS

   extract_config.pl value rcfile
   where
     value = configuration value name
     rcfile = rcfile containing value


DESCRIPTION
       extracts config values from rc files
       a command line front end to Extract_config.pm
NOTES
     1. RC file must be in format "valuename = value"     
     2. does not respect # as comments 
     3. matches on substrings  - all valuenames must be unique
     4. will keep matching to end of file - returning last match found

EXAMPLES

AUTHOR
    Tommy Owens Tommy.Owens\@nasa.gov 
    based on Extract_config.pm written by Dave Lamich
    and adapted from tick written by Joe Stassi
EOF

exit(1);
}
