From ad0b84ba1cba85e7dfb0fb12fedfde8d45b068dc Mon Sep 17 00:00:00 2001 From: mickeyl Date: Thu, 03 Jun 2004 12:02:43 +0000 Subject: add the python quicklaunch launcher --- (limited to 'noncore') 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 @@ +*.moc +Makefile* +moc_* +.moc +.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 @@ + config PYQUICKLAUNCHER + boolean "python-quicklauncher (quicklaunch python scripts)" + default "n" + + 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 @@ +/********************************************************************** +** Copyright (C) 2004 Michael 'Mickey' Lauer +** All rights reserved. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +/* STD */ +#include +#include +#include +#include +#include +#include +#include + +int main( int argc, char** argv ) +{ + printf( "\nPyQuicklaunch Launcher (numargs=%d, arg[0]='%s', arg[1]='%s')\n", argc, argv[0], argv[1] ); + + char fifoName[1024]; + sprintf( &fifoName[0], "/tmp/mickeys-quicklauncher-%s", ::getpwuid( ::getuid() )->pw_name ); + + + int fd = open( &fifoName[0], O_WRONLY | O_NONBLOCK ); + if ( fd == -1 ) + { + perror( "Can't open fifo" ); + return -1; + } + + char wdPath[1024]; + getcwd( &wdPath[0], sizeof( wdPath ) ); + + char scriptPath[1024]; + if ( argv[1][0] == '/' ) + { + strcpy( &scriptPath[0], argv[1] ); + } + else + { + sprintf( &scriptPath[0], "%s/%s", wdPath, argv[1] ); + } + + printf( "\nInstructing the Quicklauncher to launch '%s'...", &scriptPath[0] ); + + int res = write( fd, scriptPath, strlen( scriptPath ) ); + if ( res < 1 ) + { + perror( "Can't write string to fifo" ); + return -1; + } + + close( fd ); + + return 0; +} 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 @@ +TEMPLATE = app +CONFIG += console warn_on +CONFIG -= qt +DESTDIR = $(OPIEDIR)/bin +SOURCES = main.cpp +TARGET = pyquicklauncher + + +include ( $(OPIEDIR)/include.pro ) -- cgit v0.9.0.2