Archive-Unzip-Burst
view release on metacpan or search on metacpan
unzip-6.0/msdos/msdos.c view on Meta::CPAN
}
}
if (add_dot) /* had just "x:", make "x:." */
tmproot[rootlen++] = '.';
tmproot[rootlen++] = '/';
tmproot[rootlen] = '\0';
if ((rootpath = (char *)realloc(tmproot, rootlen+1)) == NULL) {
free(tmproot);
rootlen = 0;
return MPN_NOMEM;
}
Trace((stderr, "rootpath now = [%s]\n", FnFilter1(rootpath)));
}
return MPN_OK;
}
#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 MPN_OK;
}
return MPN_INVALID; /* should never reach */
} /* end function checkdir() */
/***********************/
/* Function isfloppy() */
/***********************/
static int isfloppy(nDrive) /* more precisely, is it removable? */
int nDrive;
{
union REGS regs;
regs.h.ah = 0x44;
regs.h.al = 0x08;
regs.h.bl = (uch)nDrive;
#ifdef __EMX__
_int86(0x21, ®s, ®s);
if (WREGS(regs,flags) & 1)
#else
intdos(®s, ®s);
if (WREGS(regs,cflag)) /* error: do default a/b check instead */
#endif
{
Trace((stderr,
"error in DOS function 0x44 (AX = 0x%04x): guessing instead...\n",
(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() */
( run in 0.589 second using v1.01-cache-2.11-cpan-e1769b4cff6 )