Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

unzip-6.0/History.600  view on Meta::CPAN

 - Where: used the newer version from UnZip 5.52 [Chr. Spieler]

6.00c13 (02 Oct 05):
 - AOS/VS, Atari, AtheOS, BeOS, UNIX: fixed symlink code by avoiding fclose()
    on NULL handle in extract.c [Dan Yefimov]
 - AOS/VS, Atari, AtheOS, BeOS, UNIX (and unzpriv.h, fileio.c): modified the
    symlink code to use the opened outfile handle for re-reading the symlink
    target data; modified open_outfile to allow read access on outfile handle
    (security fix against "ToCToU" vulnerability) [Chr. Spieler]
 - UNIX (unix.c, Makefile, configure): fixed "ToCToU" security vulnerability
    in close_outfile by using fchown() & fchmod() instead of chown() & chmod()
    (only when available); added check for function existence to configure
    [Dan Yefimov, Matthias Scheler, Chr. Spieler]
 - fileio.c - open_outfile(): deny access for group&world to currently open
    outfile on all systems that support umask() (AOS/VS, Atari, AtheOS, BeOS,
    QDOS, Tandem, UNIX) [Chr. Spieler]
 - unzpriv.h, fileio.c - open_outfile(): open outfile in "write update" mode
    when supporting symlinks or QLZIP extensions; these features require the
    ability to reread the opened outfile [Chr. Spieler]
 - fileio.c: added WriteTxtErr() macro to allow differenciating between
    text-mode write function calls (in UzpMessagePrnt()) and binary write calls

unzip-6.0/History.600  view on Meta::CPAN

    loading the callback function.  [Steven M. Schweda]
 - vms/NOTES.TXT: cleaned up wording of the Symbolic Links section. [SMS]
 - extract.c, fileio.c, process.c, unzpriv.h: fixed recognition of "native
    UTF-8" general purpose flag bit 11 when processing local header, added
    check against mismatching central vs. local GPFlag bit 11 (not for SFX)
    with warning display (suppressible by -q command qualifier).  [C. Spieler]

6.00h02 (16 Apr 09):
 - extract.c: fixed evaluation sequence of check expression by adding correct
    pairs of parentheses.  [EG, SMS]
 - unix/configure: added working check for lchmod.  [SMS]
 - unzip.c: added compile option display for MBCS support.  [Chr. Spieler]
 - unzpriv.h, unix/unxcfg.h, win32/w32cfg.h: the new preprocessor symbol
    NO_MBCS allows to explicitely disable MBCS support.  [Chr. Spieler]
 - INSTALL: documented _MBCS and NO_MBCS preprocessor symbols.  [Chr. Spieler]
 - unix/configure: added checks for MBCS support.  [Chr. Spieler]

6.00h03 (17 Apr 09):
 - unzpriv.h: added missing OF() macro to uzmbclen() prototype.  [SMS]
 - man/*.1: changed revision info to intended release date.  [Chr. Spieler]

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

  zvoid *spark_ef;

  fclose(G.outfile);

  if ((spark_ef = getRISCOSexfield(G.extra_field, G.lrec.extra_field_length))
      != NULL) {
    setRISCOSexfield(G.filename, spark_ef);
  } else {
    unsigned int loadaddr, execaddr;
    int attr;
    int mode=G.pInfo->file_attr&0xffff;   /* chmod equivalent mode */

    time_t m_time;
#ifdef USE_EF_UT_TIME
    iztimes z_utime;
#endif

    /* skip restoring time stamps on user's request */
    if (uO.D_flag <= 1) {
#ifdef USE_EF_UT_TIME
        if (G.extra_field &&

unzip-6.0/acorn/riscos.c  view on Meta::CPAN

 if (SWI_OS_File_6(s)!=NULL) {
   free(s);
   return -1;
 }
 free(s);
 return 0;
}

#endif /* !SFX */

int chmod(char *file, int mode)
{
/*************** NOT YET IMPLEMENTED!!!!!! ******************/
/* I don't know if this will be needed or not... */
 file=file;
 mode=mode;
 return 0;
}

void setfiletype(char *fname,int ftype)
{

unzip-6.0/acorn/riscos.h  view on Meta::CPAN

#define _raw_getc() SWI_OS_ReadC()

extern char *exts2swap; /* Extensions to swap */

int stat(char *filename,struct stat *res);
DIR *opendir(char *dirname);
struct dirent *readdir(DIR *d);
void closedir(DIR *d);
int unlink(char *f);
int rmdir(char *d);
int chmod(char *file, int mode);
void setfiletype(char *fname,int ftype);
void getRISCOSexts(char *envstr);
int checkext(char *suff);
void swapext(char *name, char *exptr);
void remove_prefix(void);
void set_prefix(void);
struct tm *riscos_localtime(const time_t *timer);
struct tm *riscos_gmtime(const time_t *timer);

#endif /* !__riscos_h */

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

             ctime(&m_time)));
#endif

        if (!FileDate(G.filename, &m_time))
            Info(slide, 1, ((char *)slide,
                 "warning:  cannot set the time for %s\n", G.filename));
    }

    /* set file perms after closing (not done at creation)--see mapattr() */

    chmod(G.filename, G.pInfo->file_attr);

    /* give it a filenote from the zipfile comment, if appropriate */

    if (uO.N_flag && G.filenotes[G.filenote_slot]) {
        SetComment(G.filename, G.filenotes[G.filenote_slot]);
        free(G.filenotes[G.filenote_slot]);
        G.filenotes[G.filenote_slot] = NULL;
    }

} /* end function close_outfile() */

unzip-6.0/amiga/stat.c  view on Meta::CPAN

/*
  Copyright (c) 1990-2000 Info-ZIP.  All rights reserved.

  See the accompanying file LICENSE, version 2000-Apr-09 or later
  (the contents of which are also included in zip.h) for terms of use.
  If, for some reason, all these files are missing, the Info-ZIP license
  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
*/
/* Here we have a handmade stat() function because Aztec's c.lib stat() */
/* does not support an st_mode field, which we need... also a chmod().  */

/* This stat() is by Paul Wells, modified by Paul Kienitz. */
/* Originally for use with Aztec C >= 5.0 and Lattice C <= 4.01  */
/* Adapted for SAS/C 6.5x by Haidinger Walter */

/* POLICY DECISION: We will not attempt to remove global variables from */
/* this source file for Aztec C.  These routines are essentially just   */
/* augmentations of Aztec's c.lib, which is itself not reentrant.  If   */
/* we want to produce a fully reentrant UnZip, we will have to use a    */
/* suitable startup module, such as purify.a for Aztec by Paul Kienitz. */

unzip-6.0/amiga/stat.c  view on Meta::CPAN

int fstat(int handle, struct stat *buf)
{
    /* fake some reasonable values for stdin */
    buf->st_mode = (S_IREAD|S_IWRITE|S_IFREG);
    buf->st_size = -1;
    buf->st_mtime = time(&buf->st_mtime);
    return 0;
}


/* opendir(), readdir(), closedir(), rmdir(), and chmod() by Paul Kienitz. */

DIR *opendir(const char *path)
{
    DIR *dd = AllocMem(sizeof(DIR), MEMF_PUBLIC);
    if (!dd) return NULL;
    if (!(dd->d_parentlock = Lock((char *)path, MODE_OLDFILE))) {
        disk_not_mounted = IoErr() == ERROR_DEVICE_NOT_MOUNTED;
        FreeMem(dd, sizeof(DIR));
        return NULL;
    } else

unzip-6.0/amiga/stat.c  view on Meta::CPAN

}


#ifdef AZTEC_C

int rmdir(const char *path)
{
    return (DeleteFile((char *)path) ? 0 : IoErr());
}

int chmod(const char *filename, int bits)       /* bits are as for st_mode */
{
    long protmask = (bits & 0xFF) ^ 0xF;
    return !SetProtection((char *)filename, protmask);
}


/* This here removes unnecessary bulk from the executable with Aztec: */
void _wb_parse(void)  { }

/* fake a unix function that does not apply to amigados: */

unzip-6.0/amiga/z-stat.h  view on Meta::CPAN

extern unsigned short disk_not_mounted;         /* flag set by opendir() */

DIR *opendir(const char *);
void closedir(DIR *);
void close_leftover_open_dirs(void);    /* call this if aborted in mid-run */
struct dirent *readdir(DIR *);
int umask(void);

#ifdef AZTEC_C
int rmdir(const char *);
int chmod(const char *filename, int bits);
#endif

#endif /* __amiga_z_stat_h */

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

#endif /* SYMLINKS */

    fclose(G.outfile);

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

#ifndef NO_CHMOD
    if (chmod(G.filename, 0xffff & G.pInfo->file_attr))
        perror("chmod (file attributes) error");
#endif

/*---------------------------------------------------------------------------
    AOS/VS only allows setting file times at creation but has its own permis-
    sions scheme which is better invoked here if the necessary information
    was in fact stored.  In theory, we should look through an entire series
    of extra fields that might exist for the same file, but we're not going
    to bother.  If we set up other types of extra fields, or if we run into
    other environments that add their own stuff to existing entries in ZIP
    files, we'll have to.  NOTE:  already copied extra-field stuff into

unzip-6.0/atari/Makefile  view on Meta::CPAN

SL2 = $(LF2)

# fUnZip flags
FL = -o funzip$E
FL2 = $(LF2)

# general-purpose stuff
CP = ln -s
LN = ln
RM = rm -f
CHMOD = chmod
STRIP = strip
E = .ttp
O = .o
M = atari
SHELL = /bin/sh

# object files
OBJS1 = unzip$O crc32$O crypt$O envargs$O explode$O
OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O

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

              "warning:  cannot set the time for %s\n",
              FnFilter1(G.filename)));
    }

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

#ifndef NO_CHMOD
    if (chmod(G.filename, 0xffff & G.pInfo->file_attr))
        perror("chmod (file attributes) error");
#endif

} /* end function close_outfile() */




#ifdef TIMESTAMP

/***************************/

unzip-6.0/atheos/Makefile  view on Meta::CPAN


# fUnZip flags
FL = -o funzip
FL2 = $(LF2)

# general-purpose stuff
CP = cp
AS = as
RM = rm -f
LN = ln -sf
CHMOD = chmod
E =
O = .o
M = atheos

OSDEP_H = atheos/athcfg.h

# define

# object files
OBJS1 = unzip$O crc32$O crc_i386$O crypt$O envargs$O explode$O

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

            if (!uO.J_flag) {   /* Handle the AtheOS extra field if present. */
                void *ptr = scanAtheOSexfield(G.extra_field,
                                              G.lrec.extra_field_length);
                if (ptr) {
                    setAtheOSexfield( G.filename, ptr );
                }
            }

#ifndef NO_CHMOD
            /* set approx. dir perms (make sure can still read/write in dir) */
            if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr) | 0700))
                perror("chmod (directory attributes) error");
#endif

            /* set dir time (note trailing '/') */
            return (error & ~MPN_MASK) | MPN_CREATED_DIR;
        }
        if (!uO.J_flag) {   /* Handle the AtheOS extra field if present. */
            void *ptr = scanAtheOSexfield(G.extra_field,
                                          G.lrec.extra_field_length);
            if (ptr) {
                setAtheOSexfield(G.filename, ptr);

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

                  " (warning) cannot set times"));
        }
    }

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

#ifndef NO_CHMOD
    if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
        perror("chmod (file attributes) error");
#endif

} /* end function close_outfile() */




#ifdef SYMLINKS
int set_symlnk_attribs(__G__ slnk_entry)
    __GDEF

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

    if (uO.D_flag <= 0) {
        /* restore directory timestamps */
        if (utime(d->fn, &UxAtt(d)->u.t2)) {
            Info(slide, 0x201, ((char *)slide,
              LoadFarString(DirlistUtimeFailed), FnFilter1(d->fn)));
            if (!errval)
                errval = PK_WARN;
        }
    }
#ifndef NO_CHMOD
    if (chmod(d->fn, filtattr(__G__ UxAtt(d)->perms))) {
        Info(slide, 0x201, ((char *)slide,
          LoadFarString(DirlistChmodFailed), FnFilter1(d->fn)));
        /* perror("chmod (file attributes) error"); */
        if (!errval)
            errval = PK_WARN;
    }
#endif /* !NO_CHMOD */
    return errval;
} /* end function set_direc_attribs() */

#endif /* SET_DIR_ATTRIB */


unzip-6.0/beos/Makefile  view on Meta::CPAN

unzips:		$(UNZIPS)
objs:		$(OBJS)
objsdll:	$(OBJSDLL)
docs:		$(DOCS)
unzipsman:	unzips docs
unzipsdocs:	unzips docs


unzip$E:	$(OBJS) beos/unzip.rsc
	$(LD) $(LF) $(LOBJS) $(LF2)
	chmod +x unzip$E
	xres -o unzip$E beos/unzip.rsc
	mimeset -f -all unzip$E

unzipsfx$E:	$(OBJX) beos/unzipsfx.rsc
	$(LD) $(SL) $(LOBJX) $(SL2)
	chmod +x unzipsfx$E
	xres -o unzipsfx$E beos/unzipsfx.rsc
	mimeset -f -all unzipsfx

funzip$E:	$(OBJF)
	$(LD) $(FL) $(OBJF) $(FL2)
	chmod +x funzip$E

zipinfo$E:	unzip$E
	$(LN) unzip$E zipinfo$E


crc32$O:	crc32.c $(UNZIP_H) zip.h crc32.h
crypt$O:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
envargs$O:	envargs.c $(UNZIP_H)
explode$O:	explode.c $(UNZIP_H)
extract$O:	extract.c $(UNZIP_H) crc32.h crypt.h

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

            if (!uO.J_flag) {   /* Handle the BeOS extra field if present. */
                void *ptr = scanBeOSexfield(G.extra_field,
                                            G.lrec.extra_field_length);
                if (ptr) {
                    setBeOSexfield(G.filename, ptr);
                }
            }

#ifndef NO_CHMOD
            /* set approx. dir perms (make sure can still read/write in dir) */
            if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr) | 0700))
                perror("chmod (directory attributes) error");
#endif

            /* set dir time (note trailing '/') */
            return (error & ~MPN_MASK) | MPN_CREATED_DIR;
        }
        /* TODO: should we re-write the BeOS extra field data in case it's */
        /* changed?  The answer is yes. [Sept 1999 - cjh]                  */
        if (!uO.J_flag) {   /* Handle the BeOS extra field if present. */
            void *ptr = scanBeOSexfield(G.extra_field,
                                        G.lrec.extra_field_length);

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

#endif
        }
    }

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

#ifndef NO_CHMOD
    if (chmod(G.filename, filtattr(__G__ G.pInfo->file_attr)))
        perror("chmod (file attributes) error");
#endif

    /* if -X option was specified and we have UID/GID info, restore it */
    if (have_uidgid_flg
        /* check that both uid and gid values fit into their data sizes */
        && ((ulg)(uid_t)(z_uidgid[0]) == z_uidgid[0])
        && ((ulg)(gid_t)(z_uidgid[1]) == z_uidgid[1])) {
        TTrace((stderr, "close_outfile:  restoring Unix UID/GID info\n"));
        if (chown(G.filename, (uid_t)z_uidgid[0], (gid_t)z_uidgid[1]))
        {

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

    if (uO.D_flag <= 0) {
        /* restore directory timestamps */
        if (utime(d->fn, (const struct utimbuf *)&UxAtt(d)->u.t2)) {
            Info(slide, 0x201, ((char *)slide, CannotSetItemTimestamps,
              FnFilter1(d->fn), strerror(errno)));
            if (!errval)
                errval = PK_WARN;
        }
    }
#ifndef NO_CHMOD
    if (chmod(d->fn, filtattr(__G__ UxAtt(d)->perms))) {
        Info(slide, 0x201, ((char *)slide, DirlistChmodFailed,
          FnFilter1(d->fn), strerror(errno)));
        if (!errval)
            errval = PK_WARN;
    }
#endif /* !NO_CHMOD */
    return errval;
} /* end function set_direc_attribs() */

#endif /* SET_DIR_ATTRIB */

unzip-6.0/cmsmvs/mvs.mki  view on Meta::CPAN

# Rules

all:  $(BLD_P)unzip.mvs$(E)
hfs:  $(BLD_P)unzip$(E)

# link

$(BLD_P)unzip.mvs$(E):     $(OBJECTS)
	$(LD) -o "//INFOZIP.LOAD(UNZIP)" $(LDFLAGS) $^
	echo "tso call \"infozip(unzip)\" \"'\"\"""$$""@""\"\"'\"" > $%
	chmod a+x $%

$(BLD_P)unzip$(E):     $(OBJECTS)
	$(LD) -o $% $(LDFLAGS) $^

# compile

$(BLD_P)api$(O):        $(SRC_P)api.c           $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)api.c

$(BLD_P)apihelp$(O):    $(SRC_P)apihelp.c       $(HFILES)

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

              FnFilter1(G.filename), FnFilter2(tname)));
            free(tname);
        } else
#endif /* UNIXBACKUP */
        {
#ifdef DOS_FLX_OS2_W32
            if (!(G.statbuf.st_mode & S_IWRITE)) {
                Trace((stderr,
                  "open_outfile:  existing file %s is read-only\n",
                  FnFilter1(G.filename)));
                chmod(G.filename, S_IREAD | S_IWRITE);
                Trace((stderr, "open_outfile:  %s now writable\n",
                  FnFilter1(G.filename)));
            }
#endif /* DOS_FLX_OS2_W32 */
#ifdef NLM
            /* Give the file read/write permission (non-POSIX shortcut) */
            chmod(G.filename, 0);
#endif /* NLM */
            if (unlink(G.filename) != 0) {
                Info(slide, 0x401, ((char *)slide,
                  LoadFarString(CannotDeleteOldFile),
                  FnFilter1(G.filename), strerror(errno)));
                return 1;
            }
            Trace((stderr, "open_outfile:  %s now deleted\n",
              FnFilter1(G.filename)));
        }

unzip-6.0/human68k/Makefile  view on Meta::CPAN

	@cat testun/notes
#
	@echo '#####  testing unzip -o and funzip (ignore funzip warning)'
	@./unzip -boq $(TESTZIP) notes -d testun
	@./funzip < $(TESTZIP) > testun/notes2
	@if diff testun/notes testun/notes2; then true; else \
	    echo '#####  ERROR:  funzip output disagrees with unzip'; fi
#
	@echo '#####  testing unzipsfx (self-extractor)'
	@cat unzipsfx.x $(TESTZIP) > testsfx.x
	@chmod 0700 testsfx.x
	@./testsfx -bo notes
	@if diff notes testun/notes; then true; else \
	    echo '#####  ERROR:  unzipsfx file disagrees with unzip'; fi
	@rm -f testsfx.x notes testun/notes testun/notes2
	@rmdir testun
#
	@echo '#####  testing complete.'

# EOF

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

            dos_dt.z_dostime = G.lrec.last_mod_dos_datetime;
        }
        _dos_filedate(fileno(G.outfile), dos_dt.z_dostime);
#else /* !USE_EF_UT_TIME */
        _dos_filedate(fileno(G.outfile), G.lrec.last_mod_dos_datetime);
#endif /* ?USE_EF_UT_TIME */
    }

    fclose(G.outfile);

    _dos_chmod(G.filename, G.pInfo->file_attr);

} /* end function close_outfile() */





#ifdef TIMESTAMP

/*************************/

unzip-6.0/man/unzipsfx.1  view on Meta::CPAN

quiet operation was requested by supplying a \fB-q\fP option.
.PD
.\" =========================================================================
.SH EXAMPLES
To create a self-extracting archive \fIletters\fP from a regular zipfile
\fIletters.zip\fP and change the new archive's permissions to be
world-executable under Unix:
.PP
.EX
cat unzipsfx letters.zip > letters
chmod 755 letters
zip -A letters
.EE
.PP
To create the same archive under MS-DOS, OS/2 or NT (note the use of the
\fB/b\fP [binary] option to the \fIcopy\fP command):
.PP
.EX
copy /b unzipsfx.exe+letters.zip letters.exe
zip -A letters.exe
.EE

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


  Contains:  Opendir()                      (from zip)
             Readdir()                      (from zip)
             do_wild()
             mapattr()
             mapname()
             maskDOSdevice()
             map2fat()
             checkdir()
             isfloppy()
             z_dos_chmod()
             volumelabel()                  (non-djgpp, non-emx)
             close_outfile()
             stamp_file()                   (TIMESTAMP only)
             prepare_ISO_OEM_translat()
             dateformat()
             version()
             zcalloc()                      (16-bit, only)
             zcfree()                       (16-bit, only)
             _dos_getcountryinfo()          (djgpp 1.x, emx)
            [_dos_getftime()                (djgpp 1.x, emx)   to be added]

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

/* fUnZip does not need anything from here except the zcalloc() & zcfree()
 * function pair (when Deflate64 support is enabled in 16-bit environment).
 */
#ifndef FUNZIP

static void maskDOSdevice(__GPRO__ char *pathcomp, char *last_dot);
#ifdef MAYBE_PLAIN_FAT
   static void map2fat OF((char *pathcomp, char *last_dot));
#endif
static int isfloppy OF((int nDrive));
static int z_dos_chmod OF((__GPRO__ ZCONST char *fname, int attributes));
static int volumelabel OF((ZCONST char *newlabel));
#if (!defined(SFX) && !defined(WINDLL))
   static int is_running_on_windows OF((void));
#endif
static int getdoscodepage OF((void));

static int created_dir;        /* used by mapname(), checkdir() */
static int renamed_fullpath;   /* ditto */
static unsigned nLabelDrive;   /* ditto, plus volumelabel() */

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


    if (G.filename[strlen(G.filename) - 1] == '/') {
        checkdir(__G__ G.filename, GETPATH);
        if (created_dir) {
            if (QCOND2) {
                Info(slide, 0, ((char *)slide, LoadFarString(Creating),
                  FnFilter1(G.filename)));
            }

            /* set file attributes: */
            z_dos_chmod(__G__ G.filename, G.pInfo->file_attr);

            /* set dir time (note trailing '/') */
            return (error & ~MPN_MASK) | MPN_CREATED_DIR;
        } else if (IS_OVERWRT_ALL) {
            /* overwrite attributes of existing directory on user's request */

            /* set file attributes: */
            z_dos_chmod(__G__ G.filename, G.pInfo->file_attr);
        }
        /* dir existed already; don't look for data to extract */
        return (error & ~MPN_MASK) | MPN_INF_SKIP;
    }

    *pp = '\0';                   /* done with pathcomp:  terminate it */

    /* if not saving them, remove VMS version numbers (appended ";###") */
    if (!uO.V_flag && lastsemi) {
#ifndef MAYBE_PLAIN_FAT

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

          (unsigned int)(WREGS(regs,ax))));
        return (nDrive == 1 || nDrive == 2)? TRUE : FALSE;
    } else
        return WREGS(regs,ax)? FALSE : TRUE;
}




/**************************/
/* Function z_dos_chmod() */
/**************************/

static int z_dos_chmod(__G__ fname, attributes)
    __GDEF
    ZCONST char *fname;
    int attributes;
{
    char *name;
    unsigned fnamelength;
    int errv;

    /* set file attributes:
       The DOS `chmod' system call requires to mask out the
       directory and volume_label attribute bits.
       And, a trailing '/' has to be removed from the directory name,
       the DOS `chmod' system call does not accept it. */
    fnamelength = strlen(fname);
    if (fnamelength > 1 && fname[fnamelength-1] == '/' &&
        fname[fnamelength-2] != ':' &&
        (name = (char *)malloc(fnamelength)) != (char *)NULL) {
        strncpy(name, fname, fnamelength-1);
        name[fnamelength-1] = '\0';
    } else {
        name = (char *)fname;
        fnamelength = 0;
    }

#if defined(__TURBOC__) || (defined(__DJGPP__) && (__DJGPP__ >= 2))
#   if (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0452))
#     define Chmod  _rtl_chmod
#   else
#     define Chmod  _chmod
#   endif
    errv = (Chmod(name, 1, attributes & (~FSUBDIR & ~FVOLID)) !=
            (attributes & (~FSUBDIR & ~FVOLID)));
#   undef Chmod
#else /* !(__TURBOC__ || (__DJGPP__ && __DJGPP__ >= 2)) */
    errv = (_dos_setfileattr(name, attributes & (~FSUBDIR & ~FVOLID)) != 0);
#endif /* ?(__TURBOC__ || (__DJGPP__ && __DJGPP__ >= 2)) */
    if (errv)
        Info(slide, 1, ((char *)slide, LoadFarString(AttribsMayBeWrong)));

    if (fnamelength > 0)
        free(name);
    return errv;
} /* end function z_dos_chmod() */




#if (!defined(__GO32__) && !defined(__EMX__))

typedef struct dosfcb {
    uch  flag;        /* ff to indicate extended FCB */
    char res[5];      /* reserved */
    uch  vattr;       /* attribute */

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

    }

/*---------------------------------------------------------------------------
    And finally we can close the file...at least everybody agrees on how to
    do *this*.  I think...  Also change the mode according to the stored file
    attributes, since we didn't do that when we opened the dude.
  ---------------------------------------------------------------------------*/

    fclose(G.outfile);

    z_dos_chmod(__G__ G.filename, G.pInfo->file_attr);

} /* end function close_outfile() */





#ifdef TIMESTAMP

/*************************/

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

  ---------------------------------------------------------------------------*/

    if (G.filename[strlen(G.filename) - 1] == '/') {
        checkdir(__G__ G.filename, GETPATH);
        if (created_dir) {
            if (QCOND2) {
                Info(slide, 0, ((char *)slide, "   creating: %s\n",
                  FnFilter1(G.filename)));
            }
#if !defined(NO_CHMOD) && !defined(NLM)
            /* In NetWare, chmod does not work on directories */
            /* set approx. dir perms (make sure can still read/write in dir) */
            if (chmod(G.filename, (0xffff & G.pInfo->file_attr) | 0700))
                perror("chmod (directory attributes) error");
#endif
            /* set dir time (note trailing '/') */
            return (error & ~MPN_MASK) | MPN_CREATED_DIR;
        }
        /* dir existed already; don't look for data to extract */
        return (error & ~MPN_MASK) | MPN_INF_SKIP;
    }

    *pp = '\0';                   /* done with pathcomp:  terminate it */

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

                Info(slide, 0x201, ((char *)slide,
                  " (warning) cannot set times"));
        }
    }

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

    if (chmod(G.filename, 0xffff & G.pInfo->file_attr))
        perror("chmod (file attributes) error");

} /* end function close_outfile() */


#ifdef TIMESTAMP

/***************************/
/*  Function stamp_file()  */
/***************************/

unzip-6.0/proginfo/CONTRIBS  view on Meta::CPAN

  John McDonald          OS/2 zip2exe script
  Gene McManus           -o code
  Joe Meadows            file.c, on which VMSmunch.c (timestamps) was based
  Jason Merrill          Sequent patches
  Tom Metro              corrupted-zipfile handler bugfix
  Ian Miller             VMS makefile portability bugfix (non-standard "edit")
  Steve Miller           Windows CE GUI port; memory leak bugfix; etc.
  Ricky Mobley           Unix makefile entry
  Navin Modi             Unix makefile entry
  Sergio Monesi          Acorn RISC OS port
  Paul Motsuk            Borland _rtl_chmod() fix
  Anthony Naggs          MS-DOS error handling stuff
  Jim Neeland            unused-variables fix; Unix makefile entry
  Harry Nyberg           Macintosh INSTALL info
  Mauricio Ponzo         UNIXBACKUP fix
  NIIMI Satoshi          Human68k port
  Mike O'Carroll         early OS/2 stuff
  Michael D. O'Connor    DOS ifdef/elif mismatch fix; makefile.tc fixes
  "Moby" Dick O'Connor   Unix makefile entry
  Thomas Opheys          Watcom C stat() bugfix
  Humberto Ortiz-Zuazaga Linux port; permissions bugfix; missing declarations
  Keith Owens            MVS support and extensions
  Fernando Papa          inflate memory leaks
  Rafael Pappalardo      Convex CRYPT bugfix; Convex Makefile entry, useful info
  Trevor Paquette        Unix makefile entry
  Keith Petersen         Pyramid fixes; former Info-ZIP list maintainer
  George Petrov          initial MVS, VM/CMS ports (!)
  Alan Phillips          Unix makefile entry
  Art Pina               C Set/2 crypt.c optimization bug
  Piet W. Plomp          Unix chmod()/chown() fix; msc_dos fixes; much testing
  Norbert Pueschel       Amiga timelib
  Clint Pulley           Unix makefile entry
  Antonio Querubin, Jr.  descrip.mms (VMS makefile)
  Alistair Rae           Encore preprocessor bugfix
  Eric S. Raymond        manpage tweaks for DocBook compatibility
  Wally Reiher           timezone bugfix
  Stephen Ritcey         vms/README installation correction
  Phil Ritzenthaler      ANSIfication bugfix
  Simon Roberts          Windows CE 2.1x/3.0 cmdline port
  David Robinson         MSC 6.0 stat() bugfix

unzip-6.0/qdos/IZREADME.SMS  view on Meta::CPAN

loader loads executable files. On most systems where the loader only
loads the actual program part (Unix, VMS, DOS et al), the this is
quite efficient; if you make, say, a 4Mb zipfile and prepend a 30Kb
UnZipSFX image, then the system only loads the 30Kb program and the
process is efficient as the zipped data part is still unpacked from
disk. These systems also supply the running UnZipSFX program stub with
the path name of the file it was loaded from, so the program knows
what it has to unpack (so on Linux, for example):

     cat /usr/bin/unzipsfx test.zip > test.sfx  # concatenate the files
     chmod 755 test.sfx                         # make executable
     test.sfx                                   # to extract, it
                                                # 'knows' it is "test.sfx"

Unfortunately, the more simplistic nature of SMS/QDOS makes this much
more difficult and rather less efficient as: (see note 1)

     a. The SMS/QDOS 'loader' loads the whole file into memory.

     b. The SMS/DOS 'loader'/c68 run-time system does not return the
        name of the file from which it was loaded.

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

    }

    fclose(G.outfile);

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

#ifndef NO_CHMOD
    if (chmod(G.filename, 0xffff & G.pInfo->file_attr))
        perror("chmod (file attributes) error");
#endif

/*---------------------------------------------------------------------------
    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.
  ---------------------------------------------------------------------------*/

unzip-6.0/tandem/README  view on Meta::CPAN

- ZIPINFOC    (exclude TANDEM from tzset() test)
3. Fix to default time/date field to UK format (dd/mm/yyyy)
03/08/98  5.33f   Updates for TANDEMC/H to keep instep with ZIP (file buffering)
                 New DOIT macro for extracting files from archive
                 Fix in2ex to expand full vol/subvol depending on '-j' flag
17/08/98  5.33f   Set USE_EF_UT_TIME to allow for timezone changes
18/08/98  5.33f   Use define LICENSED to build object able to update timestamps
19/08/98  5.33f   Add -X flag support (restore file owner id) via unzip.c/h
                 new chown function in tandem.c.
                 Modified close_outfile to make the chown the last step.
30/11/98  5.41a  Updated mapname/chmod/in2ex, include licensing in MAKE
21/12/98  5.41a  Add decoding of new Tandem extra field EF_TANDEM
                 Make '-a' default option.  Add '-b' option to force creation
                 of 'C' filecode 180 type text files.
                 If available populate Tandem file code (e.g. Object files)
                 Rationalised TANDEMH and TANDEMC wth ZIP 2.3i
                 Fixed MORE (-M flag) processing by creating zgetch()
12/01/99  5.41a  Correct bug stopping setting of last open timestamp
24/03/99  5.41b  Split TANDEMC into TANDEMC/TANZIPC/TANUNZC
24/03/99  5.41b  Added TANNSKH to allow for declarations which require
                 structures defined in ZIPH after call to TANDEMH

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

    result = changelabel(fnum,lasttime.wordtime,opentime.wordtime);
    err = FILE_CLOSE_(fnum);
    return result;
  }
  return -1;
#else  /* !LICENSED */
  return 0;             /* "no error", to suppress annoying failure messages */
#endif  /* ?LICENSED */
}

/* TANDEM version of chmod() function */

int chmod(file, unix_sec)
  const char *file;
  mode_t unix_sec;
{
  FILE *stream;
  struct nsk_sec_type {
    unsigned progid : 1;
    unsigned clear  : 1;
    unsigned null   : 2;
    unsigned read   : 3;
    unsigned write  : 3;

unzip-6.0/tandem/tanunz.c  view on Meta::CPAN

#ifdef DLL
    if (G.redirect_data)
        return (redirect_outfile(__G) == FALSE);
#endif
    if (SSTAT(G.filename, &G.statbuf) == 0) {
        Trace((stderr, "open_outfile:  stat(%s) returns 0:  file exists\n",
          FnFilter1(G.filename)));
        if (unlink(G.filename) != 0) {
            Trace((stderr, "open_outfile:  existing file %s is read-only\n",
              FnFilter1(G.filename)));
            chmod(G.filename, S_IRUSR | S_IWUSR);
            Trace((stderr, "open_outfile:  %s now writable\n",
              FnFilter1(G.filename)));
            if (unlink(G.filename) != 0) {
                Info(slide, 0x401, ((char *)slide,
                  LoadFarString(CannotDeleteOldFile), FnFilter1(G.filename)));
                return 1;
            }
        }
        Trace((stderr, "open_outfile:  %s now deleted\n",
          FnFilter1(G.filename)));

unzip-6.0/tandem/tanunz.c  view on Meta::CPAN

                Info(slide, 0x201, ((char *)slide,
                  " (warning) cannot set times"));
    }

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

#ifndef NO_CHMOD
    if (chmod(G.filename, 0xffff & G.pInfo->file_attr))
        perror("chmod (file attributes) error");
#endif

/*---------------------------------------------------------------------------
       if -X option was specified and we have UID/GID info, restore it
       this must come after the file security and modtimes changes - since once
       we have secured the file to somebody else we cannot access it again.
  ---------------------------------------------------------------------------*/

    if (uO.X_flag && eb_izux_flg & EB_UX2_VALID) {
        TTrace((stderr, "close_outfile:  restoring Unix UID/GID info\n"));

unzip-6.0/theos/stat.h  view on Meta::CPAN


  See the accompanying file LICENSE, version 2000-Apr-09 or later
  (the contents of which are also included in zip.h) for terms of use.
  If, for some reason, all these files are missing, the Info-ZIP license
  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
*/

#ifndef __theos_stat_h
#define __theos_stat_h

/* extended stat structure for stat, fstat, chmod */
/* Written by Jean-Michel Dubois */

#pragma field word
struct stat {
    unsigned short  st_mode;        /* file attributes */
        #define S_IFMT      0xf000      /* file type mask */
        #define S_IFIFO     0x1000      /* pipe */
        #define S_IFCHR     0x2000      /* char device */
        #define S_IFSOCK    0x3000      /* socket */
        #define S_IFDIR     0x4000      /* directory */

unzip-6.0/theos/stat.h  view on Meta::CPAN

#define S_ISREL(m)      (((m) & S_IFMT) == S_IFREL)
#define S_ISKEY(m)      (((m) & S_IFMT) == S_IFKEY)
#define S_ISIND(m)      (((m) & S_IFMT) == S_IFIND)
#define S_ISPRG(m)      (((m) & S_IFMT) >= S_IFP16)
#define S_ISLNK(m)      0

/* avoid conflict with original THEOS functions */

#define stat(a,b)       _stat(a,b)
#define fstat(a,b)      _fstat(a,b)
#define chmod(a,b)      _chmod(a,b)

extern int _stat(const char *file, struct stat *statptr);
extern int _fstat(int fd, struct stat *statptr);
extern int _chmod(const char *file, short mask);

#define _chstat(a,b)    ((int) _sc_168(a,'p',(size_t)(b)))
extern unsigned short   _sc_168(const char _far *fn, int cmd, size_t value);

#endif /* !__theos_stat_h */

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


#endif /* ACORN_FTYPE_NFS */

static int created_dir;        /* used in mapname(), checkdir() */
static int renamed_fullpath;   /* ditto */

#define _FDB_SHARED_EXECUTE_PROTECT _FDB_MODIFIED

uch _um2tm_(ush mask);

int chmodv2_3(const char *fname, short mask)
{
    return _filechange(fname,'p',(size_t) _um2tm_(mask)|0x80);
}

int chlen(char *fname, unsigned short reclen, unsigned short keylen)
{
    size_t a = reclen + ((size_t) keylen << 16);
    return _filechange(fname,'ma',(size_t) &a);
}

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

  return isv2_0() && S_ISLIB_(G.pInfo->file_attr);
}

int isv2_0dir()
{
  return isv2_0() && S_ISDIR_(G.pInfo->file_attr);
}

#define islib() (isv2_0lib() || isv2_3lib())
#define isdir() (isv2_0dir() || isv2_3dir())
#define chmodv2_0(a,b)  ((int) _sc_168(a,'p',(size_t)(b)|0x80))
#undef chmod
#define chmod(a,b) (isv2_0() && chmodv2_0(a,b))||(isv2_3() && chmodv2_3(a,b))
#else
#define islib() isv2_3lib()
#define isdir() isv2_3dir()
#undef chmod
#define chmod(a,b) chmodv2_0(a,b)
#endif

/************************/
/*  Function mapname()  */
/************************/

int mapname(__G__ renamed)
    __GDEF
    int renamed;
/*

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

        else
            Info(slide, 0x201, ((char *)slide,
              " (warning) cannot set times"));
    }

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

    if (chmod(G.filename, 0xffff & G.pInfo->file_attr))
        perror("chmod (file attributes) error");

/*---------------------------------------------------------------------------
    Change the file structure and set native .
  ---------------------------------------------------------------------------*/

    if (isv2_3()) {
        chorg(G.filename, G.extra_field[9]);
        chlen(G.filename,
            (ush) G.extra_field[10] | ((ush) G.extra_field[11] << 8),
            (ush) G.extra_field[12] | ((ush) G.extra_field[13] << 8));

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

    direntry *d;
{
    int errval = PK_OK;

    if (utime(d->fn, &UxAtt(d)->u.t2)) {
        Info(slide, 0x201, ((char *)slide,
          LoadFarString(DirlistUtimeFailed), FnFilter1(d->fn)));
        if (!errval)
            errval = PK_WARN;
    }
    if (chmod(d->fn, 0xffff & UxAtt(d)->perms)) {
        Info(slide, 0x201, ((char *)slide,
          LoadFarString(DirlistChmodFailed), FnFilter1(d->fn)));
        /* perror("chmod (file attributes) error"); */
        if (!errval)
            errval = PK_WARN;
    }
    return errval;
} /* end function set_direc_attribs() */

#endif /* SET_DIR_ATTRIB */



unzip-6.0/unix/Makefile  view on Meta::CPAN


# fUnZip flags
FL = -o funzip$E $(LFLAGS1)
FL2 = $(LF2)

# general-purpose stuff
#CP = cp
CP = ln
LN = ln
RM = rm -f
CHMOD = chmod
BINPERMS = 755
MANPERMS = 644
STRIP = strip
E =
O = .o
M = unix
SHELL = /bin/sh
MAKEF = -f unix/Makefile

# Version info for unix/unix.c



( run in 0.589 second using v1.01-cache-2.11-cpan-496ff517765 )