Source
// +-- manager-root (sets up xvfb if necessary, starts lowly_viewer, waits for lowly_viewer to exit or SIGTERM from root)
//# qtviewer.cc: main program for standalone Qt viewer
//# Copyright (C) 2005,2009,2010
//# Associated Universities, Inc. Washington DC, USA.
//#
//# 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., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id$
// (Configures pgplot for stand-alone Display Library apps).
/*
#include <graphics/X11/X_enter.h>
#include <QApplication>
#include <graphics/X11/X_exit.h>
*/
// for executable_path( )
// for executable_path( )
std::string read_link( const std::string &path ) {
int buffer_size = 128;
char *buffer = new char[buffer_size+1];
int nchars = readlink( path.c_str( ), buffer, buffer_size );
while ( nchars == buffer_size ) {
buffer_size *= 2;
delete [] buffer;
buffer = new char[buffer_size+1];
nchars = readlink( path.c_str( ), buffer, buffer_size );
}
std::string result;
if ( nchars > 0 ) {
buffer[nchars] = '\0';
char *exe = realpath(buffer,NULL);
result = exe;
free(exe);
}
delete [] buffer;