Skip to content

Commit

Permalink
cat: fix problem with cat commands when catalogue is not opened
Browse files Browse the repository at this point in the history
  • Loading branch information
pwdraper committed Aug 5, 2014
1 parent 1a73c95 commit fc7bd69
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions cat/generic/TclAstroCat.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* 18/03/09 Added comments command.
* 20/07/09 Use object interface for building the query
* table list. Old interface very slow in tcl8.5.
* 05/08/14 Fix logic of !cat in show and sort commands.
*/
static const char* const rcsId="@(#) $Id: TclAstroCat.C,v 1.1.1.1 2009/03/31 14:11:52 cguirao Exp $";

Expand Down Expand Up @@ -1544,13 +1545,11 @@ int TclAstroCat::is_tcsCmd(int argc, char* argv[])
*/
int TclAstroCat::symbolCmd(int argc, char* argv[])
{
if (argc == 0) {
if (cat_)
return appendListVal(cat_->symbol());
}
if (! cat_)
return error("no catalog is open");

if (argc == 0) {
return appendListVal(cat_->symbol());
}
cat_->entry()->symbol(argv[0]);
return TCL_OK;
}
Expand All @@ -1569,12 +1568,11 @@ int TclAstroCat::symbolCmd(int argc, char* argv[])
*/
int TclAstroCat::searchcolsCmd(int argc, char* argv[])
{
if (! cat_)
return error("no catalog is open");
if (argc == 0) {
if (cat_)
return appendListVal(cat_->searchCols());
return appendListVal(cat_->searchCols());
}
else if (! cat_)
return error("no catalog is open");
cat_->entry()->searchCols(argv[0]);
return TCL_OK;
}
Expand All @@ -1594,12 +1592,11 @@ int TclAstroCat::searchcolsCmd(int argc, char* argv[])
*/
int TclAstroCat::sortcolsCmd(int argc, char* argv[])
{
if (! cat_)
return error("no catalog is open");
if (argc == 0) {
if (cat_)
return set_result(cat_->sortCols());
return set_result(cat_->sortCols());
}
else if (! cat_)
return error("no catalog is open");
cat_->entry()->sortCols(argv[0]);
return TCL_OK;
}
Expand All @@ -1619,12 +1616,11 @@ int TclAstroCat::sortcolsCmd(int argc, char* argv[])
*/
int TclAstroCat::sortorderCmd(int argc, char* argv[])
{
if (! cat_)
return error("no catalog is open");
if (argc == 0) {
if (cat_)
return set_result(cat_->sortOrder());
return set_result(cat_->sortOrder());
}
else if (! cat_)
return error("no catalog is open");
cat_->entry()->sortOrder(argv[0]);
return TCL_OK;
}
Expand All @@ -1644,12 +1640,11 @@ int TclAstroCat::sortorderCmd(int argc, char* argv[])
*/
int TclAstroCat::showcolsCmd(int argc, char* argv[])
{
if (! cat_)
return error("no catalog is open");
if (argc == 0) {
if (cat_)
return set_result(cat_->showCols());
return set_result(cat_->showCols());
}
else if (! cat_)
return error("no catalog is open");
cat_->entry()->showCols(argv[0]);
return TCL_OK;
}
Expand Down

0 comments on commit fc7bd69

Please sign in to comment.