⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dalmain.c

📁 db.* (pronounced dee-be star) is an advanced, high performance, small footprint embedded database fo
💻 C
📖 第 1 页 / 共 2 页
字号:
    int       mode = NO_ENC;#endif    setvbuf( stdout, NULL, _IONBF, 0 );    setvbuf( stderr, NULL, _IONBF, 0 );    vtprintf(DBSTAR_UTIL_DESC(DB_TEXT("Database Access Language")));    /* initialize all global / static variables */    init_dalmain();    init_dallex();    init_dalvar();    for (i = 1; i < argc && argv[i][0] == DB_TEXT('-'); i++)    {        switch (vtotlower(argv[i][1]))        {            case DB_TEXT('?'):            case DB_TEXT('h'):                return usage();            case DB_TEXT('m'):                switch (vtotlower(argv[i][2]))                {                    case DB_TEXT('n'):                        str = DB_TEXT("None");                        break;                    case DB_TEXT('t'):                        str = DB_TEXT("TCP");                        break;                    case DB_TEXT('p'):                        str = DB_TEXT("IP");                        break;                    default:                        vftprintf(stderr, DB_TEXT("Invalid option: %s\n"),                                argv[i]);                        return usage();                }                break;#if defined(UNICODE)            case DB_TEXT('u'):                dal_unicode = 1;                break;#endif            case DB_TEXT('s'):                if (argv[i][2] != DB_TEXT('g'))                {                    vftprintf(stderr, DB_TEXT("Invalid option: %s\n"), argv[i]);                    return usage();                }                if (i == argc - 1)                {                    vftprintf(stderr, DB_TEXT("No password specified\n"));                    return usage();                }#if defined(SAFEGARDE)                if ((cp = vtstrchr(argv[++i], DB_TEXT(','))) != NULL)                {                    *cp++ = DB_TEXT('\0');                    if (vtstricmp(argv[i], DB_TEXT("low")) == 0)                        mode = LOW_ENC;                    else if (vtstricmp(argv[i], DB_TEXT("med")) == 0)                        mode = MED_ENC;                    else if (vtstricmp(argv[i], DB_TEXT("high")) == 0)                        mode = HIGH_ENC;                    else                    {                        vftprintf(stderr, DB_TEXT("Invalid SafeGarde encryption mode\n"));                        return usage();                    }                    password = cp;                }                else                {                    mode = MED_ENC;                    password = argv[i];                }                break;#else                vftprintf(stderr, DB_TEXT("SafeGarde is not available in this version\n"));                return 1;#endif            default:                vftprintf(stderr, DB_TEXT("Invalid option: %s\n"), argv[i]);                return usage();        }    }    if (i < argc)        bfile = argv[i++];    while (i < argc)        vftprintf(stderr, DB_TEXT("Ignoring option: %s\n"), argv[i++]);    if ((stat = d_opentask(&DalDbTask)) != S_OKAY)    {        vftprintf(stderr, DB_TEXT("Failed to open task\n"));        return 1;    }#if defined(SAFEGARDE)    if (mode != NO_ENC && (dal_sg = sg_create(mode, password)) == NULL)    {        vftprintf(stderr, DB_TEXT("Failed to create SafeGarde contnext\n"));        goto exit;    }#endif    if ((stat = d_set_dberr(dal_dberr, DalDbTask)) != S_OKAY)    {        vftprintf(stderr, DB_TEXT("Failed to set error handler\n"));        goto exit;    }    if (str && (stat = d_lockcomm(psp_lmcFind(str), DalDbTask)) != S_OKAY)    {        vftprintf(stderr, DB_TEXT("Failed to set lock manager type\n"));        goto exit;    }    if (bfile)    {        fdal = vtfopen(bfile, dal_unicode ? DB_TEXT("rb") : DB_TEXT("r"));        if (fdal == NULL)        {            vftprintf(stderr,                    DB_TEXT("unable to open file '%s'.  Errno = %d\n"),                    bfile, errno);                goto exit;        }        batch = 1;    }    else    {	fdal = stdin;	vtprintf(DB_TEXT("d_"));    }    if ((stat = yyparse()) != 0)	vftprintf(stderr, DB_TEXT("%d errors detected\n"), tot_errs);    fclose(fdal);exit:#if defined(SAFEGARDE)    if (dal_sg)        sg_delete(dal_sg);#endif    if (DalDbTask)        d_closetask(DalDbTask);    return stat;}/* ------------------------------------------------------------------------ */#if defined(UNICODE)#define UNICODE_OPT L"[-u] "#else#define UNICODE_OPT ""#endifint usage(){    vftprintf(stderr, DB_TEXT("usage: dal [-m{n|t|p}] [-sg [<mode>,]<password>] [") UNICODE_OPT            DB_TEXT("file]\n"));    vftprintf(stderr, DB_TEXT("where: -m   Specifies the lock manager type.  Valid values are\n"));    vftprintf(stderr, DB_TEXT("             n - None (default, single user only)\n"));    vftprintf(stderr, DB_TEXT("             t - TCP/IP\n"));    vftprintf(stderr, DB_TEXT("             p - UNIX Domain sockets\n"));    vftprintf(stderr, DB_TEXT("       -sg  Specifies the SafeGarde encryption information for the database\n"));    vftprintf(stderr, DB_TEXT("             <mode> can be 'low', 'med' (default), and 'high'\n"));#if defined(UNICODE)    vftprintf(stderr, DB_TEXT("       -u   Specifies the batch file to be a Unicode file\n"));#endif    vftprintf(stderr, DB_TEXT("       file Specifies a file containing batch commands to execute\n"));    return 1;}VXSTARTUP("dal", 0)

⌨️ 快捷键说明

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