#!/usr/bin/env perl
#######################################################################
# routine: linesize_wrapper
#
# purpose: wrap the linesize subroutine so it can be called from csh
#          script, as in g2fxxx.csh in OTFR pipeline
#
# inputs:  Input file
#
# returns: value from linesize subroutine as printed string
#          (-1 means file problem; N is length of longest line)
#          
#
# modification history:
#
#   date    opr     who     reason
# -------- -----  --------  --------------------------------------
# 05/03/02 45707  Sherbert  make subroutine available to any shell script
# 
#######################################################################
#######################################################################
#
# prepend the Perl include variable using all components of PATH
# (this allows us to reuse other OTFR Perl code)
#
$PATH  = $ENV{"PATH"};
@parts = split /:/, $PATH;
while (defined($val = pop(@parts))) {
   if (substr($val,0,1) eq "/") { unshift(@INC, $val)}
}

#
# include these modules
#
require 'linesize.pl';       # finds longest line length

$file = $ARGV[0];

$max_line_length = linesize ($file);
print $max_line_length;   ## NOTE: sends a string instead of number

## Cannot print anything but the line size so calling script
## can capture the necessary information.

exit 0;
