#!/usr/bin/perl -w
{
$version = "listopt version 2.0  20 Dec 2012";

# 20 Dec 12.  WJS  v 2.0
#       Rewrite in perl so we can use build-opt-env.pl instead of build-opt-env
#    so we can get  // -> / PATHINFO fix.  Otherwise, listopt just prints some
#    text.  Amazingly enough, we need to write some error handling, too ... sigh
#	Consider previous versions some sub-version of version 1
#
# modified September 1997, clh
#    look like 'newer' style options
#    add ability to download CSV and nd conversion to -9999.0
#

$build_opt_env = "build-opt-env.pl";

require ("cgi-lib.pl");
require "wjs_web_perl_utilities.pl";
require "$build_opt_env";

&printheader();

$dispfull = $list_objspec = &check_build_opt_env_var('OBJECT',$build_opt_env);

$urlobj = &check_build_opt_env_var('URLOBJ',$build_opt_env);
$actualnosuff = "$urlobj.flat99";

$return_objspec = &check_build_opt_env_var('OBJEXT',$build_opt_env);

#   Being sloppy here.  Undefined $ENV{'SUBSELS'} is a setup error
#   Can't use &check_build* because that insists on "non-empty" and SUBSELS CAN be
#   empty.
if ($subsels = $ENV{'SUBSELS'}) {
  $dispss = &check_build_opt_env_var('DISPSS',$build_opt_env);
  $dispfull .= '(' . $dispss . ')';
  $actualnosuff .= '?' . $subsels;
  $list_objspec .= '?' . $subsels;
  $return_objspec .= '?' . $subsels;
}

print <<  "XXstuffXX";
<p>
<html><head><title>Other data listing formats</title></head>
<body>
<h1>Other data listing formats</h1>
<b>Current object is:  $dispfull</b></br>
<hr noshade>

<p>
<b>Hint</b>:  By holding down the Shift key and clicking on
 a link, you can download the data without displaying
 it on your screen.
<p>
<ul>
<li><font size="5"><a href="$actualnosuff">Flat listing</a></font>
<dl><dd> table with one column per variable, names on top line</dl>
<p>
<li><font size="5"><a href="/jg/listbrief$list_objspec">Data only listing</a></font>

<dl><dd> table with one column per variable, no variable names</dl>
<p>
<li><font size="5"><a href="/jg/listfnzm$list_objspec">CSV style listing</a></font>
<dl><dd> Identifying comments
    <dd> comma-separated values
    <dd> convert 'nd' to -9999.0</dl>
<p>
</ul>
<p>
<a href="/jg/otheropt$return_objspec">Back to Main menu</a>
</body>
</html>
XXstuffXX

undef $version;
exit;
}

