$TC_dir = "c:\\tc\\";
$TC_libdir = "${TC_dir}lib\\";
open(ARG, "<arglist.tmp") || die("Can't open arglist.tmp\n");
@args = <ARG>;
close(ARG);

$aa = join("\n",@args);
print $aa;

$o_flag = shift(@args);
if ($o_flag ne "-o\n")
   { die ("Did not find expected -o inargument list.\n"); }

$exe = shift(@args);
chop($exe);
@objects = grep(/obj/, @args);
@libraries = grep(/\.lib/, @args);

$objects = join("",@objects);
chop($objects);
$objects =~ s/\n/+\n/g;
$objects = "${TC_libdir}c0l $objects";

$libraries = join("",@libraries);
$libraries =~ s/\n/+\n/g;
$libraries = "$libraries ${TC_libdir}fp87 ${TC_libdir}mathl ${TC_libdir}cl\n";

$rsp = "$objects\n$exe, map\n$libraries";
$rsp =~ tr%/%\\%;

system("pwd");
open(RSP, ">tlink.rsp") || die ("Can't open tlink.rsp\n");
print(RSP $rsp);
close(RSP);

$s = system("${TC_dir}tlink /v \@tlink.rsp");  # insert /v for debugging
#print "${TC_dir}tlink  \@tlink.rsp\n";
# Added escape to @ for Win95 Perl 5.
$s /= 256;
print "tlink exit: $s";
exit($s);
