Exemplo n.º 1
0
static int tool_exec( tool_type utl, char *p1, char *p2 )
/*******************************************************/
{
    int     rc;

    FindToolPath( utl );
    if( !Flags.be_quiet ) {
        if( p2 == NULL ) {
            PrintMsg( "\t%s %s\n", tools[utl].name, p1 );
        } else {
            PrintMsg( "\t%s %s %s\n", tools[utl].name, p1, p2 );
        }
    }
    fflush( NULL );
    if( p2 == NULL ) {
        rc = spawnlp( P_WAIT, tools[utl].path, tools[utl].name, p1, NULL );
    } else {
        rc = spawnlp( P_WAIT, tools[utl].path, tools[utl].name, p1, p2, NULL );
    }
    if( rc != 0 ) {
        if( (rc == -1) || (rc == 255) ) {
            PrintMsg( WclMsgs[UNABLE_TO_INVOKE_EXE], tools[utl].path );
        } else {
            if( utl == TYPE_LINK ) {
                PrintMsg( WclMsgs[LINKER_RETURNED_A_BAD_STATUS] );
            } else if( utl == TYPE_PACK ) {
                PrintMsg( WclMsgs[CVPACK_RETURNED_A_BAD_STATUS] );
            } else {
                PrintMsg( WclMsgs[COMPILER_RETURNED_A_BAD_STATUS], p1 );
            }
        }
    }
    return( rc );
}
Exemplo n.º 2
0
static int tool_exec( tool_type utl, char *target, char **options )
/*******************************************************/
{
    int     rc;
    int     pass_argc;
    char    *pass_argv[MAX_OPTIONS+3];

    FindToolPath( utl );

    pass_argv[0] = tools[utl].name;
    pass_argc = 1;

    while(options != NULL && options[pass_argc-1] != NULL && pass_argc < MAX_OPTIONS) {
        pass_argv[pass_argc] = options[pass_argc-1];
        pass_argc++;
    }

    pass_argv[pass_argc++] = target;
    pass_argv[pass_argc] = NULL;

    if( !Flags.quiet ) {
        fputs( "\t", stdout );
        for( pass_argc=0; pass_argv[pass_argc] != NULL; pass_argc++ ) {
            fputs( pass_argv[pass_argc], stdout );
            fputs( " ", stdout );
        }
        fputs( "\n", stdout );
    }
    fflush( NULL );

    rc = (int)spawnvp( P_WAIT, tools[utl].path, (char const *const *)pass_argv );

    if( rc != 0 ) {
        if( (rc == -1) || (rc == 255) ) {
            if( utl == TYPE_LINK ) {
                PrintMsg( CL_UNABLE_TO_INVOKE_LINKER );
            } else if( utl == TYPE_PACK ) {
                PrintMsg( CL_UNABLE_TO_INVOKE_CVPACK );
            } else {
                PrintMsg( CL_UNABLE_TO_INVOKE_COMPILER );
            }
        } else {
            if( utl == TYPE_LINK ) {
                PrintMsg( CL_BAD_LINK );
            } else if( utl == TYPE_PACK ) {
                PrintMsg( CL_BAD_LINK );
            } else {
                PrintMsg( CL_BAD_COMPILE, target );
            }
        }
    }
    return( rc );
}
Exemplo n.º 3
0
static int tool_exec( tool_type utl, char *p1, char *p2 )
/*******************************************************/
{
    int     rc;
    
    FindToolPath( utl );
    if( !Flags.quiet ) {
        fputs( "\t", stdout );
        fputs( tools[utl].name, stdout );
        fputs( " ", stdout );
        fputs( p1, stdout );
        if( p2 != NULL ) {
            fputs( " ", stdout );
            fputs( p2, stdout );
        }
        fputs( "\n", stdout );
    }
    fflush( NULL );
    if( p2 == NULL ) {
        rc = spawnlp( P_WAIT, tools[utl].path, tools[utl].name, p1, NULL );
    } else {
        rc = spawnlp( P_WAIT, tools[utl].path, tools[utl].name, p1, p2, NULL );
    }
    if( rc != 0 ) {
        if( (rc == -1) || (rc == 255) ) {
            if( utl == TYPE_LINK ) {
                PrintMsg( CL_UNABLE_TO_INVOKE_LINKER );
            } else if( utl == TYPE_PACK ) {
                PrintMsg( CL_UNABLE_TO_INVOKE_CVPACK );
            } else {
                PrintMsg( CL_UNABLE_TO_INVOKE_COMPILER );
            }
        } else {
            if( utl == TYPE_LINK ) {
                PrintMsg( CL_BAD_LINK );
            } else if( utl == TYPE_PACK ) {
                PrintMsg( CL_BAD_LINK );
            } else {
                PrintMsg( CL_BAD_COMPILE, p1 );
            }
        }
    }
    return( rc );
}