#!/usr/bin/perl
########################################################################
#
#                  CTC++ System, ctcdiff (1.1)
#                  CTC++ Perl frontend (Cygwin)
#
# RCSfile     : $RCSfile: ctc2dat $
# Version     : $Revision: 1.1 $ $Date: 2017/06/20 12:31:47 $
# Last Edited : 4.10.2017
# Author      : $Author: roland $
#
#               Copyright (c) 2013-2017 Verifysoft Technology GmbH
##########################################################################
# Additional notice to users:
# Verifysoft Technology provides support for this ctc cygwin component of
# the CTC++ System in the same way as Verifysoft Technology provides support
# for the other components of the CTC++ System. Because this component is
# provided in a source file form, you are able to modify this file.
# However, if you do any such modifications, Verifysoft Technology may not
# be capable of providing you support, and Verifysoft Technology reserves
# the right not to support you with this component, if you have done your
# own modifications to this file.
#
# Verifysoft Technology would however be pleased to receive your bug
# corrections/reports and enhancement suggestions and will consider them
# in future versions of this tool.
#
##########################################################################



##########################################################################
# subroutines
##########################################################################
sub makeopts;
sub expand_opts;
sub escape_opt;
sub cygpath;

##########################################################################
# global "constants"
##########################################################################
$version            = "ctcdiff cygwin v1.1";

##########################################################################
# execution starts here !
##########################################################################

$ctchome = Cygwin::win_to_posix_path($ENV{CTCHOME});

 ARG:
if ($^O eq "cygwin") {
    for ($i=0;$i<=$#ARGV;$i++) {
	if ($ARGV[$i] eq '-i1' ||
	    $ARGV[$i] eq '-i2' ||
	    $ARGV[$i] eq '-p' ||
	    $ARGV[$i] eq '-h')
	{
	    #Nothing
	} elsif ($ARGV[$i] eq '-') {
	} else {
	    my $exe = cygpath($ARGV[$i]);
	    $ARGV[$i]=$exe;
	}
    }
}

exec($ctchome."/ctcdiff.exe", @ARGV);

# We should never hit this
exit 1; 

1;
##########################################################################
# SUBROUTINES
##########################################################################

##########################################################################
# SUBROUTINE: cygpath
# PURPOSE   : Wrapper to "cygpath"
# ARGUMENT  : - $file 
# RETURNS   : $file with Windows conventions
##########################################################################
sub cygpath
{
    my ($file) = @_;

    return Cygwin::posix_to_win_path($file) if $^O eq "cygwin";
    # External 
    #    $tt = qx#cygpath -m $file#;
    #    $tt =~ s/\015?\012$//;

    return $file;
}


# EOF $RCSfile: ctc2dat $




