diff options
author | jk7744.park <jk7744.park@samsung.com> | 2015-09-09 02:36:42 +0900 |
---|---|---|
committer | jk7744.park <jk7744.park@samsung.com> | 2015-09-09 02:36:42 +0900 |
commit | cb9021933010823e97114e40c02cd2cef8d78d8f (patch) | |
tree | 0bca7e85536a30aaeaf4254c557583d72296bd79 /vms/vms_im.c | |
parent | 5396c5e853e76507fac47181b14b25adb725f628 (diff) | |
download | zip-cb9021933010823e97114e40c02cd2cef8d78d8f.tar.gz zip-cb9021933010823e97114e40c02cd2cef8d78d8f.tar.bz2 zip-cb9021933010823e97114e40c02cd2cef8d78d8f.zip |
tizen 2.3.1 releasetizen_2.3.1_releasesubmit/tizen_2.3.1/20150915.101111tizen_2.3.1
Diffstat (limited to 'vms/vms_im.c')
-rw-r--r-- | vms/vms_im.c | 130 |
1 files changed, 103 insertions, 27 deletions
diff --git a/vms/vms_im.c b/vms/vms_im.c index da84945..001088b 100644 --- a/vms/vms_im.c +++ b/vms/vms_im.c @@ -1,9 +1,9 @@ /* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. + Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - See the accompanying file LICENSE, version 2004-May-22 or later + See the accompanying file LICENSE, version 2007-Mar-4 or later (the contents of which are also included in zip.h) for terms of use. - If, for some reason, both of these files are missing, the Info-ZIP license + If, for some reason, all these files are missing, the Info-ZIP license also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html */ /* @@ -32,6 +32,8 @@ * regardless of appearances. Moved the VMS_PK_EXTRA test into * here from VMS.C to allow more general automatic dependency * generation. + * 17-Feb-2005 Steven Schweda + * Added support for ODS5 extended names. */ #ifdef VMS /* For VMS only ! */ @@ -111,6 +113,7 @@ int set_extra_field(z, z_utim) uch *scan; extent extra_l; static struct FAB fab; + static struct NAM_STRUCT nam; static struct XABSUM xabsum; static struct XABFHC xabfhc; static struct XABDAT xabdat; @@ -171,19 +174,45 @@ int set_extra_field(z, z_utim) */ fab = cc$rms_fab; + nam = CC_RMS_NAM; xabsum = cc$rms_xabsum; xabdat = cc$rms_xabdat; xabfhc = cc$rms_xabfhc; xabpro = cc$rms_xabpro; xabrdt = cc$rms_xabrdt; - + fab.FAB_NAM = &nam; fab.fab$l_xab = (char*)&xabsum; /* * Open the file and read summary information. */ - fab.fab$b_fns = strlen(z->name); - fab.fab$l_fna = z->name; + +#ifdef NAML$C_MAXRSS + + fab.fab$l_dna = (char *) -1; /* Using NAML for default name. */ + fab.fab$l_fna = (char *) -1; /* Using NAML for file name. */ + +#endif /* def NAML$C_MAXRSS */ + + FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNA = z->name; + FAB_OR_NAML( fab, nam).FAB_OR_NAML_FNS = strlen( z->name); + +#ifdef NAML$M_OPEN_SPECIAL + /* 2007-02-28 SMS. + * If processing symlinks as symlinks ("-y"), then $OPEN the + * link, not the target file. + * + * (nam.naml$v_open_special gets us the symlink itself instead of + * its target. fab.fab$v_bio is necessary to allow sys$open() to + * work. Without it, you get status %x0001860c, "%RMS-F-ORG, + * invalid file organization value".) + */ + if (linkput) + { + nam.naml$v_open_special = 1; + fab.fab$v_bio = 1; + } +#endif /* def NAML$M_OPEN_SPECIAL */ status = sys$open(&fab); if (ERR(status)) @@ -319,10 +348,13 @@ int set_extra_field(z, z_utim) fab.fab$b_fns = fab.fab$b_shr = fab.fab$b_dns = fab.fab$b_fac = 0; fab.fab$w_ifi = 0; fab.fab$l_stv = fab.fab$l_sts = fab.fab$l_ctx = 0; + fab.fab$l_dna = NULL; fab.fab$l_fna = NULL; fab.fab$l_nam = NULL; +#ifdef NAML$C_MAXRSS + fab.fab$l_naml = NULL; +#endif /* def NAML$C_MAXRSS */ fab.fab$l_xab = NULL; - fab.fab$l_dna = NULL; #ifdef DEBUG dump_rms_block( (uch *)&fab ); @@ -375,10 +407,10 @@ int set_extra_field(z, z_utim) } /* Copy xtra[] data into cxtra[]. */ - memcpy( cxtra, xtra, (scan - xtra)); + memcpy( cxtra, xtra, (scan- xtra)); /* Set sizes and pointers. */ - z->cext = z->ext = scan - xtra; + z->cext = z->ext = scan- xtra; z->extra = (char*) xtra; z->cextra = (char*) cxtra; @@ -433,9 +465,10 @@ typedef struct user_context { ulg sig; struct FAB *fab; + struct NAM_STRUCT *nam; struct RAB *rab; - unsigned int size; - unsigned int rest; + uzoff_t size; + uzoff_t rest; int status; } Ctx, *Ctxptr; @@ -444,6 +477,7 @@ Ctx init_ctx = CTXSIG, NULL, NULL, + NULL, 0L, 0L, 0 @@ -465,46 +499,83 @@ Ctx init_ctx = struct RAB *vms_open(name) char *name; { - struct RAB *rab; struct FAB *fab; + struct NAM_STRUCT *nam; + struct RAB *rab; struct XABFHC *fhc; Ctxptr ctx; - if ((fab = (struct FAB *) malloc(FABL)) == (struct FAB *)NULL) + if ((fab = (struct FAB *) malloc(FABL)) == NULL) return NULL; - if ((rab = (struct RAB *) malloc(RABL)) == (struct RAB *)NULL) + + if ((nam = + (struct NAM_STRUCT *) malloc( sizeof( struct NAM_STRUCT))) == NULL) { free(fab); - return (struct RAB *)NULL; + return NULL; + } + + if ((rab = (struct RAB *) malloc(RABL)) == NULL) + { + free(fab); + free(nam); + return NULL; } + if ((fhc = (struct XABFHC *) malloc(XFHCL)) == (struct XABFHC *)NULL) { - free(rab); free(fab); + free(nam); + free(rab); return (struct RAB *)NULL; } if ((ctx = (Ctxptr) malloc(CTXL)) == (Ctxptr)NULL) { - free(fhc); free(fab); + free(nam); free(rab); + free(fhc); return (struct RAB *)NULL; } *fab = cc$rms_fab; + *nam = CC_RMS_NAM; *rab = cc$rms_rab; *fhc = cc$rms_xabfhc; - fab->fab$l_fna = name; - fab->fab$b_fns = strlen(name); + fab->FAB_NAM = nam; + +#ifdef NAML$C_MAXRSS + + fab->fab$l_dna = (char *) -1; /* Using NAML for default name. */ + fab->fab$l_fna = (char *) -1; /* Using NAML for file name. */ + +#endif /* def NAML$C_MAXRSS */ + + FAB_OR_NAML( fab, nam)->FAB_OR_NAML_FNA = name; + FAB_OR_NAML( fab, nam)->FAB_OR_NAML_FNS = strlen( name); + fab->fab$b_fac = FAB$M_GET | FAB$M_BIO; fab->fab$l_xab = (char*)fhc; +#ifdef NAML$M_OPEN_SPECIAL + /* 2007-02-28 SMS. + * If processing symlinks as symlinks ("-y"), then $OPEN the + * link, not the target file. (Note that here the required + * fab->fab$v_bio flag was set above.) + */ + if (linkput) + { + nam->naml$v_open_special = 1; + } +#endif /* def NAML$M_OPEN_SPECIAL */ + if (ERR(sys$open(fab))) { sys$close(fab); - free(fhc); free(fab); + free(nam); free(rab); + free(fhc); free(ctx); return (struct RAB *)NULL; } @@ -516,14 +587,16 @@ struct RAB *vms_open(name) { sys$close(fab); free(fab); + free(nam); free(rab); free(ctx); return (struct RAB *)NULL; } *ctx = init_ctx; - ctx->rab = rab; ctx->fab = fab; + ctx->nam = nam; + ctx->rab = rab; if (fhc->xab$l_ebk == 0) { @@ -531,7 +604,7 @@ struct RAB *vms_open(name) (This occurs with a zero-length file, for example.) */ ctx->size = - ctx->rest = (fhc->xab$l_hbk) * BLOCK_BYTES; + ctx->rest = ((uzoff_t) fhc->xab$l_hbk)* BLOCK_BYTES; } else { @@ -540,11 +613,11 @@ struct RAB *vms_open(name) If -VV, store allocated-blocks size in ->rest. */ ctx->size = - ((fhc->xab$l_ebk)- 1) * BLOCK_BYTES + fhc->xab$w_ffb; + (((uzoff_t) fhc->xab$l_ebk)- 1)* BLOCK_BYTES+ fhc->xab$w_ffb; if (vms_native < 2) ctx->rest = ctx->size; else - ctx->rest = (fhc->xab$l_hbk) * BLOCK_BYTES; + ctx->rest = ((uzoff_t) fhc->xab$l_hbk)* BLOCK_BYTES; } free(fhc); @@ -560,14 +633,17 @@ int vms_close(rab) struct RAB *rab; { struct FAB *fab; + struct NAM_STRUCT *nam; Ctxptr ctx; if (!CHECK_RAB(rab)) return RET_ERROR; fab = (ctx = (Ctxptr)(rab->rab$l_ctx))->fab; + nam = (ctx = (Ctxptr)(rab->rab$l_ctx))->nam; sys$close(fab); free(fab); + free(nam); free(rab); free(ctx); @@ -600,8 +676,8 @@ int vms_rewind(rab) } -#define KByte (2 * BLOCK_BYTES) -#define MAX_READ_BYTES (32 * KByte) +#define KByte (2* BLOCK_BYTES) +#define MAX_READ_BYTES (32* KByte) /************************** * Function vms_read * @@ -647,7 +723,7 @@ size_t size; /* Round odd-ball request up to the next whole block. This really should never happen. (assert()?) */ - size = (size + BLOCK_BYTES - 1)& ~(BLOCK_BYTES - 1); + size = (size+ BLOCK_BYTES- 1)& ~(BLOCK_BYTES- 1); } /* Reduce "size" when next (last) read would overrun the EOF, |