LMMS
Loading...
Searching...
No Matches
unzip.c File Reference
#include "unzip.h"
#include "crypt.h"
#include "unzvers.h"
#include "unzipfx/appDetails.h"
#include "consts.h"

Macros

#define __UNZIP_C   /* identifies this source module */
#define UNZIP_INTERNAL
#define UnzipUsageLine1v   UnzipUsageLine1
#define ZIPINFO_MODE_OPTION   "[-Z] "
#define SET_SIGHANDLER(sigtype, newsighandler)
#define QUOT   ' '
#define QUOTS   ""

Functions

static void help_extended OF ((__GPRO))
int MAIN (int argc, argv)
int unzip (__G__ argc, argv) __GDEF int argc
 SETLOCALE (LC_CTYPE, "C")
 for (p=argv[0]+strlen(argv[0]);p >=argv[0];--p)
 if (STRNICMP(p, LoadFarStringSmall(Zipnfo), 7)==0||STRNICMP(p, "ii", 2)==0||(argc > 1 &&strncmp(argv[1], "-Z", 2)==0))
 if ((error=envargs(&argc, &argv, LoadFarStringSmall(EnvUnZip), LoadFarStringSmall2(EnvUnZip2))) !=PK_OK)
 if ((argc< 0)||error)
 if (argc > 0)
 if (uO.exdir !=(char *) NULL &&!G.extract_flag)
int usage (__G__ error) __GDEF int error
 if (uO.zipinfo_mode)
 Info (slide, flag,((char *) slide, LoadFarString(UnzipUsageLine2), ZIPINFO_MODE_OPTION, LoadFarStringSmall(ZipInfoMode)))
 Info (slide, flag,((char *) slide, LoadFarString(UnzipUsageLine3), LoadFarStringSmall(local1)))
 Info (slide, flag,((char *) slide, LoadFarString(UnzipUsageLine4), LoadFarStringSmall(local2), LoadFarStringSmall2(local3)))
 Info (slide, flag,((char *) slide, LoadFarString(UnzipUsageLine5), LoadFarStringSmall(Example2), LoadFarStringSmall2(Example3), LoadFarStringSmall2(Example3)))
 if (error)
char * getenv ()
static void show_version_info (__G)

Variables

static ZCONST char Far EnvUnZip [] = ENV_UNZIP
static ZCONST char Far EnvUnZip2 [] = ENV_UNZIP2
static ZCONST char Far EnvZipInfo [] = ENV_ZIPINFO
static ZCONST char Far EnvZipInfo2 [] = ENV_ZIPINFO2
static ZCONST char Far NoMemEnvArguments []
static ZCONST char Far CmdLineParamTooLong []
static ZCONST char Far NotExtracting []
static ZCONST char Far MustGiveExdir []
static ZCONST char Far OnlyOneExdir []
static ZCONST char Far MustGivePasswd []
static ZCONST char Far Zfirst []
static ZCONST char Far InvalidOptionsMsg []
static ZCONST char Far IgnoreOOptionMsg []
static ZCONST char Far Example3 [] = "ReadMe"
static ZCONST char Far Example2 []
static ZCONST char Far local1 [] = ""
static ZCONST char Far local2 [] = " -M pipe through \"more\" pager"
static ZCONST char Far local3 [] = "\n"
static ZCONST char Far ZipInfoExample [] = "*, ?, [] (e.g., \"[a-j]*.zip\")"
static ZCONST char Far ZipInfoUsageLine1 []
static ZCONST char Far ZipInfoUsageLine2 []
static ZCONST char Far ZipInfoUsageLine3 []
static ZCONST char Far ZipInfoUsageLine4 []
static ZCONST char Far CompileOptions []
static ZCONST char Far CompileOptFormat [] = " %s\n"
static ZCONST char Far EnvOptions []
static ZCONST char Far EnvOptFormat [] = "%16s: %.1024s\n"
static ZCONST char Far None [] = "[none]"
static ZCONST char Far Copyright_Clean []
static ZCONST char Far Use_Unshrink []
static ZCONST char Far Use_Deflate64 []
static ZCONST char Far VmsTextConv [] = "VMS_TEXT_CONV"
static ZCONST char Far Decryption []
static ZCONST char Far CryptDate [] = CR_VERSION_DATE
static ZCONST char Far UnzipUsageLine1 []
static ZCONST char Far UnzipUsageLine2v []
static ZCONST char Far UnzipUsageLine2 []
static ZCONST char Far ZipInfoMode []
static ZCONST char Far UnzipUsageLine3 []
static ZCONST char Far UnzipUsageLine4 []
static ZCONST char Far UnzipUsageLine5 []
char * argv []
int i
int retcode
int error =FALSE
G noargs = (argc == 1)
 p
 else
G wildzipfn = *argv++
G filespecs = argc
G xfilespecs = 0
else G process_all_files = TRUE

Macro Definition Documentation

◆ __UNZIP_C

#define __UNZIP_C   /* identifies this source module */

◆ QUOT

#define QUOT   ' '

◆ QUOTS

#define QUOTS   ""

◆ SET_SIGHANDLER

#define SET_SIGHANDLER ( sigtype,
newsighandler )
Value:
signal((sigtype), (newsighandler))

◆ UNZIP_INTERNAL

#define UNZIP_INTERNAL

◆ UnzipUsageLine1v

#define UnzipUsageLine1v   UnzipUsageLine1

◆ ZIPINFO_MODE_OPTION

#define ZIPINFO_MODE_OPTION   "[-Z] "

Function Documentation

◆ for()

for ( p = argv[0] + strlen(argv[0]); p >= argv[0]; --p)

◆ getenv()

char * getenv ( )
extern

◆ if() [1/7]

if ( (argc< 0)|| error)

◆ if() [2/7]

◆ if() [3/7]

if ( argc ,
0  )

◆ if() [4/7]

if ( error )

◆ if() [5/7]

if ( STRNICMP(p, LoadFarStringSmall(Zipnfo), 7) = = 0 || STRNICMP(p, "ii", 2) == 0 || (argc > 1 && strncmp(argv[1], "-Z", 2) == 0))

◆ if() [6/7]

if ( uO.exdir ! = (char *)NULL && !G.extract_flag)

◆ if() [7/7]

if ( uO. zipinfo_mode)

◆ Info() [1/4]

◆ Info() [2/4]

◆ Info() [3/4]

◆ Info() [4/4]

◆ MAIN()

int MAIN ( int argc,
argv  )

◆ OF()

void help_extended OF ( (__GPRO) )
static

◆ SETLOCALE()

SETLOCALE ( LC_CTYPE ,
"C"  )

◆ show_version_info()

void show_version_info ( __G )
static

◆ unzip()

int unzip ( __G__ argc,
argv  )

◆ usage()

int usage ( __G__ error)

Variable Documentation

◆ CmdLineParamTooLong

ZCONST char Far CmdLineParamTooLong[]
static
Initial value:
=
"error: command line parameter #%d exceeds internal size limit\n"

◆ CompileOptFormat

ZCONST char Far CompileOptFormat[] = " %s\n"
static

◆ CompileOptions

ZCONST char Far CompileOptions[]
static
Initial value:
=
"UnZip special compilation options:\n"

◆ Copyright_Clean

ZCONST char Far Copyright_Clean[]
static
Initial value:
=
"COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)"

◆ CryptDate

ZCONST char Far CryptDate[] = CR_VERSION_DATE
static

◆ Decryption

ZCONST char Far Decryption[]
static
Initial value:
=
" [decryption, version %d.%d%s of %s]\n"

◆ else

else
Initial value:
{
uO.zipinfo_mode = FALSE
#define uO
Definition globals.h:441
#define FALSE
Definition unzpriv.h:1298

◆ EnvOptFormat

ZCONST char Far EnvOptFormat[] = "%16s: %.1024s\n"
static

◆ EnvOptions

ZCONST char Far EnvOptions[]
static
Initial value:
=
"\nUnZip and ZipInfo environment options:\n"

◆ EnvUnZip

ZCONST char Far EnvUnZip[] = ENV_UNZIP
static

◆ EnvUnZip2

ZCONST char Far EnvUnZip2[] = ENV_UNZIP2
static

◆ EnvZipInfo

ZCONST char Far EnvZipInfo[] = ENV_ZIPINFO
static

◆ EnvZipInfo2

ZCONST char Far EnvZipInfo2[] = ENV_ZIPINFO2
static

◆ error

int error =FALSE

◆ Example2

ZCONST char Far Example2[]
static
Initial value:
= " \
unzip -p foo | more => send contents of foo.zip via pipe into program more\n"

◆ Example3

ZCONST char Far Example3[] = "ReadMe"
static

◆ filespecs

G filespecs = argc

◆ i

int i
Initial value:
{
char *p
uch * p
Definition crypt.c:594

◆ IgnoreOOptionMsg

ZCONST char Far IgnoreOOptionMsg[]
static
Initial value:
=
"caution: both -n and -o specified; ignoring -o\n"

◆ InvalidOptionsMsg

ZCONST char Far InvalidOptionsMsg[]
static
Initial value:
= "error:\
-fn or any combination of -c, -l, -p, -t, -u and -v options invalid\n"

◆ local1

ZCONST char Far local1[] = ""
static

◆ local2

ZCONST char Far local2[] = " -M pipe through \"more\" pager"
static

◆ local3

ZCONST char Far local3[] = "\n"
static

◆ MustGiveExdir

ZCONST char Far MustGiveExdir[]
static
Initial value:
=
"error: must specify directory to which to extract with -d option\n"

◆ MustGivePasswd

ZCONST char Far MustGivePasswd[]
static
Initial value:
=
"error: must give decryption password with -P option\n"

◆ noargs

G noargs = (argc == 1)

◆ NoMemEnvArguments

ZCONST char Far NoMemEnvArguments[]
static
Initial value:
=
"envargs: cannot get memory for arguments"

◆ None

ZCONST char Far None[] = "[none]"
static

◆ NotExtracting

ZCONST char Far NotExtracting[]
static
Initial value:
=
"caution: not extracting; -d ignored\n"

◆ OnlyOneExdir

ZCONST char Far OnlyOneExdir[]
static
Initial value:
=
"error: -d option used more than once (only one exdir allowed)\n"

◆ p

p

◆ process_all_files

else G process_all_files = TRUE

◆ retcode

int retcode

◆ UnzipUsageLine1

ZCONST char Far UnzipUsageLine1[]
static
Initial value:
= "\
UnZip %d.%d%d%s of %s, by Info-ZIP. Maintained by C. Spieler. Send\n\
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.\
\n\n"

◆ UnzipUsageLine2

ZCONST char Far UnzipUsageLine2[]
static
Initial value:
= "\
Usage: unzip %s[-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]\n \
Default action is to extract files in list, except those in xlist, to exdir;\n\
file[.zip] may be a wildcard. %s\n"

◆ UnzipUsageLine2v

ZCONST char Far UnzipUsageLine2v[]
static
Initial value:
= "\
Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;\
\nsee ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.\
\n\n"

◆ UnzipUsageLine3

ZCONST char Far UnzipUsageLine3[]
static
Initial value:
= "\n\
-p extract files to pipe, no messages -l list files (short format)\n\
-f freshen existing files, create none -t test compressed archive data\n\
-u update files, create if necessary -z display archive comment only\n\
-v list verbosely/show version info %s\n\
-x exclude files that follow (in xlist) -d extract files into exdir\n"

◆ UnzipUsageLine4

ZCONST char Far UnzipUsageLine4[]
static
Initial value:
= "\
modifiers:\n\
-n never overwrite existing files -q quiet mode (-qq => quieter)\n\
-o overwrite files WITHOUT prompting -a auto-convert any text files\n\
-j junk paths (do not make directories) -aa treat ALL files as text\n\
-C match filenames case-insensitively -L make (some) names \
lowercase\n %-42s -V retain VMS version numbers\n%s"

◆ UnzipUsageLine5

ZCONST char Far UnzipUsageLine5[]
static
Initial value:
= "\
See \"unzip -hh\" or unzip.txt for more help. Examples:\n\
unzip data1 -x joe => extract all files except joe from zipfile data1.zip\n\
%s\
unzip -fo foo %-6s => quietly replace existing %s if archive file newer\n"

◆ Use_Deflate64

ZCONST char Far Use_Deflate64[]
static
Initial value:
=
"USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)"

◆ Use_Unshrink

ZCONST char Far Use_Unshrink[]
static
Initial value:
=
"USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)"

◆ VmsTextConv

ZCONST char Far VmsTextConv[] = "VMS_TEXT_CONV"
static

◆ wildzipfn

G wildzipfn = *argv++

◆ xfilespecs

G xfilespecs = 0

◆ Zfirst

ZCONST char Far Zfirst[]
static
Initial value:
=
"error: -Z must be first option for ZipInfo mode (check UNZIP variable?)\n"

◆ ZipInfoExample

ZCONST char Far ZipInfoExample[] = "*, ?, [] (e.g., \"[a-j]*.zip\")"
static

◆ ZipInfoMode

ZCONST char Far ZipInfoMode[]
static
Initial value:
=
"-Z => ZipInfo mode (\"unzip -Z\" for usage)."

◆ ZipInfoUsageLine1

ZCONST char Far ZipInfoUsageLine1[]
static
Initial value:
= "\
ZipInfo %d.%d%d%s of %s, by Greg Roelofs and the Info-ZIP group.\n\
\n\
List name, date/time, attribute, size, compression method, etc., about files\n\
in list (excluding those in xlist) contained in the specified .zip archive(s).\
\n\"file[.zip]\" may be a wildcard name containing %s.\n\n\
usage: zipinfo [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]\n\
or: unzip %s-Z%s [-12smlvChMtTz] file[.zip] [list...] [-x xlist...]\n"

◆ ZipInfoUsageLine2

ZCONST char Far ZipInfoUsageLine2[]
static
Initial value:
= "\nmain\
listing-format options: -s short Unix \"ls -l\" format (def.)\n\
-1 filenames ONLY, one per line -m medium Unix \"ls -l\" format\n\
-2 just filenames but allow -h/-t/-z -l long Unix \"ls -l\" format\n\
-v verbose, multi-page format\n"

◆ ZipInfoUsageLine3

ZCONST char Far ZipInfoUsageLine3[]
static
Initial value:
= "miscellaneous options:\n\
-h print header line -t print totals for listed files or for all\n\
-z print zipfile comment -T print file times in sortable decimal format\
\n -C be case-insensitive %s\
-x exclude filenames that follow from listing\n"

◆ ZipInfoUsageLine4

ZCONST char Far ZipInfoUsageLine4[]
static
Initial value:
=
" -M page output through built-in \"more\"\n"