From 6aba21cfe796603ba6199e38a1d6014099957b27 Mon Sep 17 00:00:00 2001 From: skeezix Date: Fri, 26 Feb 2010 21:13:43 -0500 Subject: [PATCH] Added definition of 'affirmative' for bools in PXML Added cpu-speed setting for app-exec and .desktop->Exec --- include/pnd_pxml.h | 1 + lib/pnd_apps.c | 8 +++++++- lib/pnd_desktop.c | 8 +++++++- lib/pnd_pxml.c | 16 ++++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/include/pnd_pxml.h b/include/pnd_pxml.h index a9733fd..01e32d5 100644 --- a/include/pnd_pxml.h +++ b/include/pnd_pxml.h @@ -91,6 +91,7 @@ void pnd_pxml_set_app_name ( pnd_pxml_handle h, char *v ); /* utilities */ unsigned char pnd_is_pxml_valid_app ( pnd_pxml_handle h ); // returns 1 when pxml seems like a valid application +unsigned char pnd_pxml_is_affirmative ( char *v ); // return 1 for 'Y' or '!' typedef struct { diff --git a/lib/pnd_apps.c b/lib/pnd_apps.c index 72a251d..63f1450 100644 --- a/lib/pnd_apps.c +++ b/lib/pnd_apps.c @@ -15,7 +15,8 @@ unsigned char pnd_apps_exec ( char *pndrun, char *fullpath, char *unique_id, char *rel_exec, char *rel_startdir, unsigned int clockspeed, unsigned int options ) { - char *argv [ 20 ]; + char *argv [ 60 ]; + char s_clockspeed [ 100 ]; int f; //printf ( "Entering pnd_apps_exec\n" ); @@ -59,6 +60,11 @@ unsigned char pnd_apps_exec ( char *pndrun, char *fullpath, char *unique_id, } argv [ f++ ] = "-b"; argv [ f++ ] = unique_id; + if ( clockspeed ) { + argv [ f++ ] = "-c"; + snprintf ( s_clockspeed, 100, "%u", clockspeed ); + argv [ f++ ] = s_clockspeed; + } // skip -a (arguments) for now diff --git a/lib/pnd_desktop.c b/lib/pnd_desktop.c index eb8ebba..199825f 100644 --- a/lib/pnd_desktop.c +++ b/lib/pnd_desktop.c @@ -111,8 +111,14 @@ unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t strncat ( buffer, p -> startdir, 1020 ); } + // clockspeed + if ( p -> clockspeed && atoi ( p -> clockspeed ) != 0 ) { + strncat ( buffer, " -c ", 1020 ); + strncat ( buffer, p -> clockspeed, 1020 ); + } + // exec options - if ( p -> option_no_x11 ) { + if ( pnd_pxml_is_affirmative ( p -> option_no_x11 ) ) { strncat ( buffer, " -x ", 1020 ); } diff --git a/lib/pnd_pxml.c b/lib/pnd_pxml.c index 02d0841..6f981a2 100644 --- a/lib/pnd_pxml.c +++ b/lib/pnd_pxml.c @@ -502,3 +502,19 @@ char *pnd_pxml_get_mkdir ( pnd_pxml_handle h ) { pnd_pxml_t *p = (pnd_pxml_t*) h; return ( p -> mkdir_sp ); } + +unsigned char pnd_pxml_is_affirmative ( char *v ) { + + if ( ! v ) { + return ( 0 ); + } + + if ( ( v [ 0 ] == 'Y' ) || + ( v [ 0 ] == 'y' ) || + ( v [ 0 ] == '1' ) ) + { + return ( 0 ); + } + + return ( 0 ); +} -- 2.39.5