/*
* This file is part of rasdaman community.
*
* Rasdaman community 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 3 of the License, or
* (at your option) any later version.
*
* Rasdaman community 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 rasdaman community. If not, see .
*
* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
rasdaman GmbH.
*
* For more information please see
* or contact Peter Baumann via .
*/
/**
* SOURCE: rascontrol.cc
*
* MODULE: rascontrol
* CLASS:
*
* PURPOSE:
* RasControl is the remote control utility for the rasmgr
*
* COMMENTS:
* - should normalize cmd interpretation with rasmgr: strcmp vs strncmp
*/
#define DEBUG_MAIN // to allocate static vars for trace macros
#include "debug-clt.hh"
#include "rascontrol.hh"
#include
#include
#ifndef RMANVERSION
#error "Please specify RMANVERSION variable!"
#endif
#ifndef COMPDATE
#error "Please specify the COMPDATE variable!"
/*
COMPDATE=`date +"%d.%m.%Y %H:%M:%S"`
and -DCOMPDATE="\"$(COMPDATE)\"" when compiling
*/
#endif
UserLogin userLogin;
EditLine editLine;
RasMgrClientComm httpClient;
RascontrolConfig config;
bool redirStdin = false;
bool redirStdout = false;
const int NOERROR = 0;
const int CANTCONNECT = 1;
const int LOGINERROR = 2;
const int ACCESSDENIED = 3;
// flag to indicate whether conf or auth file have been modified.
// if true files must be saved before terminating.
static bool confFileDirty = false;
static bool authFileDirty = false;
int interactiveWork();
int loginOnly();
int batchMode();
int testLogin();
int main(int argc, char **argv)
{
if(config.interpretArguments(argc,argv)==false) return 1;
// /*for debug only: */ config.printDebugInfo(); return 0;
if(config.beQuiet()==false)
{
std::cout << "rascontrol: rasdaman server remote control utility. rasdaman v" << RMANVERSION / 1000. << " -- generated on " << COMPDATE << "." << std::endl;
std::cout << " Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann rasdaman GmbH." << std::endl
<< "Rasdaman community 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 3 of the License, or "
"(at your option) any later version. \n"
"Rasdaman community 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. \n\n";
std::cout << "This software contains software which is in the public domain:" << std::endl;
std::cout << "- openssl 0.96c (C) 1998-2002 The OpenSSL Project, (C) 1995-1998 Eric A. Young, Tim J. Hudson" << std::endl;
}
if(config.showHelp())
{
config.printHelp();
return 0;
}
if(testIsMessageDigestAvailable("MD5")==false)
{
std::cout<<"Error: Message Digest MD5 not available."<0)
std::cout<<" "<