Git commit d456572c4178390a1f539e4923023ec331d2cde3 by Aaron Seigo. Committed on 28/12/2015 at 20:59. Pushed by aseigo into branch 'develop'. consistency (and avoids warnings on redirect input) M +17 -13 akonadish/main.cpp http://commits.kde.org/akonadi-next/d456572c4178390a1f539e4923023ec331d2cde3 diff --git a/akonadish/main.cpp b/akonadish/main.cpp index 45bd5ea..f3cbcac 100644 --- a/akonadish/main.cpp +++ b/akonadish/main.cpp @@ -48,7 +48,8 @@ int main(int argc, char *argv[]) //qDebug() << "state at startup is" << interactive << startRepl << sta= rtJsonListener << fromScript; = QCoreApplication app(argc, argv); - app.setApplicationName(argv[0]); + app.setApplicationName(fromScript ? "interactive-app-shell" : argv[0]); + //app.setApplicationName(argv[0]); = if (startRepl || startJsonListener) { if (startRepl) { @@ -71,26 +72,29 @@ int main(int argc, char *argv[]) return 1; } = - QString line =3D f.readLine().trimmed(); + QString line =3D f.readLine(); while (!line.isEmpty()) { - if (line.isEmpty() || line.startsWith('#')) { - line =3D f.readLine().trimmed(); - continue; + line =3D line.trimmed(); + + if (!line.isEmpty() && !line.startsWith('#')) { + SyntaxTree::self()->run(SyntaxTree::tokenize(line)); } - SyntaxTree::self()->run(SyntaxTree::tokenize(line)); - line =3D f.readLine().trimmed(); + + line =3D f.readLine(); } exit(0); } else if (!interactive) { QTextStream inputStream(stdin); - while (true) { - const QString input =3D inputStream.readLine(); - if (input.isEmpty()) { - ::exit(0); + + QString line =3D inputStream.readLine(); + while (!line.isEmpty()) { + line =3D line.trimmed(); + + if (!line.isEmpty() && !line.startsWith('#')) { + SyntaxTree::self()->run(SyntaxTree::tokenize(line)); } = - const QStringList commands =3D SyntaxTree::tokenize(input); - SyntaxTree::self()->run(commands); + line =3D inputStream.readLine(); } } else { QStringList commands =3D app.arguments();