X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=epoc%2Fepocish.c;h=a8b95972d0e9edfd6f00d6d28c9be1e9253c5447;hb=c7254714b14d9ee5485ea0c63c897c9eb3c2c21e;hp=4963a2e5b555e942e28c982fad28d5ae9a281439;hpb=b250498faaf6fbd04315d2b632649596e2498c42;p=p5sagit%2Fp5-mst-13.2.git diff --git a/epoc/epocish.c b/epoc/epocish.c index 4963a2e5..a8b9597 100644 --- a/epoc/epocish.c +++ b/epoc/epocish.c @@ -9,39 +9,72 @@ /* This is C++ Code !! */ #include +#include +#include +#include extern "C" { +#if 1 +int epoc_spawn( char *cmd, char *cmdline) { RProcess p; TRequestStatus status; TInt rc; rc = p.Create( _L( cmd), _L( cmdline)); - if (rc != KErrNone) + if (rc != KErrNone) { return -1; + } p.Resume(); p.Logon( status); User::WaitForRequest( status); + p.Kill( 0); if (status!=KErrNone) { return -1; } return 0; } +#else +int +epoc_spawn( char *cmd, char *cmdline) { + int len = strlen(cmd) + strlen(cmdline) + 4; + char *n = (char *) malloc( len); + int r; + strcpy( n, cmd); + strcat( n, " "); + strcat( n, cmdline); + r = system( n); + free( n); + return r; +} +#endif +/* Workaround for defect strtoul(). Values with leading + are zero */ + +unsigned long int epoc_strtoul(const char *nptr, char **endptr, + int base) { + if (nptr && *nptr == '+') + nptr++; + return strtoul( nptr, endptr, base); +} - /* Workaround for defect atof(), see java defect list for epoc */ - double epoc_atof( const char* str) { +/* Workaround for defect atof(), see java defect list for epoc */ +double epoc_atof( char* str) { TReal64 aRes; + + while (TChar( *str).IsSpace()) { + str++; + } TLex lex( _L( str)); TInt err = lex.Val( aRes, TChar( '.')); return aRes; - } +} - void epoc_gcvt( double x, int digits, unsigned char *buf) { +void epoc_gcvt( double x, int digits, unsigned char *buf) { TRealFormat trel; trel.iPlaces = digits; @@ -53,3 +86,9 @@ epoc_spawn( char *cmd, char *cmdline) { result.Append( TChar( 0)); } } + +#if 0 +void epoc_spawn_posix_server() { + SpawnPosixServerThread(); +} +#endif