Commit 1a58a503 authored by Jonathan Marten's avatar Jonathan Marten
Browse files

man: Tidy up 'sgml2roff' definitions and locating

Not sure whether this will ever be used, though - do any
current systems apart from Solaris have SGML man pages?
parent 5ee42d9a
Pipeline #76543 failed with stage
in 2 minutes and 11 seconds
......@@ -46,7 +46,9 @@ class KIOPluginForMetaData : public QObject
MANProtocol *MANProtocol::_self = nullptr;
#define SGML2ROFF_DIRS "/usr/lib/sgml"
static const char *SGML2ROFF_DIRS = "/usr/lib/sgml";
static const char *SGML2ROFF_EXECUTABLE = "sgml2roff";
* Drop trailing ".section[.gz]" from name
......@@ -552,7 +554,7 @@ char *MANProtocol::readManPage(const char *_filename)
QProcess proc;
// Determine path to sgml2roff, if not already done.
if (!getProgramPath()) return nullptr;
proc.setArguments(QStringList() << filename);
proc.setProcessChannelMode( QProcess::ForwardedErrorChannel );
......@@ -1400,25 +1402,25 @@ void MANProtocol::listDir(const QUrl &url)
void MANProtocol::getProgramPath()
bool MANProtocol::getProgramPath()
if (!mySgml2RoffPath.isEmpty())
return true;
mySgml2RoffPath = QStandardPaths::findExecutable("sgml2roff");
mySgml2RoffPath = QStandardPaths::findExecutable(SGML2ROFF_EXECUTABLE);
if (!mySgml2RoffPath.isEmpty())
return true;
/* sgml2roff isn't found in PATH. Check some possible locations where it may be found. */
mySgml2RoffPath = QStandardPaths::findExecutable("sgml2roff", QStringList(QLatin1String(SGML2ROFF_DIRS)));
mySgml2RoffPath = QStandardPaths::findExecutable(SGML2ROFF_EXECUTABLE, QStringList(QLatin1String(SGML2ROFF_DIRS)));
if (!mySgml2RoffPath.isEmpty())
return true;
/* Cannot find sgml2roff program: */
outputError(xi18nc("@info", "Could not find the <command>sgml2roff</command> program on your system. "
outputError(xi18nc("@info", "Could not find the <command>%1</command> program on your system. "
"Please install it if necessary, and ensure that it can be found using "
"the environment variable <envar>PATH</envar>."));
"the environment variable <envar>PATH</envar>.", SGML2ROFF_EXECUTABLE));
return false;
#include "kio_man.moc"
......@@ -66,7 +66,7 @@ private:
QStringList section_names;
QString mySgml2RoffPath;
void getProgramPath();
bool getProgramPath();
QBuffer m_outputBuffer; ///< Buffer for the output
QByteArray m_manCSSFile; ///< Path to kio_man.css
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment