mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +02:00
formating "fixes".
This commit is contained in:
parent
b4b7151cf3
commit
adcc89e794
1 changed files with 32 additions and 37 deletions
|
@ -20,14 +20,12 @@ char *pfind( const char *name )
|
|||
char *path = getenv("PATH" );
|
||||
char FullPath[PATH_MAX+1];
|
||||
|
||||
if( name == NULL )
|
||||
{
|
||||
if (name == NULL) {
|
||||
fprintf(stderr, "pfind(): Null argument.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( path == NULL || strlen( path ) <= 0 )
|
||||
{
|
||||
if (path == NULL || strlen( path ) <= 0) {
|
||||
fprintf(stderr, "Unable to get $PATH.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -36,15 +34,13 @@ char *pfind( const char *name )
|
|||
path = strdup(path);
|
||||
|
||||
tok = strtok_r(path, ":", &sp);
|
||||
while( tok != NULL )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
if (access(FullPath, X_OK | R_OK) == 0) {
|
||||
free(path);
|
||||
return strdup(FullPath);
|
||||
}
|
||||
|
@ -62,8 +58,7 @@ int main( int argc, char **argv )
|
|||
int i;
|
||||
char *fullpath;
|
||||
|
||||
for( i=1; i<argc; i++ )
|
||||
{
|
||||
for (i=1; i<argc; i++) {
|
||||
fullpath = pfind(argv[i]);
|
||||
if (fullpath == NULL)
|
||||
printf("Unable to find %s in $PATH.\n", argv[i]);
|
||||
|
|
Loading…
Add table
Reference in a new issue