
#
#    ========== licence begin  GPL
#    Copyright (C) 2001 SAP AG
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of the GNU General Public License
#    as published by the Free Software Foundation; either version 2
#    of the License, or (at your option) any later version.
#
#    This program 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 General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#    ========== licence end
#
use Env;

sub set_sqladump {
    local($VERSION) = @_ ;
    local($REG_INP_FILE) = "sqladump.reg" ;
    open(REG_FILE, ">$REG_INP_FILE" ) ;
    print REG_FILE "REGEDIT4\n" ;
    print REG_FILE "[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\" ;
    print REG_FILE "ADABAS-${DBNAME}${VERSION}\\Parameters]\n";
    print REG_FILE "\"sqladump\"=dword:00000001 \n" ;
    close(REG_FILE);
    system("regedit -s $REG_INP_FILE");
    unlink $REG_INP_FILE ;
}

$USAGE = "usage: sqladump [-f|-q|-s] -d <serverdb> \n";


$VERSION="" ;

while ($_ = $ARGV[0], /^-/) {
    last if /^--$/;

    if (/^-q$/) { $VERSION=" (quick)" } 

    if (/^-s$/) { $VERSION=" (slow)" } 

    if (/^-f$/ )  { next }   # default

    if (/^-d$/) { $DBNAME=$ARGV[1]; } 
    shift;

} #while

if ( @ARGV != 1 ) { print $USAGE; exit 1 }

&set_sqladump($VERSION) ;
