Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

unzip-6.0/theos/theos.c  view on Meta::CPAN

    END:  free rootpath, immediately prior to program exit.
  ---------------------------------------------------------------------------*/

    if (FUNCTION == END) {
        Trace((stderr, "freeing rootpath\n"));
        if (rootlen > 0) {
            free(rootpath);
            rootlen = 0;
        }
        return MPN_OK;
    }

    return MPN_INVALID; /* should never reach */

} /* end function checkdir() */




#ifdef MORE

/**************************/
/* Function screenlines() */
/**************************/

int screenlines()
{
    return getpl(27) + 1;
}

#endif /* MORE */





#if (!defined(MTS) || defined(SET_DIR_ATTRIB))
static void get_extattribs OF((__GPRO__ iztimes *pzt));

static int get_extattribs(__G__ pzt)
    __GDEF
    iztimes *pzt;
{
/*---------------------------------------------------------------------------
    Convert from MSDOS-format local time and date to Unix-format 32-bit GMT
    time:  adjust base year from 1980 to 1970, do usual conversions from
    yy/mm/dd hh:mm:ss to elapsed seconds, and account for timezone and day-
    light savings time differences.  If we have a Unix extra field, however,
    we're laughing:  both mtime and atime are ours.
  ---------------------------------------------------------------------------*/
#ifdef USE_EF_UT_TIME
    unsigned eb_izux_flg;

    eb_izux_flg = (G.extra_field ? ef_scan_for_izux(G.extra_field,
                   G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime,
#ifdef IZ_CHECK_TZ
                   (G.tz_is_valid ? pzt : NULL),
#else
                   pzt,
#endif
                   z_uidgid) : 0);
    if (eb_izux_flg & EB_UT_FL_MTIME) {
        TTrace((stderr, "\nget_extattribs:  Unix e.f. modif. time = %ld\n",
          pzt->mtime));
    } else {
        pzt->mtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
    }
    if (eb_izux_flg & EB_UT_FL_ATIME) {
        TTrace((stderr, "get_extattribs:  Unix e.f. access time = %ld\n",
          pzt->atime));
    } else {
        pzt->atime = pzt->mtime;
        TTrace((stderr, "\nget_extattribs:  modification/access times = %ld\n",
          pzt->mtime));
    }
#else
    pzt->mtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
    pzt->atime = pzt->mtime;
#endif
}
#endif /* !MTS || SET_DIR_ATTRIB */



#ifndef MTS

/****************************/
/* Function close_outfile() */
/****************************/

void close_outfile(__G)    /* GRR: change to return PK-style warning level */
    __GDEF
{
    union {
        iztimes t3;             /* mtime, atime, ctime */
        ztimbuf t2;             /* modtime, actime */
    } zt;

/*---------------------------------------------------------------------------
    If symbolic links are supported, allocate a storage area, put the uncom-
    pressed "data" in it, and create the link.  Since we know it's a symbolic
    link to start with, we shouldn't have to worry about overflowing unsigned
    ints with unsigned longs.
  ---------------------------------------------------------------------------*/

    fclose(G.outfile);

    get_extattribs(__G__ &(zt.t3));

    /* set the file's access and modification times */
    if (utime(G.filename, &(zt.t2))) {
        if (uO.qflag)
            Info(slide, 0x201, ((char *)slide,
              "warning:  cannot set times for %s\n", FnFilter1(G.filename)));
        else
            Info(slide, 0x201, ((char *)slide,
              " (warning) cannot set times"));
    }

/*---------------------------------------------------------------------------
    Change the file permissions from default ones to those stored in the



( run in 0.694 second using v1.01-cache-2.11-cpan-8dfa8b56332 )