-rw-r--r-- | example/Example.png | bin | 1262 -> 0 bytes | |||
-rw-r--r-- | example/README | 2 | ||||
-rw-r--r-- | example/example.control | 12 | ||||
-rw-r--r-- | example/example.cpp | 28 | ||||
-rw-r--r-- | example/example.desktop | 10 | ||||
-rw-r--r-- | example/example.h | 17 | ||||
-rw-r--r-- | example/example.pro | 32 | ||||
-rw-r--r-- | example/examplebase.ui | 55 | ||||
-rw-r--r-- | example/main.cpp | 12 | ||||
-rw-r--r-- | quickexec/config.in | 4 | ||||
-rw-r--r-- | quickexec/johns/README | 21 | ||||
-rw-r--r-- | quickexec/johns/library.lst | 2 | ||||
-rw-r--r-- | quickexec/johns/qinit_srv.c | 242 | ||||
-rw-r--r-- | quickexec/johns/so_stub.c | 23 | ||||
-rw-r--r-- | quickexec/opie-quickexec.control | 12 | ||||
-rw-r--r-- | quickexec/quickexec.cpp | 98 | ||||
-rw-r--r-- | quickexec/quickexec.pro | 29 |
17 files changed, 0 insertions, 599 deletions
diff --git a/example/Example.png b/example/Example.png Binary files differdeleted file mode 100644 index f63d0bc..0000000 --- a/example/Example.png +++ b/dev/null diff --git a/example/README b/example/README deleted file mode 100644 index 98c2c51..0000000 --- a/example/README +++ b/dev/null @@ -1,2 +0,0 @@ -See /opt/Qtopia/doc/html/qtopia/index.html for help. -See doc.trolltech.com for more recent documentation updates. diff --git a/example/example.control b/example/example.control deleted file mode 100644 index 08c5a5d..0000000 --- a/example/example.control +++ b/dev/null @@ -1,12 +0,0 @@ -Package: example -Files: bin/example apps/Applications/example.desktop pics/example.png -Priority: optional -Section: opie/applications -Maintainer: Warwick Allison <warwick@trolltech.com> -Architecture: arm -Version: 1.0.0 -Depends: qpe-base -License: Public Domain -Description: Example program - An example program for the Opie environment. - Does nothing interesting. diff --git a/example/example.cpp b/example/example.cpp deleted file mode 100644 index 1e0bbe9..0000000 --- a/example/example.cpp +++ b/dev/null @@ -1,28 +0,0 @@ -#include "example.h" -#include <qpushbutton.h> - -/* - * Constructs a Example which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - */ -Example::Example( QWidget* parent, const char* name, WFlags fl ) - : ExampleBase( parent, name, fl ) -{ - connect(quit, SIGNAL(clicked()), this, SLOT(goodBye())); -} - -/* - * Destroys the object and frees any allocated resources - */ -Example::~Example() -{ - // no need to delete child widgets, Qt does it all for us -} - -/* - * A simple slot... not very interesting. - */ -void Example::goodBye() -{ - close(); -} diff --git a/example/example.desktop b/example/example.desktop deleted file mode 100644 index c86fd81..0000000 --- a/example/example.desktop +++ b/dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Exec=example -Icon=Example -Type=Application -Name=Example -Comment=An Example Program -Name[pt]=Exemplo -Comment[pt]=Um programa de exemplo -Name[pt_BR]=Exemplo -Comment[pt_BR]=Um programa de exemplo diff --git a/example/example.h b/example/example.h deleted file mode 100644 index 24c58c0..0000000 --- a/example/example.h +++ b/dev/null @@ -1,17 +0,0 @@ -#ifndef EXAMPLE_H -#define EXAMPLE_H -#include "examplebase.h" - -class Example : public ExampleBase -{ - Q_OBJECT - -public: - Example( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - ~Example(); - -private slots: - void goodBye(); -}; - -#endif // EXAMPLE_H diff --git a/example/example.pro b/example/example.pro deleted file mode 100644 index dea78cf..0000000 --- a/example/example.pro +++ b/dev/null @@ -1,32 +0,0 @@ -TEMPLATE = app -#CONFIG = qt warn_on debug -CONFIG = qt warn_on release -HEADERS = example.h -SOURCES = main.cpp example.cpp -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -INTERFACES = examplebase.ui -TARGET = example - -TRANSLATIONS = ../i18n/de/example.ts \ - ../i18n/nl/example.ts \ - ../i18n/da/example.ts \ - ../i18n/xx/example.ts \ - ../i18n/en/example.ts \ - ../i18n/es/example.ts \ - ../i18n/fr/example.ts \ - ../i18n/hu/example.ts \ - ../i18n/ja/example.ts \ - ../i18n/ko/example.ts \ - ../i18n/no/example.ts \ - ../i18n/pl/example.ts \ - ../i18n/pt/example.ts \ - ../i18n/pt_BR/example.ts \ - ../i18n/sl/example.ts \ - ../i18n/zh_CN/example.ts \ - ../i18n/zh_TW/example.ts - - - -include ( $(OPIEDIR)/include.pro ) diff --git a/example/examplebase.ui b/example/examplebase.ui deleted file mode 100644 index b47d20c..0000000 --- a/example/examplebase.ui +++ b/dev/null @@ -1,55 +0,0 @@ -<!DOCTYPE UI><UI> -<class>ExampleBase</class> -<widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>ExampleBase</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>196</width> - <height>245</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Example</string> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string><p>This is just an <i>example</i>. It doesn't do anything interesting at all.</string> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>quit</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Quit</string> - </property> - </widget> - </vbox> -</widget> -</UI> diff --git a/example/main.cpp b/example/main.cpp deleted file mode 100644 index b705c44..0000000 --- a/example/main.cpp +++ b/dev/null @@ -1,12 +0,0 @@ -#include "example.h" -#include <qpe/qpeapplication.h> - -int main( int argc, char ** argv ) -{ - QPEApplication a( argc, argv ); - - Example mw; - a.showMainWidget( &mw ); - - return a.exec(); -} diff --git a/quickexec/config.in b/quickexec/config.in deleted file mode 100644 index 57eac96..0000000 --- a/quickexec/config.in +++ b/dev/null @@ -1,4 +0,0 @@ -# config #QUICKEXEC -# boolean "quickexec" -# default "y" -# depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE diff --git a/quickexec/johns/README b/quickexec/johns/README deleted file mode 100644 index 1af84dc..0000000 --- a/quickexec/johns/README +++ b/dev/null @@ -1,21 +0,0 @@ - -Compile qinit_srv.c to qinit_srv as usual -Compile your applications at shared libraries instead of as executables: - eg: gcc test.c -o test.so -shared -Make a symbolic link from qinit_srv to the name of the application: - eg: ln -s qinit_srv test -Now make sure 'test' (The symlink) and 'test.so' (the shared library version of the app) are together. -When you run ./test it will load test.so and run it just like you were running the application for real. -There will be a qinit_srv process created the first time you run a program this way. - -How it works: - -qinit_srv checks to see if there is already a server, if not it starts as a server which runs in the background as a deamon. -If it's a server it loads all the libraries listed in the library.lst file. -It then waits for signals to be sent to it which tell it to fork itself and load shared libraries and run them. -If it decides it's not the server, it sends a signal to the server to run the given command. -The server then executes a shared object file of whatever name the original process is invoked as (argv[0], the symlink trick) -The other process waits until the forked server finishes and signals the original process that it as finished and to return - - - diff --git a/quickexec/johns/library.lst b/quickexec/johns/library.lst deleted file mode 100644 index 42f310b..0000000 --- a/quickexec/johns/library.lst +++ b/dev/null @@ -1,2 +0,0 @@ -libqte.so -libqpe.so diff --git a/quickexec/johns/qinit_srv.c b/quickexec/johns/qinit_srv.c deleted file mode 100644 index 03c6cd3..0000000 --- a/quickexec/johns/qinit_srv.c +++ b/dev/null @@ -1,242 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <signal.h> -#include <unistd.h> -#include <dlfcn.h> - - -#define PID_FILE "/tmp/qinit1.pid" -#define CMD_FILE "/tmp/qinit1.cmd" -#define RET_FILE "/tmp/qinit1.ret" - - -static int librariesFinishedLoading = 0; -static void **handles = NULL; -static int handleCount = 0; - - -static void savePid( void ); -static int loadPid( void ); -void saveRetVal( int retVal ); -int loadRetVal( void ); -static void saveCmd( int callingPid, int argc, char *argv[] ); -static int execCmd( void ); -static void loadLibraries( char *listFile ); -static void signalHandler( int signal ); -static void finishedHandler( int signal ); -static void cleanUpHandler( int signal ); -static void cleanUp( void ); - - -int main( int argc, char *argv[] ) { - FILE *fh; - - // See if there is already a server running - if ( ( fh = fopen( PID_FILE, "r" ) ) != NULL ) { - // There appears to already be a server running - fclose( fh ); - // Install handler that tells us when the process created by the server has finished - signal( SIGUSR2, finishedHandler ); - // Send our command to the server (saved to a file) - saveCmd( getpid(), argc, argv ); - // Send a signal to the server to run our command - kill( loadPid(), SIGUSR1 ); - // Wait for the process created by the server to terminate - for (;;) - sleep( 1 ); // Will eventually terminate when the SIGUSER2 signal is sent to us by the server - } - - // Send the server to the background - daemon( 1, 1 ); - - // Save the process number of this process somewhere (in a file) - savePid(); - - // Wait for signal used to let us know when to fork to run commands - signal( SIGUSR1, signalHandler ); - signal( SIGTERM, cleanUpHandler ); - signal( SIGINT, cleanUpHandler ); - signal( SIGABRT, cleanUpHandler ); - signal( SIGQUIT, cleanUpHandler ); - - // Iterate library list file and dynamically load at runtime - // the library files from the list - if ( argc > 1 ) - loadLibraries( argv[1] ); // Use a library list file specified from command line - else - loadLibraries( "library.lst" ); // Use the default library list file - - // Run the given command - signalHandler( SIGUSR1 ); - - // Keep waiting for signals infinitely that tell us to fork - for (;;) - wait( NULL ); // Wait for child processes to die or signals to be sent to us - - cleanUp(); - - return 0; -} - - -void cleanUp( void ) { - int i; - - // Close the shared libraries we opened - for ( i = 0; i < handleCount; i++ ) - dlclose( handles[ i ] ); - free( handles ); - - // Unlink the PID_FILE file - remove( PID_FILE ); -} - - -void savePid( void ) { - int pid = getpid(); - FILE *fh = fopen( PID_FILE, "w"); - if ( !fh ) - fputs("error writing pid to file " PID_FILE, stderr), exit(1); - fprintf( fh, "%i", pid ); - fclose( fh ); -} - - -int loadPid( void ) { - int pid; - FILE *fh = fopen( PID_FILE, "r" ); - if ( !fh ) - fputs("error loading pid from file " PID_FILE, stderr), exit(1); - fscanf( fh, "%i", &pid ); - fclose( fh ); - return pid; -} - - -void saveRetVal( int retVal ) { - FILE *fh = fopen( RET_FILE, "w"); - if ( !fh ) - fputs("error writing retVal to file " RET_FILE, stderr), exit(1); - fprintf( fh, "%i", retVal ); - fclose( fh ); -} - - -int loadRetVal( void ) { - int retVal; - FILE *fh = fopen( RET_FILE, "r" ); - if ( !fh ) - fputs("error loading retVal from file " RET_FILE, stderr), exit(1); - fscanf( fh, "%i", &retVal ); - fclose( fh ); - return retVal; -} - - -void saveCmd( int callingPid, int argc, char *argv[] ) { - int i; - FILE *fh = fopen( CMD_FILE, "w" ); - if ( !fh ) - fputs("error saving arg list to file " CMD_FILE, stderr), exit(1); - fprintf( fh, "%i\n", callingPid ); - fprintf( fh, "%s.so", argv[0] ); - for ( i = 0; i < argc; i++ ) - fprintf( fh, "\n%s", argv[i] ); - fclose( fh ); -} - - -int execCmd( void ) { - int callingPid; - char sharedObject[128]; - int argc; - char argv[128][128]; - int (*childMain)( int argc, char *argv[] ); - char *error; - void *handle; - int retVal = 0; - - // Get the name of the file to dlopen and the arguments to pass (from a file) - FILE *fh = fopen( CMD_FILE, "r" ); - fscanf( fh, "%i\n", &callingPid ); - fgets( sharedObject, 128, fh ); - sharedObject[strlen( sharedObject ) - 1] = '\0'; - for ( argc = 0; fgets( argv[argc], 128, fh ); argc++) - argv[argc][strlen( argv[argc] ) - 1] = '\0'; - fclose( fh ); - - // Open the shared object of what we want to execute - handle = dlopen( sharedObject, RTLD_LAZY ); - if ( !handle ) - fputs( dlerror(), stderr ), kill( callingPid, SIGUSR2 ), exit( 1 ); - - // Find main symbol and jump to it - childMain = dlsym( handle, "main" ); - if ( ( error = dlerror() ) != NULL ) - fputs( error, stderr ), kill( callingPid, SIGUSR2 ), exit( 1 ); - retVal = (*childMain)( argc, (char**)argv ); - - // Notify caller that we have finished - saveRetVal( retVal ); - kill( callingPid, SIGUSR2 ); - - // When we are done, close the shared object - dlclose( handle ); - return retVal; -} - - -void finishedHandler( int signal ) { - // We have been notified of the completion of the task - exit( loadRetVal() ); -} - - -void cleanUpHandler( int signal ) { - // Cleanup and exit if we have been told to quit - cleanUp(); - exit(1); -} - - -void signalHandler( int signal ) { - //printf("got a signal of %i\n", signal ); - - if ( fork() == 0 ) { - // We are the child process - -/* - while ( librariesFinishedLoading != 1 ) { - printf("waiting for libraries to load\n"); - sleep(1); - } -*/ - // Close file handles and open others etc - - // Execute the command and return when done - exit( execCmd() ); - } - - // Parent process, just continue - sleep( 1 ); // Need to yield to child process -} - - -void loadLibraries( char *listFile ) { - FILE *fh = fopen( listFile, "r" ); - char line[1024]; - if ( !fh ) - fputs("error opening library list file", stderr), exit(1); - while ( fgets( line, 1024, fh ) ) { - line[strlen( line ) - 1] = '\0'; - printf("loading library: --%s--\n", line); - handleCount++; - handles = realloc( handles, handleCount * sizeof( void * ) ); - handles[ handleCount - 1 ] = dlopen( line, RTLD_NOW ); - if ( !handles[ handleCount - 1 ] ) - fputs( dlerror(), stderr ), exit( 1 ); - } - fclose( fh ); - librariesFinishedLoading = 1; -} - diff --git a/quickexec/johns/so_stub.c b/quickexec/johns/so_stub.c deleted file mode 100644 index fe71f9c..0000000 --- a/quickexec/johns/so_stub.c +++ b/dev/null @@ -1,23 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <dlfcn.h> - - -int main( int argc, char *argv[] ) { - char module[1024]; - int (*loadedMain)( int argc, char *argv[] ); - char *error; - int retVal = 0; - void *handle; - strcpy( module, argv[0] ); - strcat( module, ".so" ); - if ( !(handle = dlopen( module, RTLD_LAZY ) ) ) - fputs( dlerror(), stderr ), exit( 1 ); - loadedMain = dlsym( handle, "main" ); - if ( ( error = dlerror() ) != NULL ) - fputs( error, stderr ), exit( 1 ); - retVal = (*loadedMain)( argc, argv ); - dlclose( handle ); - return retVal; -} - diff --git a/quickexec/opie-quickexec.control b/quickexec/opie-quickexec.control deleted file mode 100644 index 118a4da..0000000 --- a/quickexec/opie-quickexec.control +++ b/dev/null @@ -1,12 +0,0 @@ -Package: opie-quickexec -Files: bin/quickexec -Priority: required -Section: opie/applications -Maintainer: Warwick Allison <warwick@trolltech.com> -Architecture: arm -Arch: iPAQ -Version: $QPE_VERSION-$SUB_VERSION -Depends: task-opie-minimal -Description: Calculator - A multi-function calculator for the Opie environment. - Includes units conversion. diff --git a/quickexec/quickexec.cpp b/quickexec/quickexec.cpp deleted file mode 100644 index 772ab4c..0000000 --- a/quickexec/quickexec.cpp +++ b/dev/null @@ -1,98 +0,0 @@ -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> -#include <dlfcn.h> - -#define QUICKEXEC "/tmp/.quickexec" - -#include <signal.h> -#include <sys/wait.h> - -void sigchildhandler(int) { - wait(0); -} - -int exec( const char *lib, int argc, char** argv ) -{ - setpgid(0,0); -// printf("loadlib %s, argc=%d\n", lib, argc ); - void *handle = dlopen ( lib, RTLD_LAZY); - if (!handle) { - fprintf( stderr, "%s\n", dlerror()); - exit(1); - } - typedef int (*Mainfunc)(int, char**); - Mainfunc mainfunc; - mainfunc = (Mainfunc) dlsym(handle, "main"); - char *error; - if ((error = dlerror()) != NULL) { - fprintf (stderr, "%s\n", error); - exit(1); - } - (*mainfunc)(argc,argv); - return 0; -} - -#define BUFFER_SIZE 1024 -int main( int argc, char** argv ) -{ - signal( SIGCHLD, sigchildhandler ); - (void) unlink( QUICKEXEC ); - if ( mkfifo( QUICKEXEC, S_IFIFO | S_IWUSR | S_IRUSR ) == -1 ) { - perror( QUICKEXEC ); - exit(1); - } - - if ( argc > 1 && fork() == 0 ) - return exec( argv[1], argc-2, argc > 2 ? argv+2 : 0 ); - - char buf[BUFFER_SIZE]; - int p = 0; - int r; - int fd = open( QUICKEXEC, O_RDONLY ); - if ( fd == -1 ) { - perror( QUICKEXEC ); - exit(1); - } - for ( ;; ) { - r = read( fd, buf+p, BUFFER_SIZE-p ); - p += r; - if ( r == 0 || p >= BUFFER_SIZE - 1 ) { - buf[p] = '\0'; - close ( fd ); - if ( fork() == 0 ) { - int argc = -1; - int i = 0; - int k = 0; - for ( i = 0; i <= p; i++ ) - if ( buf[i] == '\0' ) - argc++; - char** argv = new char*[argc]; - for ( i = 0; i < p; i++ ) { - if ( buf[i] == '\0' ) - argv[k++]=buf+i+1; - } - return exec( buf, argc, argv ); - } - p = 0; - fd = open( QUICKEXEC, O_RDONLY ); - } - } - return 0; -} - - - - - - - - - - - - - - diff --git a/quickexec/quickexec.pro b/quickexec/quickexec.pro deleted file mode 100644 index 73b54d1..0000000 --- a/quickexec/quickexec.pro +++ b/dev/null @@ -1,29 +0,0 @@ -TEMPLATE = app -CONFIG = qt warn_on release -DESTDIR = $(OPIEDIR)/bin -HEADERS = -SOURCES = quickexec.cpp -LIBS += -ldl -lqpe -TARGET = quickexec - -TRANSLATIONS = ../i18n/de/quickexec.ts \ - ../i18n/nl/quickexec.ts \ - ../i18n/da/quickexec.ts \ - ../i18n/xx/quickexec.ts \ - ../i18n/en/quickexec.ts \ - ../i18n/es/quickexec.ts \ - ../i18n/fr/quickexec.ts \ - ../i18n/hu/quickexec.ts \ - ../i18n/ja/quickexec.ts \ - ../i18n/ko/quickexec.ts \ - ../i18n/no/quickexec.ts \ - ../i18n/pl/quickexec.ts \ - ../i18n/pt/quickexec.ts \ - ../i18n/pt_BR/quickexec.ts \ - ../i18n/sl/quickexec.ts \ - ../i18n/zh_CN/quickexec.ts \ - ../i18n/zh_TW/quickexec.ts - - - -include ( $(OPIEDIR)/include.pro ) |