Esempio n. 1
0
bool DoObjOpen( infilelist *list )
/***************************************/
{
    char *      name;
    f_handle    fp;
    unsigned    err;
    char *      path_ptr;
    char        new_name[ PATH_MAX ];
    path_entry *searchpath;
    bool        haspath;

    name = list->name;
    if( list->handle != NIL_HANDLE )
        return( TRUE );
    list->currpos = 0;
    haspath = QHavePath( name );
    if( haspath ) {                         // has path defined
        list->path_list = NULL;
        fp = QObjOpen( name );
    } else if( list->prefix != NULL ) {     // already searched path
        path_ptr = list->prefix;
        QMakeFileName( &path_ptr, name, new_name );
        fp = QObjOpen( new_name );
    } else {                                // new, no searched path
        fp = NIL_HANDLE;
        if( (list->flags & LIB_SEARCH) || list->path_list == NULL ) {
            /* try in current directory */
            fp = QObjOpen( name );
        }
        if( fp == NIL_HANDLE ) {
            for( searchpath = list->path_list; searchpath != NULL; searchpath = searchpath->next ) {
                fp = PathObjOpen( searchpath->name, name, new_name, list );
                if( fp != NIL_HANDLE ) {
                    break;
                }
            }
            if( fp == NIL_HANDLE && (list->flags & INSTAT_USE_LIBPATH) ) {
                fp = PathObjOpen( GetEnvString("LIB"), name, new_name, list );
            }
        }
    }
    if( fp != NIL_HANDLE ) {
        if( !(list->flags & INSTAT_GOT_MODTIME) ) {
            list->modtime = QFModTime( fp );
        }
        list->handle = fp;
        return( TRUE );
    } else if( !(list->flags & INSTAT_NO_WARNING) ) {
        err = ( list->flags & INSTAT_OPEN_WARNING ) ?
                                        WRN+MSG_CANT_OPEN : ERR+MSG_CANT_OPEN;
        PrintIOError( err, "12", name );
        list->prefix = NULL;
        list->handle = NIL_HANDLE;
    }
    return( FALSE );
}
Esempio n. 2
0
static void WriteQNXResource( void )
/**********************************/
{
    unsigned long   len;
    lmf_record      rec;
    f_handle        file;
    lmf_resource    resource;
    void *          buf;

    if( FmtData.resource != NULL ) {
        rec.reserved = 0;
        rec.spare = 0;
        rec.rec_type = LMF_RESOURCE_REC;
        memset( &resource, 0, sizeof( lmf_resource ) );
        if( FmtData.res_name_only ) {
            file = QObjOpen( FmtData.resource );
            if( file == NIL_FHANDLE ) {
                PrintIOError( WRN+MSG_CANT_OPEN_NO_REASON, "s",
                                        FmtData.resource );
                return;
            }
            len = QFileSize( file );
            if( len + sizeof(lmf_resource) > QNX_MAX_REC_SIZE ) {
                LnkMsg( WRN+MSG_RESOURCE_TOO_BIG, "s", FmtData.resource );
                return;
            }
            _ChkAlloc( buf, len );
            rec.data_nbytes = len + sizeof( lmf_resource );
            WriteLoad( &rec, sizeof( lmf_record ) );
            WriteLoad( &resource, sizeof( lmf_resource ) );
            QRead( file, buf, len, FmtData.resource );
            WriteLoad( buf, len );
            _LnkFree( buf );
            QClose( file, FmtData.resource );
        } else {
            len = strlen( FmtData.resource );
            FmtData.resource[len] = '\n';
            len++;
            rec.data_nbytes = len + sizeof( lmf_resource );
            WriteLoad( &rec, sizeof( lmf_record ) );
            WriteLoad( &resource, sizeof( lmf_resource ) );
            WriteLoad( FmtData.resource, len );
        }
    }
}
Esempio n. 3
0
static void DoCVPack( void )
/**************************/
{
    int         retval;
    char        *name;

    if( LinkFlags & CVPACK_FLAG && !(LinkState & LINK_ERROR) ) {
        if( SymFileName != NULL ) {
            name = SymFileName;
        } else {
            name = Root->outfile->fname;
        }
        retval = spawnlp( P_WAIT, CVPACK_EXE, CVPACK_EXE, "/nologo",
                          name, NULL );
        if( retval == -1 ) {
            PrintIOError( ERR+MSG_CANT_EXECUTE, "12", CVPACK_EXE );
        }
    }
}
Esempio n. 4
0
static void DoCVPack( void )
/**************************/
{
#if !defined( __UNIX__ ) || defined(__WATCOMC__)
    int         retval;
    char        *name;

    if( (LinkFlags & CVPACK_FLAG) && (LinkState & LINK_ERROR) == 0 ) {
        if( SymFileName != NULL ) {
            name = SymFileName;
        } else {
            name = Root->outfile->fname;
        }
        retval = (int)spawnlp( P_WAIT, CVPACK_EXE, CVPACK_EXE, "/nologo",
                          name, NULL );
        if( retval == -1 ) {
            PrintIOError( ERR+MSG_CANT_EXECUTE, "12", CVPACK_EXE );
        }
    }
#endif
}