summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-06-03 12:02:43 (UTC)
committer mickeyl <mickeyl>2004-06-03 12:02:43 (UTC)
commitad0b84ba1cba85e7dfb0fb12fedfde8d45b068dc (patch) (unidiff)
tree13abdbcb868717f82e668646a05c788c5f1e61cb
parent9499e1d1b46c1b5e0e6f8ce94aea4d8bd67f8f90 (diff)
downloadopie-ad0b84ba1cba85e7dfb0fb12fedfde8d45b068dc.zip
opie-ad0b84ba1cba85e7dfb0fb12fedfde8d45b068dc.tar.gz
opie-ad0b84ba1cba85e7dfb0fb12fedfde8d45b068dc.tar.bz2
add the python quicklaunch launcher
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/pyquicklauncher/.cvsignore5
-rw-r--r--noncore/tools/pyquicklauncher/config.in5
-rw-r--r--noncore/tools/pyquicklauncher/main.cpp64
-rw-r--r--noncore/tools/pyquicklauncher/pyquicklauncher.pro9
4 files changed, 83 insertions, 0 deletions
diff --git a/noncore/tools/pyquicklauncher/.cvsignore b/noncore/tools/pyquicklauncher/.cvsignore
new file mode 100644
index 0000000..37c45ac
--- a/dev/null
+++ b/noncore/tools/pyquicklauncher/.cvsignore
@@ -0,0 +1,5 @@
1*.moc
2Makefile*
3moc_*
4.moc
5.obj
diff --git a/noncore/tools/pyquicklauncher/config.in b/noncore/tools/pyquicklauncher/config.in
new file mode 100644
index 0000000..528e7e8
--- a/dev/null
+++ b/noncore/tools/pyquicklauncher/config.in
@@ -0,0 +1,5 @@
1 config PYQUICKLAUNCHER
2 boolean "python-quicklauncher (quicklaunch python scripts)"
3 default "n"
4
5
diff --git a/noncore/tools/pyquicklauncher/main.cpp b/noncore/tools/pyquicklauncher/main.cpp
new file mode 100644
index 0000000..30fbd0a
--- a/dev/null
+++ b/noncore/tools/pyquicklauncher/main.cpp
@@ -0,0 +1,64 @@
1/**********************************************************************
2** Copyright (C) 2004 Michael 'Mickey' Lauer <mickey@vanille.de>
3** All rights reserved.
4**
5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13**********************************************************************/
14
15/* STD */
16#include <pwd.h>
17#include <sys/types.h>
18#include <fcntl.h>
19#include <unistd.h>
20#include <stdio.h>
21#include <string.h>
22#include <errno.h>
23
24int main( int argc, char** argv )
25{
26 printf( "\nPyQuicklaunch Launcher (numargs=%d, arg[0]='%s', arg[1]='%s')\n", argc, argv[0], argv[1] );
27
28 char fifoName[1024];
29 sprintf( &fifoName[0], "/tmp/mickeys-quicklauncher-%s", ::getpwuid( ::getuid() )->pw_name );
30
31
32 int fd = open( &fifoName[0], O_WRONLY | O_NONBLOCK );
33 if ( fd == -1 )
34 {
35 perror( "Can't open fifo" );
36 return -1;
37 }
38
39 char wdPath[1024];
40 getcwd( &wdPath[0], sizeof( wdPath ) );
41
42 char scriptPath[1024];
43 if ( argv[1][0] == '/' )
44 {
45 strcpy( &scriptPath[0], argv[1] );
46 }
47 else
48 {
49 sprintf( &scriptPath[0], "%s/%s", wdPath, argv[1] );
50 }
51
52 printf( "\nInstructing the Quicklauncher to launch '%s'...", &scriptPath[0] );
53
54 int res = write( fd, scriptPath, strlen( scriptPath ) );
55 if ( res < 1 )
56 {
57 perror( "Can't write string to fifo" );
58 return -1;
59 }
60
61 close( fd );
62
63 return 0;
64}
diff --git a/noncore/tools/pyquicklauncher/pyquicklauncher.pro b/noncore/tools/pyquicklauncher/pyquicklauncher.pro
new file mode 100644
index 0000000..93e996c
--- a/dev/null
+++ b/noncore/tools/pyquicklauncher/pyquicklauncher.pro
@@ -0,0 +1,9 @@
1 TEMPLATE= app
2 CONFIG += console warn_on
3 CONFIG -= qt
4 DESTDIR = $(OPIEDIR)/bin
5 SOURCES = main.cpp
6 TARGET = pyquicklauncher
7
8
9include ( $(OPIEDIR)/include.pro )