Archive-Unzip-Burst
view release on metacpan or search on metacpan
unzip-6.0/msdos/msdos.c view on Meta::CPAN
struct SREGS sregs;
union REGS regs;
#ifdef WATCOMC_386
ush seg, para;
memset(&sregs, 0, sizeof(sregs));
memset(®s, 0, sizeof(regs));
/* PMODE/W does not support an extended version of dos function 38, */
/* so we have to use brute force, allocating real mode memory for it. */
regs.w.ax = 0x0100;
regs.w.bx = 3; /* 36 bytes rounds up to 48 */
int386(0x31, ®s, ®s); /* DPMI allocate DOS memory */
if (regs.w.cflag)
return DF_MDY; /* no memory, return default */
seg = regs.w.dx;
para = regs.w.ax;
#ifdef XXX__MK_FP_IS_BROKEN
/* XXX This code may not be trustworthy in general, though it is
* valid with DOS/4GW and PMODE/w, which is all we support for now. */
/* _CountryInfo = (ush far *) (para << 4); */ /* works for some extenders */
regs.w.ax = 6;
regs.w.bx = seg;
int386(0x31, ®s, ®s); /* convert seg to linear address */
_CountryInfo = (ush far *) (((ulg) regs.w.cx << 16) | regs.w.dx);
#else
_CountryInfo = (ush far *) MK_FP(seg, 0);
#endif
sregs.ds = para; /* real mode paragraph */
regs.w.dx = 0; /* no offset from segment */
regs.w.ax = 0x3800;
int86x_realmode(0x21, ®s, ®s, &sregs);
CountryInfo[0] = regs.w.cflag ? 0 : _CountryInfo[0];
regs.w.ax = 0x0101;
regs.w.dx = seg;
int386(0x31, ®s, ®s); /* DPMI free DOS memory */
#else /* !WATCOMC_386 */
sregs.ds = FP_SEG(_CountryInfo);
regs.x.dx = FP_OFF(_CountryInfo);
regs.x.ax = 0x3800;
intdosx(®s, ®s, &sregs);
#endif /* ?WATCOMC_386 */
#else /* __GO32__ || __EMX__ */
_dos_getcountryinfo(CountryInfo);
#endif /* ?(__GO32__ || __EMX__) */
switch(CountryInfo[0]) {
case 0:
return DF_MDY;
case 1:
return DF_DMY;
case 2:
return DF_YMD;
}
#endif /* !WINDLL */
return DF_MDY; /* default for systems without locale info */
} /* end function dateformat() */
#ifndef WINDLL
/**************************************/
/* Function is_running_on_windows() */
/**************************************/
static int is_running_on_windows(void)
{
char *var = getenv("OS");
/* if the OS env.var says 'Windows_NT' then */
/* we're likely running on a variant of WinNT */
if ((var != NULL) && (strcmp("Windows_NT", var) == 0))
return TRUE;
/* if the windir env.var is non-null then */
/* we're likely running on a variant of Win9x */
/* DOS mode of Win9x doesn't define windir, only winbootdir */
/* NT's command.com can't see lowercase env. vars */
var = getenv("windir");
if ((var != NULL) && (var[0] != '\0'))
return TRUE;
return FALSE;
}
/**********************************/
/* Function check_for_windows() */
/**********************************/
void check_for_windows(ZCONST char *app)
{
#ifdef SMALL_MEM
char msg_str[160]; /* enough space for two 79-char-lines */
(void)zfstrcpy(msg_buf, WarnUsedOnWindows)
#else
# define msg_str WarnUsedOnWindows
#endif
/* Print a warning for users running under Windows */
/* to reduce bug reports due to running DOS version */
/* under Windows, when Windows version usually works correctly */
if (is_running_on_windows())
printf(msg_str, app);
} /* end function check_for_windows() */
/************************/
/* Function version() */
/************************/
void version(__G)
__GDEF
( run in 0.996 second using v1.01-cache-2.11-cpan-85f18b9d64f )