Archive-Unzip-Burst

 view release on metacpan or  search on metacpan

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

        if (ind && conp && sendpkt(conp, ACTION_DISK_INFO, &argp, 1))
            conunit = (void *) ((struct IOStdReq *) ind->id_InUse)->io_Unit;
        if (ind)
            FreeMem(ind, sizeof(*ind));
        if (conunit) {
            if (ttrows) *ttrows = conunit->cu_YMax + 1;
            if (ttcols) *ttcols = conunit->cu_XMax + 1;
            return 0;     /* success */
        }
    }
    if (ttrows) *ttrows = INT_MAX;
    if (ttcols) *ttcols = INT_MAX;
    return 1;             /* failure */
}


#ifdef AMIGA_VOLUME_LABELS
/* This function is for if we someday implement -$ on the Amiga. */
#  include <dos/dosextens.h>
#  include <dos/filehandler.h>
#  include <clib/macros.h>

BOOL is_floppy(ZCONST char *path)
{
    BOOL okay = FALSE;
    char devname[32], *debna;
    ushort i;
    BPTR lok = Lock((char *)path, ACCESS_READ), pok;
    struct FileSysStartupMsg *fart;
    struct DeviceNode *debb, devlist = (void *) BADDR((struct DosInfo *)
                                BADDR(DOSBase->dl_Root->rn_Info)->di_DevInfo);
    if (!lok)
        return FALSE;                   /* should not happen */
    if (pok = ParentDir((char *)path)) {
        UnLock(lok);
        UnLock(pok);
        return FALSE;                   /* it's not a root directory path */
    }
    Forbid();
    for (debb = devlist; debb; debb = BADDR(debb->dn_Next))
        if (debb->dn_Type == DLT_DEVICE && (debb->dn_Task == lick->fl_Task))
            if (fart = BADDR(debb->dn_Startup)) {
                debna = (char *) BADDR(fart->fssm_Device) + 1;
                if ((i = debna[-1]) > 31) i = 30;
                strncpy(devname, debna, i);
                devname[i] = 0;
                okay = !strcmp(devname, "trackdisk.device")
                                || !strcmp(devname, "mfm.device")
                                || !strcmp(devname, "messydisk.device");
                break;  /* We only support obvious floppy drives, not tricky */
            }           /* things like removable cartrige hard drives, or    */
    Permit();           /* any unusual kind of floppy device driver.         */
    return okay;
}
#endif /* AMIGA_VOLUME_LABELS */


#ifndef SFX

# if 0
/* As far as I can tell, all the locales AmigaDOS 2.1 knows about all */
/* happen to use DF_MDY ordering, so there's no point in using this.  */

/*************************/
/* Function dateformat() */
/*************************/

#include <clib/locale_protos.h>
#ifdef AZTEC_C
#  include <pragmas/locale_lib.h>
#endif

int dateformat()
{
/*---------------------------------------------------------------------------
    For those operating systems which support it, this function returns a
    value which tells how national convention says that numeric dates are
    displayed.  Return values are DF_YMD, DF_DMY and DF_MDY (the meanings
    should be fairly obvious).
  ---------------------------------------------------------------------------*/
    struct Library *LocaleBase;
    struct Locale *ll;
    int result = DF_MDY;        /* the default */

    if ((LocaleBase = OpenLibrary("locale.library", 0))) {
        if (ll = OpenLocale(NULL)) {
            uch *f = ll->loc_ShortDateFormat;
            /* In this string, %y|%Y is year, %b|%B|%h|%m is month, */
            /* %d|%e is day day, and %D|%x is short for mo/da/yr.   */
            if (!strstr(f, "%D") && !strstr(f, "%x")) {
                uch *da, *mo, *yr;
                if (!(mo = strstr(f, "%b")) && !(mo = strstr(f, "%B"))
                                    && !(mo = strstr(f, "%h")))
                    mo = strstr(f, "%m");
                if (!(da = strstr(f, "%d")))
                    da = strstr(f, "%e");
                if (!(yr = strstr(f, "%y")))
                    yr = strstr(f, "%Y");
                if (yr && yr < mo)
                    result = DF_YMD;
                else if (da && da < mo)
                    result = DF_DMY;
            }
            CloseLocale(ll);
        }
        CloseLibrary(LocaleBase);
    }
    return result;
}

# endif /* 0 */


/************************/
/*  Function version()  */
/************************/


/* NOTE:  the following include depends upon the environment
 *        variable $Workbench to be set correctly.  (Set by
 *        default, by kickstart during startup)
 */
int WBversion = (int)
#include "ENV:Workbench"
;

void version(__G)
   __GDEF
{
/* Define buffers. */

   char buf1[16];  /* compiler name */
   char buf2[16];  /* revstamp */
   char buf3[16];  /* OS */
   char buf4[16];  /* Date */
/*   char buf5[16];  /* Time */

/* format "with" name strings */

#ifdef AMIGA
# ifdef __SASC
   strcpy(buf1,"SAS/C ");
# else
#  ifdef LATTICE
    strcpy(buf1,"Lattice C ");



( run in 1.475 second using v1.01-cache-2.11-cpan-800906f7e73 )