From adcc89e794d83c05286f3fd7a448aa2824198cc8 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Thu, 26 Sep 2002 19:52:44 +0000 Subject: [PATCH] formating "fixes". --- .../library/pfind.c | 69 +++++++++---------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/core/org.eclipse.cdt.core.linux/library/pfind.c b/core/org.eclipse.cdt.core.linux/library/pfind.c index 7d48e79739a..65de2a5cb16 100644 --- a/core/org.eclipse.cdt.core.linux/library/pfind.c +++ b/core/org.eclipse.cdt.core.linux/library/pfind.c @@ -13,62 +13,57 @@ #endif -char *pfind( const char *name ) +char *pfind(const char *name) { - char *tok; + char *tok; char *sp; - char *path = getenv( "PATH" ); + char *path = getenv("PATH" ); char FullPath[PATH_MAX+1]; - if( name == NULL ) - { - fprintf( stderr, "pfind(): Null argument.\n" ); - return NULL; - } + if (name == NULL) { + fprintf(stderr, "pfind(): Null argument.\n"); + return NULL; + } - if( path == NULL || strlen( path ) <= 0 ) - { - fprintf( stderr, "Unable to get $PATH.\n" ); - return NULL; - } + if (path == NULL || strlen( path ) <= 0) { + fprintf(stderr, "Unable to get $PATH.\n"); + return NULL; + } - // The value return by getenv() is readonly */ - path = strdup( path ); + // The value return by getenv() is readonly */ + path = strdup(path); - tok = strtok_r( path, ":", &sp ); - while( tok != NULL ) - { - //strcpy( FullPath, tok ); - //strcat( FullPath, "/" ); - //strcat( FullPath, name ); + tok = strtok_r(path, ":", &sp); + while (tok != NULL) { + //strcpy(FullPath, tok); + //strcat(FullPath, "/"); + //strcat(FullPath, name); snprintf(FullPath, sizeof(FullPath) - 1, "%s/%s", tok, name); - if( access( FullPath, X_OK | R_OK ) == 0 ) - { - free( path ); - return strdup(FullPath); - } + if (access(FullPath, X_OK | R_OK) == 0) { + free(path); + return strdup(FullPath); + } - tok = strtok_r( NULL, ":", &sp ); - } + tok = strtok_r( NULL, ":", &sp ); + } - free( path ); - return NULL; + free(path); + return NULL; } #ifdef BUILD_WITH_MAIN -int main( int argc, char **argv ) +int main(int argc, char **argv) { int i; char *fullpath; - for( i=1; i