Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

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

#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() */



/*****************************/
/*  Strings used in msdos.c  */
/*****************************/

#ifndef SFX
  static ZCONST char Far CantAllocateWildcard[] =
    "warning:  cannot allocate wildcard buffers\n";
#endif
static ZCONST char Far WarnDirTraversSkip[] =
  "warning:  skipped \"../\" path component(s) in %s\n";
static ZCONST char Far Creating[] = "   creating: %s\n";
static ZCONST char Far ConversionFailed[] =
  "mapname:  conversion of %s failed\n";
static ZCONST char Far Labelling[] = "labelling %c: %-22s\n";
static ZCONST char Far ErrSetVolLabel[] =
  "mapname:  error setting volume label\n";
static ZCONST char Far PathTooLong[] = "checkdir error:  path too long: %s\n";
static ZCONST char Far CantCreateDir[] = "checkdir error:  cannot create %s\n\
                 unable to process %s.\n";
static ZCONST char Far DirIsntDirectory[] =
  "checkdir error:  %s exists but is not directory\n\
                 unable to process %s.\n";
static ZCONST char Far PathTooLongTrunc[] =
  "checkdir warning:  path too long; truncating\n                   %s\n\
                -> %s\n";
#if (!defined(SFX) || defined(SFX_EXDIR))
   static ZCONST char Far CantCreateExtractDir[] =
     "checkdir:  cannot create extraction directory: %s\n";
#endif
static ZCONST char Far AttribsMayBeWrong[] =
  "\nwarning:  file attributes may not be correct\n";
#if (!defined(SFX) && !defined(WINDLL))
   static ZCONST char Far WarnUsedOnWindows[] =
     "\n%s warning: You are using the MSDOS version on Windows.\n"
     "Please try the native Windows version before reporting any problems.\n";
#endif



/****************************/
/*  Macros used in msdos.c  */
/****************************/

#ifdef WATCOMC_386
#  define WREGS(v,r) (v.w.r)
#  define int86x int386x
   static int int86x_realmode(int inter_no, union REGS *in,
                              union REGS *out, struct SREGS *seg);
#  define F_intdosx(ir,or,sr) int86x_realmode(0x21, ir, or, sr)
#  define XXX__MK_FP_IS_BROKEN
#else
#  if (defined(__DJGPP__) && (__DJGPP__ >= 2))
#   define WREGS(v,r) (v.w.r)
#  else
#   define WREGS(v,r) (v.x.r)
#  endif
#  define F_intdosx(ir,or,sr) intdosx(ir, or, sr)
#endif

#if (defined(__GO32__) || defined(__EMX__))
#  include <dirent.h>        /* use readdir() */
#  define MKDIR(path,mode)   mkdir(path,mode)
#  define Opendir  opendir
#  define Readdir  readdir
#  define Closedir closedir
#  define zdirent  dirent
#  define zDIR     DIR
#  ifdef __EMX__
#    include <dos.h>
#    define GETDRIVE(d)      d = _getdrive()
#    define FA_LABEL         A_LABEL
#  else
#    define GETDRIVE(d)      _dos_getdrive(&d)
#  endif
#  if defined(_A_SUBDIR)     /* MSC dos.h and compatibles */
#    define FSUBDIR          _A_SUBDIR
#  elif defined(FA_DIREC)    /* Borland dos.h and compatible variants */
#    define FSUBDIR          FA_DIREC
#  elif defined(A_DIR)       /* EMX dir.h (and dirent.h) */
#    define FSUBDIR          A_DIR
#  else                      /* fallback definition */
#    define FSUBDIR          0x10
#  endif
#  if defined(_A_VOLID)      /* MSC dos.h and compatibles */
#    define FVOLID           _A_VOLID
#  elif defined(FA_LABEL)    /* Borland dos.h and compatible variants */
#    define FVOLID           FA_LABEL
#  elif defined(A_LABEL)     /* EMX dir.h (and dirent.h) */
#    define FVOLID           A_LABEL
#  else
#    define FVOLID           0x08
#  endif
#else /* !(__GO32__ || __EMX__) */
#  define MKDIR(path,mode)   mkdir(path)
#  ifdef __TURBOC__
#    define FATTR            FA_HIDDEN+FA_SYSTEM+FA_DIREC
#    define FVOLID           FA_LABEL
#    define FSUBDIR          FA_DIREC
#    define FFIRST(n,d,a)    findfirst(n,(struct ffblk *)d,a)
#    define FNEXT(d)         findnext((struct ffblk *)d)
#    define GETDRIVE(d)      d=getdisk()+1



( run in 0.541 second using v1.01-cache-2.11-cpan-5b529ec07f3 )