/usr/share/doc/freetds-common/examples/freetds.conf.pl is in freetds-common 0.91-6.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #!/usr/bin/perl
#
# FreeTDS - Library of routines accessing Sybase and Microsoft databases
# Copyright (C) 2001 James K. Lowden
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# This program converts entries in an interfaces file to the format
# of freetds.conf.
if( @ARGV > 0 ) {
$interfaces = $ARGV[0];
goto OPEN if( -e $interfaces && ! -d $interfaces );
# agument was only directory name?
$interfaces = "$interfaces/interfaces";
goto OPEN if( -e $interfaces );
warn "Could not find 'interfaces' file using $ARGV[0].\n";
}
# is it in the current directory?
$interfaces = 'interfaces';
goto OPEN if( -e $interfaces );
# is it in the $SYBASE directory?
$interfaces = "$ENV{SYBASE}/interfaces";
goto OPEN if( -e $interfaces );
CROAK: # no input file found <sigh>.
$searched = qq("$ARGV[0]", ) if $ARGV[0];
$searched .= qq/\$SYBASE ("$SYBASE") /;
$searched .= ", " if $ARGV[0];
$searched .= "or " . `pwd`;
die qq(No "interfaces" file found to convert in $searched);
OPEN:
open INTERFACES, $interfaces or die qq(Could not open "$interfaces" from `pwd`);
print qq(# The following lines were converted from "$interfaces":\n);
$fPrintComments = 0;
while(<INTERFACES>) {
# Print comments after finding some kind of data line
# (skip boilerplate explanatory comments in model interfaces file).
if( /^#/ ) {
print if $fPrintComments;
next;
}
$fPrintComments = 1; # reached first non-commented line
if( /^(\w+)/ ) { # new symbolic name found
chomp;
$SymbolicName = $1;
$hostname = $port = $tds = '';
next;
}
next unless $SymbolicName;
# ignore "master" record
next if /^\s+master/;
# if we know the symbolic name and we found a "query" line...
if( s/^\s+query//o ) { # found a live one
chomp;
($tcp, $tds, $hostname, $port) = split;
$tds =~ s/tds//o; # strip off 'tds' if in form of 'tds4.2'
print qq([$SymbolicName]\n);
print qq(\thost = $hostname\n);
print qq(\tport = $port\n);
print qq(\ttds version = $tds\n) if $tds =~ /\d.*\d/;
print qq(\n);
$SymbolicName = '';
$hostname = $port = $tds = '';
}
}
|