Archive-Unzip-Burst
view release on metacpan or search on metacpan
unzip-6.0/beos/beos.c view on Meta::CPAN
FnFilter2(G.buildpath), FnFilter1(G.filename)));
free(G.buildpath);
/* path existed but wasn't dir */
return MPN_ERR_SKIP;
}
if (too_long) {
Info(slide, 1, ((char *)slide,
"checkdir error: path too long: %s\n", FnFilter1(G.buildpath)));
free(G.buildpath);
/* no room for filenames: fatal */
return MPN_ERR_TOOLONG;
}
*G.end++ = '/';
*G.end = '\0';
Trace((stderr, "buildpath now = [%s]\n", FnFilter1(G.buildpath)));
return MPN_OK;
} /* end if (FUNCTION == APPEND_DIR) */
/*---------------------------------------------------------------------------
GETPATH: copy full path to the string pointed at by pathcomp, and free
G.buildpath.
---------------------------------------------------------------------------*/
if (FUNCTION == GETPATH) {
strcpy(pathcomp, G.buildpath);
Trace((stderr, "getting and freeing path [%s]\n",
FnFilter1(pathcomp)));
free(G.buildpath);
G.buildpath = G.end = (char *)NULL;
return MPN_OK;
}
/*---------------------------------------------------------------------------
APPEND_NAME: assume the path component is the filename; append it and
return without checking for existence.
---------------------------------------------------------------------------*/
if (FUNCTION == APPEND_NAME) {
#ifdef SHORT_NAMES
char *old_end = end;
#endif
Trace((stderr, "appending filename [%s]\n", FnFilter1(pathcomp)));
while ((*G.end = *pathcomp++) != '\0') {
++G.end;
#ifdef SHORT_NAMES /* truncate name at 14 characters, typically */
if ((G.end-old_end) > FILENAME_MAX) /* GRR: proper constant? */
*(G.end = old_end + FILENAME_MAX) = '\0';
#endif
if ((G.end-G.buildpath) >= FILNAMSIZ) {
*--G.end = '\0';
Info(slide, 0x201, ((char *)slide,
"checkdir warning: path too long; truncating\n\
%s\n -> %s\n",
FnFilter1(G.filename), FnFilter2(G.buildpath)));
return MPN_INF_TRUNC; /* filename truncated */
}
}
Trace((stderr, "buildpath now = [%s]\n", FnFilter1(G.buildpath)));
/* could check for existence here, prompt for new name... */
return MPN_OK;
}
/*---------------------------------------------------------------------------
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.
---------------------------------------------------------------------------*/
/* GRR: for VMS and TOPS-20, add up to 13 to strlen */
if (FUNCTION == INIT) {
Trace((stderr, "initializing buildpath to "));
#ifdef ACORN_FTYPE_NFS
if ((G.buildpath = (char *)malloc(strlen(G.filename)+G.rootlen+
(uO.acorn_nfs_ext ? 5 : 1)))
#else
if ((G.buildpath = (char *)malloc(strlen(G.filename)+G.rootlen+1))
#endif
== (char *)NULL)
return MPN_NOMEM;
if ((G.rootlen > 0) && !G.renamed_fullpath) {
strcpy(G.buildpath, G.rootpath);
G.end = G.buildpath + G.rootlen;
} else {
*G.buildpath = '\0';
G.end = G.buildpath;
}
Trace((stderr, "[%s]\n", FnFilter1(G.buildpath)));
return MPN_OK;
}
/*---------------------------------------------------------------------------
ROOT: if appropriate, store the path in rootpath and create it if
necessary; 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.
---------------------------------------------------------------------------*/
#if (!defined(SFX) || defined(SFX_EXDIR))
if (FUNCTION == ROOT) {
Trace((stderr, "initializing root path to [%s]\n",
FnFilter1(pathcomp)));
if (pathcomp == (char *)NULL) {
G.rootlen = 0;
return MPN_OK;
}
if (G.rootlen > 0) /* rootpath was already set, nothing to do */
return MPN_OK;
if ((G.rootlen = strlen(pathcomp)) > 0) {
char *tmproot;
if ((tmproot = (char *)malloc(G.rootlen+2)) == (char *)NULL) {
G.rootlen = 0;
return MPN_NOMEM;
}
strcpy(tmproot, pathcomp);
if (tmproot[G.rootlen-1] == '/') {
tmproot[--G.rootlen] = '\0';
}
( run in 0.762 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )