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

📄 rexxapi.c

📁 完整的解压zip文件的源码。包含密码功能
💻 C
📖 第 1 页 / 共 3 页
字号:
  if (numargs >= 4 &&                  /* check third option         */      !RXNULLSTRING(args[3]) &&      args[3].strlength > 0) {            /* a zero length string isn't */    if (!(G.xfilespecs = CompoundToStringArray(__G__ &G.pxnames,args[3].strptr))) {      G.pxnames = excname;      excname[0] = args[3].strptr;      excname[1] = NULL;      G.xfilespecs = 1;    }    G.process_all_files = FALSE;  }  if (numargs == 5 &&                  /* check third option         */      !RXNULLSTRING(args[4]) &&      args[4].strlength > 0) {            /* a zero length string isn't */    int first = *args[4].strptr & 0x5f;    if (first == 'Z')      uO.vflag = 2, uO.lflag = 0, uO.zipinfo_mode = FALSE;    else if (first == 'F')      uO.vflag = 1, uO.lflag = 0, uO.zipinfo_mode = FALSE;  }  process_zipfiles(__G);  SetOutputVarLength(__G);  if (G.filespecs > 0 && G.pfnames != incname)    KillStringArray(G.pfnames);  if (G.xfilespecs > 0 && G.pxnames != excname)    KillStringArray(G.pxnames);  return RexxReturn(__G__ 0,retstr);        /* no error on call           */}/************************************************************************** Function:  UZUnZipToVar                                                **                                                                        ** Syntax:    call UZUnZipToVar zipfile, filespec [, stem]                **                                                                        ** Params:    zipfile  - Name of zip file to search.                      **            filespec - File to extract                                  **            stem     - If you specify a stem variable, the file will be **                       extracted to the variable, one line per index    **                       In this case, 0 will be returned                 **                                                                        ** Return:    Extracted file                                              **            ERROR_NOMEM     - Out of memory.                            **************************************************************************/ULONG UZUnZipToVar(CHAR *name, ULONG numargs, RXSTRING args[],                          CHAR *queuename, RXSTRING *retstr){  CONSTRUCTGLOBALS();  UzpBuffer *ub = (UzpBuffer *)retstr;                                       /* validate arguments         */  if (numargs < 2 || numargs > 3 ||      !RXVALIDSTRING(args[0]) ||      !RXVALIDSTRING(args[1]) ||      args[0].strlength == 0 ||      args[1].strlength == 0) {    DESTROYGLOBALS();    return INVALID_ROUTINE;            /* Invalid call to routine    */  }  uO.C_flag = 1;  G.redirect_data=1;  if (numargs == 3) {    if (!RXVALIDSTRING(args[2]) ||        RXNULLSTRING(args[1]) ||        args[2].strlength == 0) {      DESTROYGLOBALS();      return INVALID_ROUTINE;            /* Invalid call to routine    */    }    SetOutputVarStem(__G__ args[2].strptr);    G.redirect_text = 0;    G.redirect_data++;  }  unzipToMemory(__G__ args[0].strptr, args[1].strptr,                G.redirect_data==1 ? ub : NULL);  return RexxReturn(__G__ G.redirect_data==1,retstr);}/************************************************************************** Function:  UZUnZipToStem                                               **                                                                        ** Syntax:    call UZUnZipToStem zipfile, stem[, include-filespec]        **                                [, exclude-filespec][, mode]            **                                                                        ** Params:    zipfile  - Name of zip file to search.                      **            stem     - Name of stem var to store files in.              **            include  - Filespec to search for (may include * and ?).    **            exclude  - Filespec to exclude (may include * and ?).       **            mode     - Specifies 'F'lat or 'T'ree mode.  Umm, this is   **                        hard to explain so I'll give an example, too.   **                       Assuming a file unzip.zip containing:            **                               unzip.c                                  **                               unshrink.c                               **                               extract.c                                **                               os2/makefile.os2                         **                               os2/os2.c                                **                               os2/dll/dll.def                          **                               os2/dll/unzipapi.c                       **                                                                        **                       -- In flat mode, each file is stored in          **                          stem.fullname i.e. stem."os2/dll/unzipapi.c"  **                          A list of files is created in stem.<index>    **                                                                        **                       Flat mode returns:                               **                               stem.0 = 7                               **                               stem.1 = unzip.c                         **                               stem.2 = unshrink.c                      **                               stem.3 = extract.c                       **                               stem.4 = os2/makefile.os2                **                               stem.5 = os2/os2.c                       **                               stem.6 = os2/dll/dll.def                 **                               stem.7 = os2/dll/unzipapi.c              **                                                                        **                       And the following contain the contents of the    **                       various programs:                                **                               stem.unzip.c                             **                               stem.unshrink.c                          **                               stem.extract.c                           **                               stem.os2/makefile.os2                    **                               stem.os2/os2.c                           **                               stem.os2/dll/dll.def                     **                               stem.os2/dll/unzipapi.c                  **                                                                        **                       -- In tree mode, slashes are converted to periods**                          in the pathname thus the above file would have**                          been stored in stem.os2.dll.unzipapi.c        **                          The index would then be stored in stem.OS2.   **                          DLL.<index>.                                  **                                                                        **                       NOTE: All path names are converted to uppercase  **                                                                        **                       Tree mode returns:                               **                               stem.0 = 4                               **                               stem.1 = unzip.c                         **                               stem.2 = unshrink.c                      **                               stem.3 = extract.c                       **                               stem.4 = OS2/                            **                                                                        **                               stem.OS2.0 = 3                           **                               stem.OS2.1 = makefile.os2                **                               stem.OS2.2 = os2.c                       **                               stem.OS2.3 = DLL/                        **                                                                        **                               stem.OS2.DLL.0 = 2                       **                               stem.OS2.DLL.1 = def                     **                               stem.OS2.DLL.2 = unzipapi.c              **                                                                        **                       And the following contain the contents of the    **                       various programs:                                **                               stem.unzip.c                             **                               stem.unshrink.c                          **                               stem.extract.c                           **                               stem.OS2.makefile.os2                    **                               stem.OS2.os2.c                           **                               stem.OS2.DLL.dll.def                     **                               stem.OS2.DLL.unzipapi.c                  **                                                                        **                                                                        ** Return:    NO_UTIL_ERROR   - Successful.                               **            ERROR_NOMEM     - Out of memory.                            **************************************************************************/ULONG UZUnZipToStem(CHAR *name, ULONG numargs, RXSTRING args[],                          CHAR *queuename, RXSTRING *retstr){  char *incname[2];  char *excname[2];  CONSTRUCTGLOBALS();                                       /* validate arguments         */  if (numargs < 2 || numargs > 5 ||      !RXVALIDSTRING(args[0]) ||      !RXVALIDSTRING(args[1]) ||      args[0].strlength > 255) {    DESTROYGLOBALS();    return INVALID_ROUTINE;            /* Invalid call to routine    */  }                                       /* initialize data area       */  G.wildzipfn = args[0].strptr;  G.process_all_files = TRUE;  uO.C_flag = 1;  G.extract_flag = TRUE;  SetOutputVarStem(__G__ args[1].strptr);  G.redirect_data = 3;  G.redirect_text = 0;  if (numargs >= 3 &&                  /* check third option         */      !RXNULLSTRING(args[2]) &&      args[2].strlength > 0) {            /* a zero length string isn't */    if (!(G.filespecs = CompoundToStringArray(__G__ &G.pfnames,args[2].strptr))) {      G.pfnames = incname;      incname[0] = args[2].strptr;      incname[1] = NULL;      G.filespecs = 1;    }    G.process_all_files = FALSE;  }  if (numargs >= 4 &&                  /* check third option         */      !RXNULLSTRING(args[3]) &&      args[3].strlength > 0) {            /* a zero length string isn't */    if (!(G.xfilespecs = CompoundToStringArray(__G__ &G.pxnames,args[3].strptr))) {      G.pxnames = excname;      excname[0] = args[3].strptr;      excname[1] = NULL;      G.xfilespecs = 1;    }    G.process_all_files = FALSE;  }  if (numargs == 5 &&                  /* check third option         */      !RXNULLSTRING(args[4]) &&      (*args[4].strptr & 0x5f) == 'T') {    G.redirect_data++;    G.os2.request.shvnext = NULL;    EZRXSTRING(G.os2.request.shvname, args[4].strptr);    G.os2.request.shvnamelen = G.os2.request.shvname.strlength;    G.os2.request.shvcode = RXSHV_SYDRO;    G.os2.request.shvret = 0;    RexxVariablePool(&G.os2.request);  }  uO.qflag = 2;  process_zipfiles(__G);  if (G.filespecs > 0 && G.pfnames != incname)    KillStringArray(G.pfnames);  if (G.xfilespecs > 0 && G.pxnames != excname)    KillStringArray(G.pxnames);  if (G.redirect_data == 3)    SetOutputVarLength(__G);  return RexxReturn(__G__ 0,retstr);            /* no error on call           */}/************************************************************************** Function:  UZLoadFuncs                                                 **                                                                        ** Syntax:    call UZLoadFuncs [option]                                   **                                                                        ** Params:    none                                                        **                                                                        ** Return:    null string                                                 **************************************************************************/ULONG UZLoadFuncs(CHAR *name, ULONG numargs, RXSTRING args[],                           CHAR *queuename, RXSTRING *retstr){  INT    entries;                      /* Num of entries             */  INT    j;                            /* Counter                    */  retstr->strlength = 0;               /* set return value           */                                       /* check arguments            */  if (numargs > 0)    return INVALID_ROUTINE;  entries = sizeof(RxFncTable)/sizeof(PSZ);  for (j = 0; j < entries; j++) {    RexxRegisterFunctionDll(RxFncTable[j],          "UNZIP32", RxFncTable[j]);  }  return VALID_ROUTINE;}/************************************************************************** Function:  UZVer                                                       **                                                                        ** Syntax:    call UZVer                                                  **                                                                        ** Return:    Version of Unzip                                            **************************************************************************/ULONG UZVer(CHAR *name, ULONG numargs, RXSTRING args[],                        CHAR *queuename, RXSTRING *retstr){  if (numargs > 1)                    /* validate arg count         */    return INVALID_ROUTINE;  if (numargs == 0 || (*args[0].strptr & 0x5f) != 'L')    /* strcpy( retstr->strptr, UZ_VERNUM );    "5.13a BETA" */    sprintf( retstr->strptr, "%d.%d%d%s", UZ_MAJORVER, UZ_MINORVER,      PATCHLEVEL, BETALEVEL );  else    /* strcpy( retstr->strptr, UZ_VERSION );   UZ_VERNUM" of 26 Sep 94" */    sprintf( retstr->strptr, "%d.%d%d%s of %s", UZ_MAJORVER, UZ_MINORVER,      PATCHLEVEL, BETALEVEL, VERSION_DATE );  retstr->strlength = strlen(retstr->strptr);  return VALID_ROUTINE;

⌨️ 快捷键说明

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