KDocTools

checkXML6.cpp
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2015-2016 Ralf Habacker <ralf.habacker@freenet.de>
4
5 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#include "loggingcategory.h"
9
10#include <QCoreApplication>
11#include <QProcess>
12#include <QStandardPaths>
13
14#include <stdio.h>
15
16int main(int argc, char **argv)
17{
18 QCoreApplication app(argc, argv);
19
20 const QStringList arguments = app.arguments();
21 if (arguments.count() != 2) {
22 qCCritical(KDocToolsLog) << "wrong argument count";
23 return (1);
24 }
25
26 const QString exec = QStandardPaths::findExecutable(QStringLiteral("meinproc6"));
27 if (exec.isEmpty()) {
28 qCCritical(KDocToolsLog) << "Could not find meinproc6 executable in PATH";
29 return 1;
30 }
31
32 QProcess meinproc;
33 meinproc.start(exec, QStringList{QStringLiteral("--check"), QStringLiteral("--stdout"), arguments[1]});
34 if (!meinproc.waitForStarted()) {
35 return -2;
36 }
37 if (!meinproc.waitForFinished()) {
38 return -1;
39 }
40 fprintf(stderr, "%s", meinproc.readAllStandardError().constData());
41 return meinproc.exitCode();
42}
const char * constData() const const
qsizetype count() const const
int exitCode() const const
QByteArray readAllStandardError()
void start(OpenMode mode)
bool waitForFinished(int msecs)
bool waitForStarted(int msecs)
QString findExecutable(const QString &executableName, const QStringList &paths)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:57:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.