From: José Bollo Date: Wed, 11 Dec 2013 14:43:18 +0000 (+0100) Subject: adding function 'tzplatform_mkpath4' X-Git-Tag: accepted/tizen/20131212.180725^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F55%2F13655%2F1;p=platform%2Fcore%2Fsystem%2Ftizen-platform-wrapper.git adding function 'tzplatform_mkpath4' Change-Id: Ifcc1c5e52e22e17aebed74d01ea8fc191f8bebd5 Signed-off-by: José Bollo --- diff --git a/src/tzplatform_config.c b/src/tzplatform_config.c index da7fbe4..735fef6 100644 --- a/src/tzplatform_config.c +++ b/src/tzplatform_config.c @@ -546,7 +546,8 @@ const char* tzplatform_mkpath(enum tzplatform_variable id, const char * path) return result; } -const char* tzplatform_mkpath3(enum tzplatform_variable id, const char * path, const char* path2) +const char* tzplatform_mkpath3(enum tzplatform_variable id, const char * path, + const char* path2) { const char *array[4]; const char *result = get_lock( id); @@ -561,6 +562,23 @@ const char* tzplatform_mkpath3(enum tzplatform_variable id, const char * path, c return result; } +const char* tzplatform_mkpath4(enum tzplatform_variable id, const char * path, + const char* path2, const char *path3) +{ + const char *array[5]; + const char *result = get_lock( id); + if (result != NULL) { + array[0] = result; + array[1] = path; + array[2] = path2; + array[3] = path3; + array[4] = NULL; + result = scratchcat( 1, array); + } + unlock(); + return result; +} + uid_t tzplatform_getuid(enum tzplatform_variable id) { uid_t result = (uid_t)-1; diff --git a/src/tzplatform_config.h b/src/tzplatform_config.h index 496bb42..504032a 100644 --- a/src/tzplatform_config.h +++ b/src/tzplatform_config.h @@ -78,8 +78,8 @@ int tzplatform_getenv_int(enum tzplatform_variable id); tizen plaform variable 'id' and the given string 'str'. The returned value is a scratch buffer (unique for the thread) that is - available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', or, - 'tzplatform_mkpath3'. + available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', + 'tzplatform_mkpath3' or 'tzplatform_mkpath4'. Can return NULL in case of internal error. @@ -91,7 +91,7 @@ int tzplatform_getenv_int(enum tzplatform_variable id); will return "/opt/home-yes" */ extern -const char* tzplatform_mkstr(enum tzplatform_variable id, const char * str); +const char* tzplatform_mkstr(enum tzplatform_variable id, const char *str); /* Return the string resulting of the path-concatenation of string value of the @@ -100,8 +100,8 @@ const char* tzplatform_mkstr(enum tzplatform_variable id, const char * str); path-concatenation is the concatenation taking care of / characters. The returned value is a scratch buffer (unique for the thread) that is - available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', or, - 'tzplatform_mkpath3'. + available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', + 'tzplatform_mkpath3' or 'tzplatform_mkpath4'. Can return NULL in case of internal error. @@ -113,7 +113,7 @@ const char* tzplatform_mkstr(enum tzplatform_variable id, const char * str); will return "/opt/home/yes" */ extern -const char* tzplatform_mkpath(enum tzplatform_variable id, const char * path); +const char* tzplatform_mkpath(enum tzplatform_variable id, const char *path); /* Return the string resulting of the path-concatenation of string value of the @@ -122,8 +122,8 @@ const char* tzplatform_mkpath(enum tzplatform_variable id, const char * path); path-concatenation is the concatenation taking care of / characters. The returned value is a scratch buffer (unique for the thread) that is - available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', or, - 'tzplatform_mkpath3'. + available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', + 'tzplatform_mkpath3' or 'tzplatform_mkpath4'. Can return NULL in case of internal error. @@ -135,8 +135,31 @@ const char* tzplatform_mkpath(enum tzplatform_variable id, const char * path); will return "/opt/home/yes/no" */ extern -const char* tzplatform_mkpath3(enum tzplatform_variable id, const char * path, - const char* path2); +const char* tzplatform_mkpath3(enum tzplatform_variable id, const char *path, + const char *path2); + +/* + Return the string resulting of the path-concatenation of string value of the + tizen plaform variable 'id' and the given strings 'path', 'path2' and 'path3'. + + path-concatenation is the concatenation taking care of / characters. + + The returned value is a scratch buffer (unique for the thread) that is + available until the next call to 'tzplatform_mkstr', 'tzplatform_mkpath', + 'tzplatform_mkpath3' or 'tzplatform_mkpath4'. + + Can return NULL in case of internal error. + + Example: + if TZ_SYS_HOME == "/opt/home" then calling + + tzplatform_mkpath4(TZ_SYS_HOME,"yes","no","/maybe") + + will return "/opt/home/yes/no/maybe" +*/ +extern +const char* tzplatform_mkpath4(enum tzplatform_variable id, const char *path, + const char *path2, const char *path3); /* Return the uid for a given user name, stored in variable