fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / kde3support / tests / k3prociotest.cpp
blob57f1c411a781be66bc18c64b5f0dcbdf933c5247
1 //
2 // MAIN -- a little demo of the capabilities of the "K3Process" class
3 //
4 // version 0.2, Aug 2nd 1997
5 //
6 // Copyright 1997 Christian Czezatke <e9025461@student.tuwien.ac.at>
7 //
10 #include "k3process.h"
12 #include <stdio.h>
13 #include <string.h>
14 #include <kaboutdata.h>
15 #include <kcmdlineargs.h>
16 #include <kcomponentdata.h>
17 #include <QtCore/QCoreApplication>
19 #include <signal.h>
21 #include "k3prociotest.h"
26 // A nice input for "sort"... ;- )
28 static const char txt[] = "hat\nder\nalte\nhexenmeister\nsich\ndoch\neinmal\nwegbegeben\n\
29 und\nnun\nsollen\nseine\ngeister\nsich\nnach\nmeinem\nwillen\nregen\nseine\nwort\nund\n\
30 werke\nmerkt\nich\nund\nden\nbrauch\nund\nmit\ngeistesstaerke\ntu\nich\nwunder\nauch\n";
33 int main(int argc, char *argv[])
35 Dummy dummy;
37 KAboutData about("kprociotest", 0, ki18n("kprociotest"), "version");
38 //KCmdLineArgs::init(argc, argv, &about);
39 KComponentData cData(&about);
41 QCoreApplication app(argc, argv);
43 printf("Welcome to the K3ProcIO Demo Application!\n");
46 K3ProcIO p;
48 p << "rev";
50 p.connect(&p, SIGNAL(processExited(K3Process*)), &dummy, SLOT(printMessage(K3Process*)));
51 p.connect(&p, SIGNAL(readReady(K3ProcIO*)), &dummy, SLOT(gotOutput(K3ProcIO*)));
53 bool b;
55 b = p.start();
56 printf("Start returns %s\n", b ? "true" : "false");
58 b = p.writeStdin(QString("Hello World!"));
59 printf("writeStdin returns %s\n", b ? "true" : "false");
61 b = p.writeStdin(QString("This is a test. It should come out in reverse (esrever)"));
62 printf("writeStdin returns %s\n", b ? "true" : "false");
64 p.closeWhenDone();
66 printf("Entering man Qt event loop -- press <CTRL><C> to abort\n");
67 return app.exec();
69 #include "k3prociotest.moc"