Exemplo n.º 1
0
static void DoDefaultSystem( void )
/*********************************/
/* first hint about format being 32-bit vs. 16-bit (might distinguish between
 * os/2 v1 & os/2 v2), and if that doesn't decide it, haul in the default
 * system block */
{
    if( (LinkState & FMT_DECIDED) == 0 ) {
        if( LinkState & FMT_SEEN_64_BIT ) {
            HintFormat( MK_64BIT );
        } else if( LinkState & FMT_SEEN_32_BIT ) {
            HintFormat( MK_32BIT );
        } else {
            HintFormat( MK_16BIT | MK_QNX );
        }
        if( (LinkState & FMT_DECIDED) == 0 ) {
            if( LinkState & FMT_SPECIFIED ) {
                LnkMsg( FTL+MSG_AMBIG_FORMAT, NULL );
            }
            if( LinkState & FMT_SEEN_64_BIT ) {
                ExecSystem( "64bit" );
            } else if( LinkState & FMT_SEEN_32_BIT ) {
                ExecSystem( "386" );
            } else {
                ExecSystem( "286" ); /* no 386 obj's after this */
            }
        }
    }
}
Exemplo n.º 2
0
static void FindLibPaths( void )
/******************************/
{
    AddFmtLibPaths();
    if( LinkState & FMT_SEEN_32_BIT ) {
        AddEnvPaths( "LIB386" );
    } else {
        AddEnvPaths( "LIB286" );
        /*
            If we haven't seen a 386 object file by this time, we're
            not going to.
        */
        HintFormat( MK_286 );
    }
    AddEnvPaths( "LIB" );
}
Exemplo n.º 3
0
static void FindLibPaths( void )
/******************************/
{
    AddFmtLibPaths();
    if( LinkState & FMT_SEEN_64_BIT ) {
        AddLibPathsToEnd( GetEnvString( "LIBX64" ) );
    } else if( LinkState & FMT_SEEN_32_BIT ) {
        AddLibPathsToEnd( GetEnvString( "LIB386" ) );
    } else {
        AddLibPathsToEnd( GetEnvString( "LIB286" ) );
        /*
            If we haven't seen a 386 object file by this time, we're
            not going to.
        */
        HintFormat( MK_16BIT );
    }
    AddLibPathsToEndList( LibPath );
}
Exemplo n.º 4
0
void DoCmdFile( char *fname )
/**********************************/
/* start parsing the command */
{
    exe_format  possible;
    f_handle    file;
    size_t      namelen;
    file_defext extension;
    char        *namelnk;

    ResetCmdFile();
    if( fname == NULL || *fname == '\0' ) {
        _ChkAlloc( fname, (10*1024) );  // arbitrarily large buffer that won't
        GetCmdLine( fname );            // be overflowed
        NewCommandSource( NULL, fname, COMMANDLINE );
    } else {
        NewCommandSource( NULL, fname, ENVIRONMENT );
    }
    if( IsStdOutConsole() ) {
        CmdFlags |= CF_TO_STDOUT;
    }
    while( *fname == ' ' ) {
        fname++;
    }
    if( QSysHelp( &Token.next ) ) {
        Help();
    }
    if( *fname == '?' ) {
        Token.next = fname + 1;       // skip question mark.
        Help();
#if defined( __UNIX__ )
    } else if( *fname == '-' ) {
#else
    } else if( *fname == '-' || *fname == '/' ) {
#endif
        if( *(fname + 1) == '?' ) {
            Token.next = fname + 2;     // skip /?
            Help();
        }
    }
    if( *fname == '\0' ) {       // go into interactive mode.
        Token.how = INTERACTIVE;
        Token.where = ENDOFLINE;
        LnkMsg( INF+MSG_PRESS_CTRL_Z, NULL );
    }
    namelnk = GetEnvString( INIT_FILE_ENV );
    file = ( namelnk != NULL ) ? FindPath( namelnk ) : NIL_FHANDLE;
    if( file == NIL_FHANDLE ) {
        namelnk = INIT_FILE_NAME;
        file = FindPath( namelnk );
    }
    if( file != NIL_FHANDLE ) {
        fname = ChkStrDup( namelnk );
        SetCommandFile( file, fname );
    }
    if( Spawn( DoCmdParse ) ) {
        Ignite();
        Suicide();
    }
    GetExtraCommands();
    if( !(LinkState & FMT_DECIDED) ) {
        /* restrict set to automatically decided ones */
#if defined( __QNX__ )
#define LAST_CHANCE ( MK_OS2_LX | MK_OS2_LE | MK_OS2_NE | MK_QNX )
#elif defined( __LINUX__ )
#define LAST_CHANCE ( MK_OS2_LX | MK_OS2_LE | MK_OS2_NE | MK_ELF )
#elif defined( __NT__ )
#define LAST_CHANCE ( MK_OS2_LX             | MK_OS2_NE | MK_WINDOWS | MK_PE | MK_DOS_EXE | MK_WIN_VXD )
#else
#define LAST_CHANCE ( MK_OS2_LX | MK_OS2_LE | MK_OS2_NE | MK_DOS_EXE | MK_PHAR_SIMPLE )
#endif
        HintFormat( LAST_CHANCE );
    } else {
        /* restrict to a unique type */
        for( possible = 1; possible != 0; possible *= 2 ) {
            if( FmtData.type & possible ) {
                FmtData.type = possible;
                break;
            }
        }
    }
    if( (FmtData.type & (MK_NOVELL | MK_DOS)) && (LinkFlags & INC_LINK_FLAG) ) {
        LnkMsg( FTL+MSG_FORMAT_BAD_OPTION, "s", "incremental" );
    }
#ifdef _NOVELL
    if( FmtData.type & MK_NOVELL ) {
        CmdNovFini();
    } else
#endif
    if( FmtData.type & MK_OVERLAYS ) {
        CmdOvlFini();
        AddObjLib( "wovl.lib", LIB_PRIORITY_MIN );     // add a reference to wovl.lib
    }
    if( Name == NULL || !(CmdFlags & CF_HAVE_FILES) ) {
        Ignite();
        LnkMsg( FTL+MSG_NO_FILES_FOUND, NULL );
    }
    namelen = strlen( Name );
    if( MapFlags & MAP_FLAG ) {
        if( MapFName == NULL ) {
            MapFName = FileName( Name, namelen, E_MAP, TRUE );
        }
    } else {
        MapFlags = 0;   // if main isn't set, don't set anything.
    }
    if( SymFileName == NULL && ( (CmdFlags & CF_SEPARATE_SYM) ||
                   (LinkFlags & OLD_DBI_FLAG) && (FmtData.type & MK_COM) ) ) {
        SymFileName = FileName( Name, namelen, E_SYM, TRUE );
    }
    if( FmtData.make_implib && FmtData.implibname == NULL ) {
        if( FmtData.make_impfile ) {
            extension = E_LBC;
        } else {
            extension = E_LIBRARY;
        }
        FmtData.implibname = FileName( Name, namelen, extension, TRUE );
    }
    CheckTraces();
    BurnUtils();
    PruneSystemList();
    NumberSections();
    DBIInit();
}