Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2002-09-26 15:52:44 -0400
committerAlain Magloire2002-09-26 15:52:44 -0400
commitadcc89e794d83c05286f3fd7a448aa2824198cc8 (patch)
tree262bf40ef35e14b075fa068cefcd2a789292dd68 /core/org.eclipse.cdt.core.linux/library
parentb4b7151cf398c9a6b3b67d2a6805c57bdbd7350e (diff)
downloadorg.eclipse.cdt-adcc89e794d83c05286f3fd7a448aa2824198cc8.tar.gz
org.eclipse.cdt-adcc89e794d83c05286f3fd7a448aa2824198cc8.tar.xz
org.eclipse.cdt-adcc89e794d83c05286f3fd7a448aa2824198cc8.zip
formating "fixes".
Diffstat (limited to 'core/org.eclipse.cdt.core.linux/library')
-rw-r--r--core/org.eclipse.cdt.core.linux/library/pfind.c69
1 files 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<argc; i++ )
- {
- fullpath = pfind( argv[i] );
- if( fullpath == NULL )
- printf( "Unable to find %s in $PATH.\n", argv[i] );
+ for (i=1; i<argc; i++) {
+ fullpath = pfind(argv[i]);
+ if (fullpath == NULL)
+ printf("Unable to find %s in $PATH.\n", argv[i]);
else
- printf( "Found %s @ %s.\n", argv[i], fullpath );
+ printf("Found %s @ %s.\n", argv[i], fullpath);
}
}
#endif

Back to the top