qemu87.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 46 行

C
46
字号
#define _NO_SLIB

#include <stdio.h>
#include <process.h>
#include <unistd.h>
#include <signal.h>
#include <sys/osinfo.h>

#define USAGE   "usage: emu87 [-f] &\n" \
                "  -f forces installation even if 80(x)87 is present\n"

#define Msg( string ) write( 2, string, sizeof( string ) - 1 )

#define EMU16_16        "/bin/emu87_16"
#define EMU16_32        "/bin/emu87_32"
#define EMU32_32        "/bin/emu387"

main( int argc, char *argv[] )
{
    struct  _osinfo     info;
    unsigned            i;

    if( argc > 1 && argv[1][0] == '?' ) {
        Msg( USAGE );
        exit( 0 );
    }
    /* ignore everything */
    for( i = _SIGMIN; i < _SIGMAX; ++i ) {
        signal( i, SIG_IGN );
    }
    qnx_osinfo( 0, &info );
    if( info.sflags & _PSF_32BIT ) {
        argv[0] = EMU32_32;
        if( spawnv( P_NOWAIT, argv[0], argv ) == -1 ) {
            Msg( "can not spawn 32-bit emulator\n" );
        }
        argv[0] = EMU16_32;
    } else {
        argv[0] = EMU16_16;
    }
    if( spawnv( P_NOWAIT, argv[0], argv ) == -1 ) {
        Msg( "can not spawn 16-bit emulator\n" );
    }
    exit( 0 );
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?