summaryrefslogtreecommitdiff
path: root/core/apps/qcop
Unidiff
Diffstat (limited to 'core/apps/qcop') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/qcop/.cvsignore3
-rw-r--r--core/apps/qcop/Makefile.in102
-rw-r--r--core/apps/qcop/main.cpp85
-rw-r--r--core/apps/qcop/qcop.pro10
-rw-r--r--core/apps/qcop/qpe-qcop.control9
5 files changed, 209 insertions, 0 deletions
diff --git a/core/apps/qcop/.cvsignore b/core/apps/qcop/.cvsignore
new file mode 100644
index 0000000..edfa921
--- a/dev/null
+++ b/core/apps/qcop/.cvsignore
@@ -0,0 +1,3 @@
1moc_*
2*.moc
3Makefile
diff --git a/core/apps/qcop/Makefile.in b/core/apps/qcop/Makefile.in
new file mode 100644
index 0000000..0a12320
--- a/dev/null
+++ b/core/apps/qcop/Makefile.in
@@ -0,0 +1,102 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS)
9 INCPATH =-I$(QPEDIR)/include
10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = ../bin/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= qcop
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =
27 SOURCES =main.cpp
28 OBJECTS =main.o
29INTERFACES =
30UICDECLS =
31UICIMPLS =
32 SRCMOC =
33 OBJMOC =
34
35
36####### Implicit rules
37
38.SUFFIXES: .cpp .cxx .cc .C .c
39
40.cpp.o:
41 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
42
43.cxx.o:
44 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
45
46.cc.o:
47 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
48
49.C.o:
50 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
51
52.c.o:
53 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
54
55####### Build rules
56
57
58all: $(DESTDIR)$(TARGET)
59
60$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
61 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
62
63moc: $(SRCMOC)
64
65tmake:
66 tmake qcop.pro
67
68clean:
69 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
70 -rm -f *~ core
71 -rm -f allmoc.cpp
72
73####### Extension Modules
74
75listpromodules:
76 @echo
77
78listallmodules:
79 @echo
80
81listaddonpromodules:
82 @echo
83
84listaddonentmodules:
85 @echo
86
87
88REQUIRES=
89
90####### Sub-libraries
91
92
93###### Combined headers
94
95
96
97####### Compile
98
99main.o: main.cpp \
100 $(QPEDIR)/include/qpe/qcopenvelope_qws.h
101
102
diff --git a/core/apps/qcop/main.cpp b/core/apps/qcop/main.cpp
new file mode 100644
index 0000000..73db0f6
--- a/dev/null
+++ b/core/apps/qcop/main.cpp
@@ -0,0 +1,85 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qpe/qcopenvelope_qws.h>
22
23#include <qapplication.h>
24#include <qstringlist.h>
25#include <qdatastream.h>
26#include <qtimer.h>
27
28#include <stdlib.h>
29#include <stdio.h>
30
31static void usage()
32{
33 fprintf( stderr, "Usage: qcop channel command [parameters]\n" );
34}
35
36static void syntax( const QString &where, const QString &what )
37{
38 fprintf( stderr, "Syntax error in %s: %s\n", where.latin1(), what.latin1() );
39 exit(1);
40}
41
42int main( int argc, char *argv[] )
43{
44 QApplication app( argc, argv );
45
46 if ( argc < 3 ) {
47 usage();
48 exit(1);
49 }
50
51 QString channel = argv[1];
52 QString command = argv[2];
53 command.stripWhiteSpace();
54
55 int paren = command.find( "(" );
56 if ( paren <= 0 )
57 syntax( "command", command );
58
59 QString params = command.mid( paren + 1 );
60 if ( params[params.length()-1] != ')' )
61 syntax( "command", command );
62
63 params.truncate( params.length()-1 );
64 QCopEnvelope env(channel.latin1(), command.latin1());
65
66 int argIdx = 3;
67
68 QStringList paramList = QStringList::split( ",", params );
69 QStringList::Iterator it;
70 for ( it = paramList.begin(); it != paramList.end(); ++it ) {
71 QString arg = argv[argIdx];
72 if ( *it == "QString" ) {
73 env << arg;
74 } else if ( *it == "int" ) {
75 env << arg.toInt();
76 } else {
77 syntax( "paramter type", *it );
78 }
79 argIdx++;
80 }
81
82 QTimer::singleShot( 0, &app, SLOT(quit()) );
83 return app.exec();
84}
85
diff --git a/core/apps/qcop/qcop.pro b/core/apps/qcop/qcop.pro
new file mode 100644
index 0000000..b52bfd8
--- a/dev/null
+++ b/core/apps/qcop/qcop.pro
@@ -0,0 +1,10 @@
1 TEMPLATE= app
2 CONFIG = qt warn_on release
3 DESTDIR = ../bin
4 HEADERS =
5 SOURCES = main.cpp
6INCLUDEPATH += $(QPEDIR)/include
7 DEPENDPATH+= $(QPEDIR)/include
8LIBS += -lqpe
9 INTERFACES=
10 TARGET = qcop
diff --git a/core/apps/qcop/qpe-qcop.control b/core/apps/qcop/qpe-qcop.control
new file mode 100644
index 0000000..60107c4
--- a/dev/null
+++ b/core/apps/qcop/qpe-qcop.control
@@ -0,0 +1,9 @@
1Files: bin/qcop
2Priority: required
3Section: qpe/system
4Maintainer: Martin Jones <mjones@trolltech.com>
5Architecture: arm
6Version: $QPE_VERSION-3
7Depends: qt-embedded (>=$QTE_VERSION)
8Description: Interprocess communication client
9 Interprocess communication client for the Qtopia environment.