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

📄 flexos.c

📁 完整的解压zip文件的源码。包含密码功能
💻 C
📖 第 1 页 / 共 3 页
字号:
                Info(slide, 1, ((char *)slide, LoadFarString(PathTooLongTrunc),                  FnFilter1(G.filename), FnFilter2(buildpath)));                return 1;   /* filename truncated */            }        }        Trace((stderr, "buildpath now = [%s]\n", FnFilter1(buildpath)));        return 0;  /* could check for existence here, prompt for new name... */    }/*---------------------------------------------------------------------------    INIT:  allocate and initialize buffer space for the file currently being    extracted.  If file was renamed with an absolute path, don't prepend the    extract-to path.  ---------------------------------------------------------------------------*/    if (FUNCTION == INIT) {        Trace((stderr, "initializing buildpath to "));        /* allocate space for full filename, root path, and maybe "./" */        if ((buildpath = (char *)malloc(strlen(G.filename)+rootlen+3)) ==            (char *)NULL)            return 10;        if (renamed_fullpath) {   /* pathcomp = valid data */            end = buildpath;            while ((*end = *pathcomp++) != '\0')                ++end;        } else if (rootlen > 0) {            strcpy(buildpath, rootpath);            end = buildpath + rootlen;        } else {            *buildpath = '\0';            end = buildpath;        }        Trace((stderr, "[%s]\n", FnFilter1(buildpath)));        return 0;    }/*---------------------------------------------------------------------------    ROOT:  if appropriate, store the path in rootpath and create it if neces-    sary; else assume it's a zipfile member and return.  This path segment    gets used in extracting all members from every zipfile specified on the    command line.  Note that under FlexOS, if a candidate extract-to    directory specification includes a drive letter (leading "x:"), it is    treated just as if it had a trailing '/'--that is, one directory level    will be created if the path doesn't exist, unless this is otherwise pro-    hibited (e.g., freshening).  ---------------------------------------------------------------------------*/#if (!defined(SFX) || defined(SFX_EXDIR))    if (FUNCTION == ROOT) {        Trace((stderr, "initializing root path to [%s]\n",          FnFilter1(pathcomp)));        if (pathcomp == (char *)NULL) {            rootlen = 0;            return 0;        }        if ((rootlen = strlen(pathcomp)) > 0) {            int had_trailing_pathsep=FALSE, xtra=2;            if (pathcomp[rootlen-1] == '/' || pathcomp[rootlen-1] == '\\') {                pathcomp[--rootlen] = '\0';                had_trailing_pathsep = TRUE;            }            if (pathcomp[rootlen-1] == ':') {                if (!had_trailing_pathsep)   /* i.e., original wasn't "xxx:/" */                    xtra = 3;      /* room for '.' + '/' + 0 at end of "xxx:" */            } else if (rootlen > 0) {     /* need not check "xxx:." and "xxx:/" */                if (stat(pathcomp,&G.statbuf) || !S_ISDIR(G.statbuf.st_mode))                {                    /* path does not exist */                    if (!G.create_dirs /* || iswild(pathcomp) */ ) {                        rootlen = 0;                        return 2;   /* treat as stored file */                    }/* GRR:  scan for wildcard characters?  OS-dependent...  if find any, return 2: * treat as stored file(s) */                    /* create directory (could add loop here to scan pathcomp                     * and create more than one level, but really necessary?) */                    if (mkdir(pathcomp, 0777) == -1) {                        Info(slide, 1, ((char *)slide,                          LoadFarString(CantCreateExtractDir),                          FnFilter1(pathcomp)));                        rootlen = 0;   /* path didn't exist, tried to create, */                        return 3;  /* failed:  file exists, or need 2+ levels */                    }                }            }            if ((rootpath = (char *)malloc(rootlen+xtra)) == (char *)NULL) {                rootlen = 0;                return 10;            }            strcpy(rootpath, pathcomp);            if (xtra == 3)                  /* had just "x:", make "x:." */                rootpath[rootlen++] = '.';            rootpath[rootlen++] = '/';            rootpath[rootlen] = '\0';            Trace((stderr, "rootpath now = [%s]\n", FnFilter1(rootpath)));        }        return 0;    }#endif /* !SFX || SFX_EXDIR *//*---------------------------------------------------------------------------    END:  free rootpath, immediately prior to program exit.  ---------------------------------------------------------------------------*/    if (FUNCTION == END) {        Trace((stderr, "freeing rootpath\n"));        if (rootlen > 0) {            free(rootpath);            rootlen = 0;        }        return 0;    }    return 99;  /* should never reach */}/****************************//* Function close_outfile() *//****************************/void close_outfile(__G)    __GDEF /*  * FlexOS VERSION  *  * Set the output file date/time stamp according to information from the  * zipfile directory record for this member, then close the file and set  * its permissions (archive, hidden, read-only, system).  Aside from closing  * the file, this routine is optional (but most compilers support it).  */{    DISKFILE    df;    LONG        fnum;    struct {                /* date and time words */        union {             /* DOS file modification time word */            ush ztime;            struct {                unsigned zt_se : 5;                unsigned zt_mi : 6;                unsigned zt_hr : 5;            } _tf;        } _t;        union {             /* DOS file modification date word */            ush zdate;            struct {                unsigned zd_dy : 5;                unsigned zd_mo : 4;                unsigned zd_yr : 7;            } _df;        } _d;    } zt;#ifdef USE_EF_UT_TIME    iztimes z_utime;    struct tm *t;#endif /* ?USE_EF_UT_TIME */    fclose(G.outfile);    if ((fnum = s_open(A_SET, G.filename)) < 0) {        Info(slide, 0x201, ((char *)slide,          "warning:  cannot open %s to set the time\n", G.filename));        return;    }    if (s_get(T_FILE, fnum, &df, DSKFSIZE) < 0) {        s_close(0, fnum);        Info(slide, 0x201, ((char *)slide,          "warning:  cannot get info on %s\n", G.filename));        return;    }/*---------------------------------------------------------------------------    Copy and/or convert time and date variables, if necessary; then fill in    the file time/date.  ---------------------------------------------------------------------------*/#ifdef USE_EF_UT_TIME    if (G.extra_field &&#ifdef IZ_CHECK_TZ        G.tz_is_valid &&#endif        (ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,         G.lrec.last_mod_dos_datetime, &z_utime, NULL) & EB_UT_FL_MTIME))    {        TTrace((stderr, "close_outfile:  Unix e.f. modif. time = %ld\n",          z_utime.mtime));        t = localtime(&(z_utime.mtime));    } else        t = (struct tm *)NULL;    if (t != (struct tm *)NULL) {        if (t->tm_year < 80) {            df.df_modyear = 1980;            df.df_modmonth = 1;            df.df_modday = 1;            df.df_modhr = 0;            df.df_modmin = 0;            df.df_modsec = 0;        } else {            df.df_modyear = t->tm_year + 1900;            df.df_modmonth = t->tm_mon + 1;            df.df_modday = t->tm_mday;            df.df_modhr = t->tm_hour;            df.df_modmin = t->tm_min;            df.df_modsec = t->tm_sec;        }    } else#endif /* ?USE_EF_UX_TIME */    {        zt._t.ztime = (ush)(G.lrec.last_mod_dos_datetime) & 0xffff;        zt._d.zdate = (ush)(G.lrec.last_mod_dos_datetime >> 16);        df.df_modyear = 1980 + zt._d._df.zd_yr;        df.df_modmonth = zt._d._df.zd_mo;        df.df_modday = zt._d._df.zd_dy;        df.df_modhr = zt._t._tf.zt_hr;        df.df_modmin = zt._t._tf.zt_mi;        df.df_modsec = zt._t._tf.zt_se << 1;    }/*---------------------------------------------------------------------------    Fill in the file attributes.  ---------------------------------------------------------------------------*/    df.df_attr1 = (UBYTE)G.pInfo->file_attr;/*---------------------------------------------------------------------------    Now we try to set the attributes & date/time.  ---------------------------------------------------------------------------*/    if (s_set(T_FILE, fnum, &df, DSKFSIZE) < 0)        Info(slide, 0x201, ((char *)slide,          "warning:  cannot set info for %s\n", G.filename));    s_close(0, fnum);}#ifndef SFX/*************************//* Function dateformat() *//*************************/int dateformat(){    return DF_DMY;   /* default for systems without locale info */}/************************//*  Function version()  *//************************/void version(__G)    __GDEF{    int len;    len = sprintf((char *)slide, LoadFarString(CompiledWith),            "MetaWare High C",            "",            "FlexOS",            " (16-bit, big)",#ifdef __DATE__      " on ", __DATE__#else      "", ""#endif    );    (*G.message)((zvoid *)&G, slide, (ulg)len, 0);}#endif /* !SFX *//************************//*  Function _wildarg() *//************************//* This prevents the PORTLIB startup code from preforming argument globbing */_wildarg() {}

⌨️ 快捷键说明

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