⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 amiga.c

📁 完整的解压zip文件的源码。包含密码功能
💻 C
📖 第 1 页 / 共 3 页
字号:
        return;  /* close the file *before* setting its time under AmigaDOS */    fclose(G.outfile);#ifdef USE_EF_UT_TIME    if (G.extra_field &&#ifdef IZ_CHECK_TZ        G.tz_is_valid &&#endif        (ef_scan_for_izux(G.extra_field, G.lrec.extra_field_length, 0,                          G.lrec.last_mod_dos_datetime, &z_utime, NULL)         & EB_UT_FL_MTIME))    {        TTrace((stderr, "close_outfile:  Unix e.f. modif. time = %ld\n",                         z_utime.mtime));        m_time = z_utime.mtime;    } else {        /* Convert DOS time to time_t format */        m_time = dos_to_unix_time(G.lrec.last_mod_dos_datetime);    }#else /* !USE_EF_UT_TIME */    /* Convert DOS time to time_t format */    m_time = dos_to_unix_time(G.lrec.last_mod_dos_datetime);#endif /* ?USE_EF_UT_TIME */#ifdef DEBUG    Info(slide, 1, ((char *)slide, "\nclose_outfile(): m_time=%s\n",                         ctime(&m_time)));#endif    if (!FileDate(G.filename, &m_time))        Info(slide, 1, ((char *)slide,             "warning:  cannot set the time for %s\n", G.filename));  /* set file perms after closing (not done at creation)--see mapattr() */    chmod(G.filename, G.pInfo->file_attr);  /* give it a filenote from the zipfile comment, if appropriate */    if (uO.N_flag && G.filenotes[G.filenote_slot]) {        SetComment(G.filename, G.filenotes[G.filenote_slot]);        free(G.filenotes[G.filenote_slot]);        G.filenotes[G.filenote_slot] = NULL;    }} /* end function close_outfile() */#ifdef TIMESTAMP/*************************//* Function stamp_file() *//*************************/int stamp_file(fname, modtime)    ZCONST char *fname;    time_t modtime;{    time_t m_time;    LONG FileDate();    m_time = modtime;    return (FileDate((char *)fname, &m_time));} /* end function stamp_file() */#endif /* TIMESTAMP */#ifndef __SASC/********************************************************************//* Load filedate as a separate external file; it's used by Zip, too.*//*                                                                  */#  include "amiga/filedate.c"                                    /* *//*                                                                  *//********************************************************************//********************* do linewise with stat.c **********************/#  include "amiga/stat.c"/* this is the exact same stat.c used by Zip */#endif /* !__SASC *//* SAS/C makes separate object modules of these; there is less  *//* trouble that way when redefining standard library functions. */#include <stdio.h>void _abort(void)               /* called when ^C is pressed */{    /* echon(); */    close_leftover_open_dirs();    fflush(stdout);    fputs("\n^C\n", stderr);    exit(1);}/**************************************************************//* function windowheight() -- uses sendpkt() from filedate.c: *//**************************************************************/#include <devices/conunit.h>#include <dos/dosextens.h>#include <exec/memory.h>#include <clib/exec_protos.h>extern long sendpkt(struct MsgPort *pid, long action, long *args, long nargs);int windowheight(BPTR fh){    if (fh && IsInteractive(fh)) {        struct ConUnit *conunit = NULL;        void *conp = ((struct FileHandle *) (fh << 2))->fh_Type;        struct InfoData *ind = AllocMem(sizeof(*ind), MEMF_PUBLIC);        long argp = ((unsigned long) ind) >> 2;        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)            return conunit->cu_YMax + 1;    }    return INT_MAX;}#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(char *path){    BOOL okay = FALSE;    char devname[32], *debna;    ushort i;    BPTR lok = Lock(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(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>#endifint 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 ");#  else#   ifdef AZTEC_C     strcpy(buf1,"Manx Aztec C ");#   else     strcpy(buf1,"UNKNOWN ");#   endif#  endif# endif/* "under" */  sprintf(buf3,"AmigaDOS v%d",WBversion);#else  strcpy(buf1,"Unknown compiler ");  strcpy(buf3,"Unknown OS");#endif/* Define revision, date, and time strings. * NOTE:  Do not calculate run time, be sure to use time compiled. * Pass these strings via your makefile if undefined. */#if defined(__VERSION__) && defined(__REVISION__)  sprintf(buf2,"version %d.%d",__VERSION__,__REVISION__);#else# ifdef __VERSION__  sprintf(buf2,"version %d",__VERSION__);# else  sprintf(buf2,"unknown version");# endif#endif#ifdef __DATE__  sprintf(buf4," on %s",__DATE__);#else  strcpy(buf4," unknown date");#endif/******#ifdef __TIME__  sprintf(buf5," at %s",__TIME__);#else  strcpy(buf5," unknown time");#endif******//* Print strings using "CompiledWith" mask defined in unzip.c (used by all). *  ("Compiled with %s%s for %s%s%s%s.") */   printf(LoadFarString(CompiledWith),     buf1,     buf2,     buf3,     buf4,     "",    /* buf5 not used */     "" );  /* buf6 not used */} /* end function version() */#endif /* !SFX */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -