Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 910280
Collapse All | Expand All

(-)a/crc32.c (-4 / +4 lines)
Lines 677-686 void free_crc_table() Link Here
677
677
678
678
679
/* ========================================================================= */
679
/* ========================================================================= */
680
ulg crc32(crc, buf, len)
680
ulg crc32(ulg crc, register ZCONST uch *buf, extent len)
681
    ulg crc;                    /* crc shift register */
681
    //ulg crc;                    /* crc shift register */
682
    register ZCONST uch *buf;   /* pointer to bytes to pump through */
682
    //register ZCONST uch *buf;   /* pointer to bytes to pump through */
683
    extent len;                 /* number of bytes in buf[] */
683
    //extent len;                 /* number of bytes in buf[] */
684
/* Run a set of bytes through the crc shift register.  If buf is a NULL
684
/* Run a set of bytes through the crc shift register.  If buf is a NULL
685
   pointer, then initialize the crc shift register contents instead.
685
   pointer, then initialize the crc shift register contents instead.
686
   Return the current crc in either case. */
686
   Return the current crc in either case. */
(-)a/crypt.c (-18 / +9 lines)
Lines 160-168 int decrypt_byte(__G) Link Here
160
/***********************************************************************
160
/***********************************************************************
161
 * Update the encryption keys with the next byte of plain text
161
 * Update the encryption keys with the next byte of plain text
162
 */
162
 */
163
int update_keys(__G__ c)
163
int update_keys(__GPRO__ int c)
164
    __GDEF
164
    //int c;                      /* byte of plain text */
165
    int c;                      /* byte of plain text */
166
{
165
{
167
    GLOBAL(keys[0]) = CRC32(GLOBAL(keys[0]), c, CRY_CRC_TAB);
166
    GLOBAL(keys[0]) = CRC32(GLOBAL(keys[0]), c, CRY_CRC_TAB);
168
    GLOBAL(keys[1]) = (GLOBAL(keys[1])
167
    GLOBAL(keys[1]) = (GLOBAL(keys[1])
Lines 180-188 int update_keys(__G__ c) Link Here
180
 * Initialize the encryption keys and the random header according to
179
 * Initialize the encryption keys and the random header according to
181
 * the given password.
180
 * the given password.
182
 */
181
 */
183
void init_keys(__G__ passwd)
182
void init_keys(__GPRO__ ZCONST char *passwd)
184
    __GDEF
183
    //ZCONST char *passwd;        /* password string with which to modify keys */
185
    ZCONST char *passwd;        /* password string with which to modify keys */
186
{
184
{
187
#ifdef IZ_CRC_BE_OPTIMIZ
185
#ifdef IZ_CRC_BE_OPTIMIZ
188
    if (cry_crctb_p == NULL) {
186
    if (cry_crctb_p == NULL) {
Lines 450-459 unsigned zfwrite(buf, item_size, nb, f) Link Here
450
 * Get the password and set up keys for current zipfile member.
448
 * Get the password and set up keys for current zipfile member.
451
 * Return PK_ class error.
449
 * Return PK_ class error.
452
 */
450
 */
453
int decrypt(__G__ passwrd)
451
int decrypt(__GPRO__ ZCONST char *passwrd) {
454
    __GDEF
455
    ZCONST char *passwrd;
456
{
457
    ush b;
452
    ush b;
458
    int n, r;
453
    int n, r;
459
    uch h[RAND_HEAD_LEN];
454
    uch h[RAND_HEAD_LEN];
Lines 536-545 int decrypt(__G__ passwrd) Link Here
536
/***********************************************************************
531
/***********************************************************************
537
 * Test the password.  Return -1 if bad, 0 if OK.
532
 * Test the password.  Return -1 if bad, 0 if OK.
538
 */
533
 */
539
local int testp(__G__ h)
534
local int testp(__GPRO__ ZCONST uch *h) {
540
    __GDEF
541
    ZCONST uch *h;
542
{
543
    int r;
535
    int r;
544
    char *key_translated;
536
    char *key_translated;
545
537
Lines 591-600 local int testp(__G__ h) Link Here
591
} /* end function testp() */
583
} /* end function testp() */
592
584
593
585
594
local int testkey(__G__ h, key)
586
local int testkey(__GPRO__ ZCONST uch *h, ZCONST char *key)
595
    __GDEF
587
    //ZCONST uch *h;      /* decrypted header */
596
    ZCONST uch *h;      /* decrypted header */
588
    //ZCONST char *key;   /* decryption password to test */
597
    ZCONST char *key;   /* decryption password to test */
598
{
589
{
599
    ush b;
590
    ush b;
600
#ifdef ZIP10
591
#ifdef ZIP10
(-)a/envargs.c (-8 / +2 lines)
Lines 46-56 static int count_args OF((ZCONST char *)); Link Here
46
46
47
/* envargs() returns PK-style error code */
47
/* envargs() returns PK-style error code */
48
48
49
int envargs(Pargc, Pargv, envstr, envstr2)
49
int envargs(int *Pargc, char ***Pargv, ZCONST char *envstr, ZCONST char *envstr2) {
50
    int *Pargc;
51
    char ***Pargv;
52
    ZCONST char *envstr, *envstr2;
53
{
54
    char *envptr;       /* value returned by getenv */
50
    char *envptr;       /* value returned by getenv */
55
    char *bufptr;       /* copy of env info */
51
    char *bufptr;       /* copy of env info */
56
    int argc = 0;       /* internal arg count */
52
    int argc = 0;       /* internal arg count */
Lines 176-184 int envargs(Pargc, Pargv, envstr, envstr2) Link Here
176
172
177
173
178
174
179
static int count_args(s)
175
static int count_args(ZCONST char *s) {
180
    ZCONST char *s;
181
{
182
    int count = 0;
176
    int count = 0;
183
    char ch;
177
    char ch;
184
178
(-)a/explode.c (-14 / +14 lines)
Lines 219-228 static ZCONST ush cpdist8[] = Link Here
219
}
219
}
220
220
221
221
222
static int get_tree(__G__ l, n)
222
static int get_tree(__GPRO__ unsigned *l, unsigned n)
223
     __GDEF
223
//unsigned *l;            /* bit lengths */
224
unsigned *l;            /* bit lengths */
224
//unsigned n;             /* number expected */
225
unsigned n;             /* number expected */
226
/* Get the bit lengths for a code representation from the compressed
225
/* Get the bit lengths for a code representation from the compressed
227
   stream.  If get_tree() returns 4, then there is an error in the data.
226
   stream.  If get_tree() returns 4, then there is an error in the data.
228
   Otherwise zero is returned. */
227
   Otherwise zero is returned. */
Lines 250-260 unsigned n; /* number expected */ Link Here
250
249
251
250
252
251
253
static int explode_lit(__G__ tb, tl, td, bb, bl, bd, bdl)
252
static int explode_lit(__GPRO__ struct huft *tb, struct huft *tl, struct huft *td,
254
     __GDEF
253
                                unsigned bb, unsigned bl, unsigned bd, unsigned bdl)
255
struct huft *tb, *tl, *td;      /* literal, length, and distance tables */
254
//struct huft *tb, *tl, *td;      /* literal, length, and distance tables */
256
unsigned bb, bl, bd;            /* number of bits decoded by those */
255
//unsigned bb, bl, bd;            /* number of bits decoded by those */
257
unsigned bdl;                   /* number of distance low bits */
256
//unsigned bdl;                   /* number of distance low bits */
258
/* Decompress the imploded data using coded literals and a sliding
257
/* Decompress the imploded data using coded literals and a sliding
259
   window (of size 2^(6+bdl) bytes). */
258
   window (of size 2^(6+bdl) bytes). */
260
{
259
{
Lines 368-378 unsigned bdl; /* number of distance low bits */ Link Here
368
367
369
368
370
369
371
static int explode_nolit(__G__ tl, td, bl, bd, bdl)
370
static int explode_nolit(__GPRO__ struct huft *tl, struct huft *td,
372
     __GDEF
371
                                  unsigned bl, unsigned bd,
373
struct huft *tl, *td;   /* length and distance decoder tables */
372
                                  unsigned bdl)
374
unsigned bl, bd;        /* number of bits decoded by tl[] and td[] */
373
//struct huft *tl, *td;   /* length and distance decoder tables */
375
unsigned bdl;           /* number of distance low bits */
374
//unsigned bl, bd;        /* number of bits decoded by tl[] and td[] */
375
//unsigned bdl;           /* number of distance low bits */
376
/* Decompress the imploded data using uncoded literals and a sliding
376
/* Decompress the imploded data using uncoded literals and a sliding
377
   window (of size 2^(6+bdl) bytes). */
377
   window (of size 2^(6+bdl) bytes). */
378
{
378
{
(-)a/extract.c (-74 / +29 lines)
Lines 346-355 typedef struct { Link Here
346
 * Return the index of the first span in cover whose beg is greater than val.
346
 * Return the index of the first span in cover whose beg is greater than val.
347
 * If there is no such span, then cover->num is returned.
347
 * If there is no such span, then cover->num is returned.
348
 */
348
 */
349
static size_t cover_find(cover, val)
349
static size_t cover_find(cover_t *cover, bound_t val) {
350
    cover_t *cover;
351
    bound_t val;
352
{
353
    size_t lo = 0, hi = cover->num;
350
    size_t lo = 0, hi = cover->num;
354
    while (lo < hi) {
351
    while (lo < hi) {
355
        size_t mid = (lo + hi) >> 1;
352
        size_t mid = (lo + hi) >> 1;
Lines 362-371 static size_t cover_find(cover, val) Link Here
362
}
359
}
363
360
364
/* Return true if val lies within any one of the spans in cover. */
361
/* Return true if val lies within any one of the spans in cover. */
365
static int cover_within(cover, val)
362
static int cover_within(cover_t *cover, bound_t val) {
366
    cover_t *cover;
367
    bound_t val;
368
{
369
    size_t pos = cover_find(cover, val);
363
    size_t pos = cover_find(cover, val);
370
    return pos > 0 && val < cover->span[pos - 1].end;
364
    return pos > 0 && val < cover->span[pos - 1].end;
371
}
365
}
Lines 382-392 static int cover_within(cover, val) Link Here
382
 * end, then -1 is returned. If the list needs to be grown but the memory
376
 * end, then -1 is returned. If the list needs to be grown but the memory
383
 * allocation fails, then -2 is returned.
377
 * allocation fails, then -2 is returned.
384
 */
378
 */
385
static int cover_add(cover, beg, end)
379
static int cover_add(cover_t *cover, bound_t beg, bound_t end) {
386
    cover_t *cover;
387
    bound_t beg;
388
    bound_t end;
389
{
390
    size_t pos;
380
    size_t pos;
391
    int prec, foll;
381
    int prec, foll;
392
382
Lines 771-777 int extract_or_test_files(__G) /* return PK-type error code */ Link Here
771
        G.cur_zipfile_bufstart =
761
        G.cur_zipfile_bufstart =
772
          zlseek(G.zipfd, cd_bufstart, SEEK_SET);
762
          zlseek(G.zipfd, cd_bufstart, SEEK_SET);
773
#endif /* ?USE_STRM_INPUT */
763
#endif /* ?USE_STRM_INPUT */
774
        read(G.zipfd, (char *)G.inbuf, INBUFSIZ);  /* been here before... */
764
        (void)read(G.zipfd, (char *)G.inbuf, INBUFSIZ);  /* been here before... */
775
        G.inptr = cd_inptr;
765
        G.inptr = cd_inptr;
776
        G.incnt = cd_incnt;
766
        G.incnt = cd_incnt;
777
        ++blknum;
767
        ++blknum;
Lines 1083-1089 static int store_info(__G) /* return 0 if skipping, 1 if OK */ Link Here
1083
        else if (!uO.tflag && !IS_OVERWRT_ALL) { /* if -o, extract anyway */
1073
        else if (!uO.tflag && !IS_OVERWRT_ALL) { /* if -o, extract anyway */
1084
            Info(slide, 0x481, ((char *)slide, LoadFarString(VMSFormatQuery),
1074
            Info(slide, 0x481, ((char *)slide, LoadFarString(VMSFormatQuery),
1085
              FnFilter1(G.filename)));
1075
              FnFilter1(G.filename)));
1086
            fgets(G.answerbuf, sizeof(G.answerbuf), stdin);
1076
            (void)fgets(G.answerbuf, sizeof(G.answerbuf), stdin);
1087
            if ((*G.answerbuf != 'y') && (*G.answerbuf != 'Y'))
1077
            if ((*G.answerbuf != 'y') && (*G.answerbuf != 'Y'))
1088
                return 0;
1078
                return 0;
1089
        }
1079
        }
Lines 1153-1161 static int store_info(__G) /* return 0 if skipping, 1 if OK */ Link Here
1153
/*  Function find_compr_idx()  */
1143
/*  Function find_compr_idx()  */
1154
/*******************************/
1144
/*******************************/
1155
1145
1156
unsigned find_compr_idx(compr_methodnum)
1146
unsigned find_compr_idx(unsigned compr_methodnum) {
1157
    unsigned compr_methodnum;
1158
{
1159
    unsigned i;
1147
    unsigned i;
1160
1148
1161
    for (i = 0; i < NUM_METHODS; i++) {
1149
    for (i = 0; i < NUM_METHODS; i++) {
Lines 1173-1194 unsigned find_compr_idx(compr_methodnum) Link Here
1173
/*  Function extract_or_test_entrylist()  */
1161
/*  Function extract_or_test_entrylist()  */
1174
/******************************************/
1162
/******************************************/
1175
1163
1176
static int extract_or_test_entrylist(__G__ numchunk,
1164
static int extract_or_test_entrylist(__GPRO__ unsigned numchunk,
1177
                pfilnum, pnum_bad_pwd, pold_extra_bytes,
1165
                ulg *pfilnum, ulg *pnum_bad_pwd, zoff_t *pold_extra_bytes,
1178
#ifdef SET_DIR_ATTRIB
1179
                pnum_dirs, pdirlist,
1180
#endif
1181
                error_in_archive)    /* return PK-type error code */
1182
    __GDEF
1183
    unsigned numchunk;
1184
    ulg *pfilnum;
1185
    ulg *pnum_bad_pwd;
1186
    zoff_t *pold_extra_bytes;
1187
#ifdef SET_DIR_ATTRIB
1166
#ifdef SET_DIR_ATTRIB
1188
    unsigned *pnum_dirs;
1167
                unsigned *pnum_dirs, direntry **pdirlist,
1189
    direntry **pdirlist;
1190
#endif
1168
#endif
1191
    int error_in_archive;
1169
                int error_in_archive)    /* return PK-type error code */
1192
{
1170
{
1193
    unsigned i;
1171
    unsigned i;
1194
    int renamed, query;
1172
    int renamed, query;
Lines 1673-1679 reprompt: Link Here
1673
                        do {
1651
                        do {
1674
                            Info(slide, 0x81, ((char *)slide,
1652
                            Info(slide, 0x81, ((char *)slide,
1675
                              LoadFarString(NewNameQuery)));
1653
                              LoadFarString(NewNameQuery)));
1676
                            fgets(G.filename, FILNAMSIZ, stdin);
1654
                            (void)fgets(G.filename, FILNAMSIZ, stdin);
1677
                            /* usually get \n here:  better check for it */
1655
                            /* usually get \n here:  better check for it */
1678
                            fnlen = strlen(G.filename);
1656
                            fnlen = strlen(G.filename);
1679
                            if (lastchar(G.filename, fnlen) == '\n')
1657
                            if (lastchar(G.filename, fnlen) == '\n')
Lines 2219-2229 static int extract_or_test_member(__G) /* return PK-type error code */ Link Here
2219
/*  Function TestExtraField()  */
2197
/*  Function TestExtraField()  */
2220
/*******************************/
2198
/*******************************/
2221
2199
2222
static int TestExtraField(__G__ ef, ef_len)
2200
static int TestExtraField(__GPRO__ uch *ef, unsigned ef_len) {
2223
    __GDEF
2224
    uch *ef;
2225
    unsigned ef_len;
2226
{
2227
    ush ebID;
2201
    ush ebID;
2228
    unsigned ebLen;
2202
    unsigned ebLen;
2229
    unsigned eb_cmpr_offs = 0;
2203
    unsigned eb_cmpr_offs = 0;
Lines 2494-2505 static int test_compr_eb(__G__ eb, eb_size, compr_offset, test_uc_ebdata) Link Here
2494
/*  Function memextract()  */
2468
/*  Function memextract()  */
2495
/***************************/
2469
/***************************/
2496
2470
2497
int memextract(__G__ tgt, tgtsize, src, srcsize)  /* extract compressed */
2471
int memextract(__GPRO__ uch *tgt, ulg tgtsize, ZCONST uch *src, ulg srcsize)  /* extract compressed */
2498
    __GDEF                                        /*  extra field block; */
2472
    //__GDEF                                        /*  extra field block; */
2499
    uch *tgt;                                     /*  return PK-type error */
2473
    //uch *tgt;                                     /*  return PK-type error */
2500
    ulg tgtsize;                                  /*  level */
2474
    //ulg tgtsize;                                  /*  level */
2501
    ZCONST uch *src;
2475
    //ZCONST uch *src;
2502
    ulg srcsize;
2476
    //ulg srcsize;
2503
{
2477
{
2504
    zoff_t old_csize=G.csize;
2478
    zoff_t old_csize=G.csize;
2505
    uch   *old_inptr=G.inptr;
2479
    uch   *old_inptr=G.inptr;
Lines 2583-2593 int memextract(__G__ tgt, tgtsize, src, srcsize) /* extract compressed */ Link Here
2583
/*  Function memflush()  */
2557
/*  Function memflush()  */
2584
/*************************/
2558
/*************************/
2585
2559
2586
int memflush(__G__ rawbuf, size)
2560
int memflush(__GPRO__ ZCONST uch *rawbuf, ulg size) {
2587
    __GDEF
2588
    ZCONST uch *rawbuf;
2589
    ulg size;
2590
{
2591
    if (size > G.outsize)
2561
    if (size > G.outsize)
2592
        /* Here, PK_DISK is a bit off-topic, but in the sense of marking
2562
        /* Here, PK_DISK is a bit off-topic, but in the sense of marking
2593
           "overflow of output space", its use may be tolerated. */
2563
           "overflow of output space", its use may be tolerated. */
Lines 2623-2636 int memflush(__G__ rawbuf, size) Link Here
2623
 * - Deflation (see memextract())
2593
 * - Deflation (see memextract())
2624
 * The IZVMS block data is returned in malloc'd space.
2594
 * The IZVMS block data is returned in malloc'd space.
2625
 */
2595
 */
2626
uch *extract_izvms_block(__G__ ebdata, size, retlen, init, needlen)
2596
uch *extract_izvms_block(__GPRO__ ZCONST uch *ebdata, unsigned size, unsigned *retlen, ZCONST uch *init, unsigned needlen) {
2627
    __GDEF
2628
    ZCONST uch *ebdata;
2629
    unsigned size;
2630
    unsigned *retlen;
2631
    ZCONST uch *init;
2632
    unsigned needlen;
2633
{
2634
    uch *ucdata;       /* Pointer to block allocated */
2597
    uch *ucdata;       /* Pointer to block allocated */
2635
    int cmptype;
2598
    int cmptype;
2636
    unsigned usiz, csiz;
2599
    unsigned usiz, csiz;
Lines 2685-2694 uch *extract_izvms_block(__G__ ebdata, size, retlen, init, needlen) Link Here
2685
 *  else
2648
 *  else
2686
 *      putbit(0)
2649
 *      putbit(0)
2687
 */
2650
 */
2688
static void decompress_bits(outptr, needlen, bitptr)
2651
static void decompress_bits(uch *outptr, unsigned needlen, ZCONST uch *bitptr)
2689
    uch *outptr;        /* Pointer into output block */
2652
    //uch *outptr;        /* Pointer into output block */
2690
    unsigned needlen;   /* Size of uncompressed block */
2653
    //unsigned needlen;   /* Size of uncompressed block */
2691
    ZCONST uch *bitptr; /* Pointer into compressed data */
2654
    //ZCONST uch *bitptr; /* Pointer into compressed data */
2692
{
2655
{
2693
    ulg bitbuf = 0;
2656
    ulg bitbuf = 0;
2694
    int bitcnt = 0;
2657
    int bitcnt = 0;
Lines 2731-2740 static void decompress_bits(outptr, needlen, bitptr) Link Here
2731
/* Function set_deferred_symlink() */
2694
/* Function set_deferred_symlink() */
2732
/***********************************/
2695
/***********************************/
2733
2696
2734
static void set_deferred_symlink(__G__ slnk_entry)
2697
static void set_deferred_symlink(__GPRO__ slinkentry *slnk_entry) {
2735
    __GDEF
2736
    slinkentry *slnk_entry;
2737
{
2738
    extent ucsize = slnk_entry->targetlen;
2698
    extent ucsize = slnk_entry->targetlen;
2739
    char *linkfname = slnk_entry->fname;
2699
    char *linkfname = slnk_entry->fname;
2740
    char *linktarget = (char *)malloc(ucsize+1);
2700
    char *linktarget = (char *)malloc(ucsize+1);
Lines 2788-2798 static void set_deferred_symlink(__G__ slnk_entry) Link Here
2788
/*  Function fnfilter()  */        /* here instead of in list.c for SFX */
2748
/*  Function fnfilter()  */        /* here instead of in list.c for SFX */
2789
/*************************/
2749
/*************************/
2790
2750
2791
char *fnfilter(raw, space, size)   /* convert name to safely printable form */
2751
char *fnfilter(ZCONST char *raw, uch *space, extent size) {   /* convert name to safely printable form */
2792
    ZCONST char *raw;
2793
    uch *space;
2794
    extent size;
2795
{
2796
#ifndef NATIVE   /* ASCII:  filter ANSI escape codes, etc. */
2752
#ifndef NATIVE   /* ASCII:  filter ANSI escape codes, etc. */
2797
    ZCONST uch *r=(ZCONST uch *)raw;
2753
    ZCONST uch *r=(ZCONST uch *)raw;
2798
    uch *s=space;
2754
    uch *s=space;
Lines 2914-2921 char *fnfilter(raw, space, size) /* convert name to safely printable form */ Link Here
2914
/*  Function dircomp()  */
2870
/*  Function dircomp()  */
2915
/************************/
2871
/************************/
2916
2872
2917
static int Cdecl dircomp(a, b)  /* used by qsort(); swiped from Zip */
2873
static int Cdecl dircomp(ZCONST zvoid *a, ZCONST zvoid *b)  /* used by qsort(); swiped from Zip */
2918
    ZCONST zvoid *a, *b;
2919
{
2874
{
2920
    /* order is significant:  this sorts in reverse order (deepest first) */
2875
    /* order is significant:  this sorts in reverse order (deepest first) */
2921
    return strcmp((*(direntry **)b)->fn, (*(direntry **)a)->fn);
2876
    return strcmp((*(direntry **)b)->fn, (*(direntry **)a)->fn);
Lines 2937-2943 __GDEF Link Here
2937
{
2892
{
2938
    int retval = 0;     /* return code: 0 = "no error" */
2893
    int retval = 0;     /* return code: 0 = "no error" */
2939
    int err=BZ_OK;
2894
    int err=BZ_OK;
2940
    int repeated_buf_err;
2895
    //int repeated_buf_err;
2941
    bz_stream bstrm;
2896
    bz_stream bstrm;
2942
2897
2943
    if (G.incnt <= 0 && G.csize <= 0L) {
2898
    if (G.incnt <= 0 && G.csize <= 0L) {
Lines 3022-3028 __GDEF Link Here
3022
2977
3023
    /* no more input, so loop until we have all output */
2978
    /* no more input, so loop until we have all output */
3024
    Trace((stderr, "beginning final loop:  err = %d\n", err));
2979
    Trace((stderr, "beginning final loop:  err = %d\n", err));
3025
    repeated_buf_err = FALSE;
2980
    //repeated_buf_err = FALSE;
3026
    while (err != BZ_STREAM_END) {
2981
    while (err != BZ_STREAM_END) {
3027
        err = BZ2_bzDecompress(&bstrm);
2982
        err = BZ2_bzDecompress(&bstrm);
3028
        if (err == BZ_DATA_ERROR) {
2983
        if (err == BZ_DATA_ERROR) {
(-)a/fileio.c (-79 / +47 lines)
Lines 576-586 void defer_leftover_input(__G) Link Here
576
/* Function readbuf() */
576
/* Function readbuf() */
577
/**********************/
577
/**********************/
578
578
579
unsigned readbuf(__G__ buf, size)   /* return number of bytes read into buf */
579
unsigned readbuf(__GPRO__ char *buf, register unsigned size) {   /* return number of bytes read into buf */
580
    __GDEF
581
    char *buf;
582
    register unsigned size;
583
{
584
    register unsigned count;
580
    register unsigned count;
585
    unsigned n;
581
    unsigned n;
586
582
Lines 713-722 int fillinbuf(__G) /* like readbyte() except returns number of bytes in inbuf */ Link Here
713
/* Function seek_zipf() */
709
/* Function seek_zipf() */
714
/************************/
710
/************************/
715
711
716
int seek_zipf(__G__ abs_offset)
712
int seek_zipf(__GPRO__ zoff_t abs_offset) {
717
    __GDEF
718
    zoff_t abs_offset;
719
{
720
/*
713
/*
721
 *  Seek to the block boundary of the block which includes abs_offset,
714
 *  Seek to the block boundary of the block which includes abs_offset,
722
 *  then read block into input buffer and set pointers appropriately.
715
 *  then read block into input buffer and set pointers appropriately.
Lines 784-794 int seek_zipf(__G__ abs_offset) Link Here
784
/* Function flush() */   /* returns PK error codes: */
777
/* Function flush() */   /* returns PK error codes: */
785
/********************/   /* if tflag => always 0; PK_DISK if write error */
778
/********************/   /* if tflag => always 0; PK_DISK if write error */
786
779
787
int flush(__G__ rawbuf, size, unshrink)
780
int flush(__GPRO__ uch *rawbuf, ulg size, int unshrink)
788
    __GDEF
789
    uch *rawbuf;
790
    ulg size;
791
    int unshrink;
792
#if (defined(USE_DEFLATE64) && defined(__16BIT__))
781
#if (defined(USE_DEFLATE64) && defined(__16BIT__))
793
{
782
{
794
    int ret;
783
    int ret;
Lines 1090-1099 static int partflush(__G__ rawbuf, size, unshrink) Link Here
1090
/* Function is_vms_varlen_txt() */
1079
/* Function is_vms_varlen_txt() */
1091
/********************************/
1080
/********************************/
1092
1081
1093
static int is_vms_varlen_txt(__G__ ef_buf, ef_len)
1082
static int is_vms_varlen_txt(__GPRO__ uch *ef_buf, unsigned ef_len)
1094
    __GDEF
1083
    //uch *ef_buf;        /* buffer containing extra field */
1095
    uch *ef_buf;        /* buffer containing extra field */
1084
    //unsigned ef_len;    /* total length of extra field */
1096
    unsigned ef_len;    /* total length of extra field */
1097
{
1085
{
1098
    unsigned eb_id;
1086
    unsigned eb_id;
1099
    unsigned eb_len;
1087
    unsigned eb_len;
Lines 1224-1230 static int disk_error(__G) Link Here
1224
      FnFilter1(G.filename)));
1212
      FnFilter1(G.filename)));
1225
1213
1226
#ifndef WINDLL
1214
#ifndef WINDLL
1227
    fgets(G.answerbuf, sizeof(G.answerbuf), stdin);
1215
    (void)fgets(G.answerbuf, sizeof(G.answerbuf), stdin);
1228
    if (*G.answerbuf == 'y')   /* stop writing to this file */
1216
    if (*G.answerbuf == 'y')   /* stop writing to this file */
1229
        G.disk_full = 1;       /*  (outfile bad?), but new OK */
1217
        G.disk_full = 1;       /*  (outfile bad?), but new OK */
1230
    else
1218
    else
Lines 1245-1255 static int disk_error(__G) Link Here
1245
/* Function UzpMessagePrnt() */
1233
/* Function UzpMessagePrnt() */
1246
/*****************************/
1234
/*****************************/
1247
1235
1248
int UZ_EXP UzpMessagePrnt(pG, buf, size, flag)
1236
int UZ_EXP UzpMessagePrnt(zvoid *pG, uch *buf, ulg size, int flag)
1249
    zvoid *pG;   /* globals struct:  always passed */
1237
    //zvoid *pG;   /* globals struct:  always passed */
1250
    uch *buf;    /* preformatted string to be printed */
1238
    //uch *buf;    /* preformatted string to be printed */
1251
    ulg size;    /* length of string (may include nulls) */
1239
    //ulg size;    /* length of string (may include nulls) */
1252
    int flag;    /* flag bits */
1240
    //int flag;    /* flag bits */
1253
{
1241
{
1254
    /* IMPORTANT NOTE:
1242
    /* IMPORTANT NOTE:
1255
     *    The name of the first parameter of UzpMessagePrnt(), which passes
1243
     *    The name of the first parameter of UzpMessagePrnt(), which passes
Lines 1488-1501 int UZ_EXP UzpMessageNull(pG, buf, size, flag) Link Here
1488
/* Function UzpInput() */   /* GRR:  this is a placeholder for now */
1476
/* Function UzpInput() */   /* GRR:  this is a placeholder for now */
1489
/***********************/
1477
/***********************/
1490
1478
1491
int UZ_EXP UzpInput(pG, buf, size, flag)
1479
int UZ_EXP UzpInput(zvoid *pG, uch *buf, int *size, int flag)
1492
    zvoid *pG;    /* globals struct:  always passed */
1480
    //zvoid *pG;    /* globals struct:  always passed */
1493
    uch *buf;     /* preformatted string to be printed */
1481
    //uch *buf;     /* preformatted string to be printed */
1494
    int *size;    /* (address of) size of buf and of returned string */
1482
    //int *size;    /* (address of) size of buf and of returned string */
1495
    int flag;     /* flag bits (bit 0: no echo) */
1483
    //int flag;     /* flag bits (bit 0: no echo) */
1496
{
1484
{
1497
    /* tell picky compilers to shut up about "unused variable" warnings */
1485
    /* tell picky compilers to shut up about "unused variable" warnings */
1498
    pG = pG; buf = buf; flag = flag;
1486
    //pG = pG; buf = buf; flag = flag;
1499
1487
1500
    *size = 0;
1488
    *size = 0;
1501
    return 0;
1489
    return 0;
Lines 1512-1521 int UZ_EXP UzpInput(pG, buf, size, flag) Link Here
1512
/* Function UzpMorePause() */
1500
/* Function UzpMorePause() */
1513
/***************************/
1501
/***************************/
1514
1502
1515
void UZ_EXP UzpMorePause(pG, prompt, flag)
1503
void UZ_EXP UzpMorePause(zvoid *pG, ZCONST char *prompt, int flag)
1516
    zvoid *pG;            /* globals struct:  always passed */
1504
    //zvoid *pG;            /* globals struct:  always passed */
1517
    ZCONST char *prompt;  /* "--More--" prompt */
1505
    //ZCONST char *prompt;  /* "--More--" prompt */
1518
    int flag;             /* 0 = any char OK; 1 = accept only '\n', ' ', q */
1506
    //int flag;             /* 0 = any char OK; 1 = accept only '\n', ' ', q */
1519
{
1507
{
1520
    uch c;
1508
    uch c;
1521
1509
Lines 1574-1591 void UZ_EXP UzpMorePause(pG, prompt, flag) Link Here
1574
/* Function UzpPassword() */
1562
/* Function UzpPassword() */
1575
/**************************/
1563
/**************************/
1576
1564
1577
int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn)
1565
int UZ_EXP UzpPassword (zvoid *pG, int *rcnt, char *pwbuf, int size, ZCONST char *zfn, ZCONST char *efn)
1578
    zvoid *pG;         /* pointer to UnZip's internal global vars */
1566
    //zvoid *pG;         /* pointer to UnZip's internal global vars */
1579
    int *rcnt;         /* retry counter */
1567
    //int *rcnt;         /* retry counter */
1580
    char *pwbuf;       /* buffer for password */
1568
    //char *pwbuf;       /* buffer for password */
1581
    int size;          /* size of password buffer */
1569
    //int size;          /* size of password buffer */
1582
    ZCONST char *zfn;  /* name of zip archive */
1570
    //ZCONST char *zfn;  /* name of zip archive */
1583
    ZCONST char *efn;  /* name of archive entry being processed */
1571
    //ZCONST char *efn;  /* name of archive entry being processed */
1584
{
1572
{
1585
#if CRYPT
1573
#if CRYPT
1586
    int r = IZ_PW_ENTERED;
1574
    int r = IZ_PW_ENTERED;
1587
    char *m;
1575
    char *m;
1588
    char *prompt;
1576
    char *prompt = NULL;
1589
    char *zfnf;
1577
    char *zfnf;
1590
    char *efnf;
1578
    char *efnf;
1591
    size_t zfnfl;
1579
    size_t zfnfl;
Lines 1593-1599 int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn) Link Here
1593
1581
1594
#ifndef REENTRANT
1582
#ifndef REENTRANT
1595
    /* tell picky compilers to shut up about "unused variable" warnings */
1583
    /* tell picky compilers to shut up about "unused variable" warnings */
1596
    pG = pG;
1584
    //pG = pG;
1597
#endif
1585
#endif
1598
1586
1599
    if (*rcnt == 0) {           /* First call for current entry */
1587
    if (*rcnt == 0) {           /* First call for current entry */
Lines 1632-1638 int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn) Link Here
1632
1620
1633
#else /* !CRYPT */
1621
#else /* !CRYPT */
1634
    /* tell picky compilers to shut up about "unused variable" warnings */
1622
    /* tell picky compilers to shut up about "unused variable" warnings */
1635
    pG = pG; rcnt = rcnt; pwbuf = pwbuf; size = size; zfn = zfn; efn = efn;
1623
    //pG = pG; rcnt = rcnt; pwbuf = pwbuf; size = size; zfn = zfn; efn = efn;
1636
1624
1637
    return IZ_PW_ERROR;  /* internal error; function should never get called */
1625
    return IZ_PW_ERROR;  /* internal error; function should never get called */
1638
#endif /* ?CRYPT */
1626
#endif /* ?CRYPT */
Lines 1647-1655 int UZ_EXP UzpPassword (pG, rcnt, pwbuf, size, zfn, efn) Link Here
1647
/* Function handler() */
1635
/* Function handler() */
1648
/**********************/
1636
/**********************/
1649
1637
1650
void handler(signal)   /* upon interrupt, turn on echo and exit cleanly */
1638
void handler(int signal) {   /* upon interrupt, turn on echo and exit cleanly */
1651
    int signal;
1652
{
1653
    GETGLOBALS();
1639
    GETGLOBALS();
1654
1640
1655
#if !(defined(SIGBUS) || defined(SIGSEGV))      /* add a newline if not at */
1641
#if !(defined(SIGBUS) || defined(SIGSEGV))      /* add a newline if not at */
Lines 1711-1719 ZCONST ush ydays[] = Link Here
1711
/* Function dos_to_unix_time() */ /* used for freshening/updating/timestamps */
1697
/* Function dos_to_unix_time() */ /* used for freshening/updating/timestamps */
1712
/*******************************/
1698
/*******************************/
1713
1699
1714
time_t dos_to_unix_time(dosdatetime)
1700
time_t dos_to_unix_time(ulg dosdatetime) {
1715
    ulg dosdatetime;
1716
{
1717
    time_t m_time;
1701
    time_t m_time;
1718
1702
1719
#ifdef HAVE_MKTIME
1703
#ifdef HAVE_MKTIME
Lines 1897-1905 time_t dos_to_unix_time(dosdatetime) Link Here
1897
/* Function check_for_newer() */  /* used for overwriting/freshening/updating */
1881
/* Function check_for_newer() */  /* used for overwriting/freshening/updating */
1898
/******************************/
1882
/******************************/
1899
1883
1900
int check_for_newer(__G__ filename)  /* return 1 if existing file is newer */
1884
int check_for_newer(__GPRO__ char *filename)  /* return 1 if existing file is newer */
1901
    __GDEF                           /*  or equal; 0 if older; -1 if doesn't */
1885
    //__GDEF                           /*  or equal; 0 if older; -1 if doesn't */
1902
    char *filename;                  /*  exist yet */
1886
    //char *filename;                  /*  exist yet */
1903
{
1887
{
1904
    time_t existing, archive;
1888
    time_t existing, archive;
1905
#ifdef USE_EF_UT_TIME
1889
#ifdef USE_EF_UT_TIME
Lines 2016-2025 int check_for_newer(__G__ filename) /* return 1 if existing file is newer */ Link Here
2016
/* Function do_string() */
2000
/* Function do_string() */
2017
/************************/
2001
/************************/
2018
2002
2019
int do_string(__G__ length, option)   /* return PK-type error code */
2003
int do_string(__GPRO__ unsigned int length, int option)   /* return PK-type error code */
2020
    __GDEF
2004
    //unsigned int length;        /* without prototype, ush converted to this */
2021
    unsigned int length;        /* without prototype, ush converted to this */
2022
    int option;
2023
{
2005
{
2024
    unsigned comment_bytes_left;
2006
    unsigned comment_bytes_left;
2025
    unsigned int block_len;
2007
    unsigned int block_len;
Lines 2446-2454 int do_string(__G__ length, option) /* return PK-type error code */ Link Here
2446
/* Function makeword() */
2428
/* Function makeword() */
2447
/***********************/
2429
/***********************/
2448
2430
2449
ush makeword(b)
2431
ush makeword(ZCONST uch *b) {
2450
    ZCONST uch *b;
2451
{
2452
    /*
2432
    /*
2453
     * Convert Intel style 'short' integer to non-Intel non-16-bit
2433
     * Convert Intel style 'short' integer to non-Intel non-16-bit
2454
     * host format.  This routine also takes care of byte-ordering.
2434
     * host format.  This routine also takes care of byte-ordering.
Lines 2464-2472 ush makeword(b) Link Here
2464
/* Function makelong() */
2444
/* Function makelong() */
2465
/***********************/
2445
/***********************/
2466
2446
2467
ulg makelong(sig)
2447
ulg makelong(ZCONST uch *sig) {
2468
    ZCONST uch *sig;
2469
{
2470
    /*
2448
    /*
2471
     * Convert intel style 'long' variable to non-Intel non-16-bit
2449
     * Convert intel style 'long' variable to non-Intel non-16-bit
2472
     * host format.  This routine also takes care of byte-ordering.
2450
     * host format.  This routine also takes care of byte-ordering.
Lines 2485-2493 ulg makelong(sig) Link Here
2485
/* Function makeint64() */
2463
/* Function makeint64() */
2486
/************************/
2464
/************************/
2487
2465
2488
zusz_t makeint64(sig)
2466
zusz_t makeint64(ZCONST uch *sig) {
2489
    ZCONST uch *sig;
2490
{
2491
#ifdef LARGE_FILE_SUPPORT
2467
#ifdef LARGE_FILE_SUPPORT
2492
    /*
2468
    /*
2493
     * Convert intel style 'int64' variable to non-Intel non-16-bit
2469
     * Convert intel style 'int64' variable to non-Intel non-16-bit
Lines 2524-2535 zusz_t makeint64(sig) Link Here
2524
/*********************/
2500
/*********************/
2525
2501
2526
/* Format a zoff_t value in a cylindrical buffer set. */
2502
/* Format a zoff_t value in a cylindrical buffer set. */
2527
char *fzofft(__G__ val, pre, post)
2503
char *fzofft(__GPRO__ zoff_t val, ZCONST char *pre, ZCONST char *post) {
2528
    __GDEF
2529
    zoff_t val;
2530
    ZCONST char *pre;
2531
    ZCONST char *post;
2532
{
2533
    /* Storage cylinder. (now in globals.h) */
2504
    /* Storage cylinder. (now in globals.h) */
2534
    /*static char fzofft_buf[FZOFFT_NUM][FZOFFT_LEN];*/
2505
    /*static char fzofft_buf[FZOFFT_NUM][FZOFFT_LEN];*/
2535
    /*static int fzofft_index = 0;*/
2506
    /*static int fzofft_index = 0;*/
Lines 2607-2615 char *str2iso(dst, src) Link Here
2607
/* Function str2oem() */
2578
/* Function str2oem() */
2608
/**********************/
2579
/**********************/
2609
2580
2610
char *str2oem(dst, src)
2581
char *str2oem(char *dst, register ZCONST char *src)
2611
    char *dst;                          /* destination buffer */
2582
    //char *dst;                          /* destination buffer */
2612
    register ZCONST char *src;          /* source string */
2583
    //register ZCONST char *src;          /* source string */
2613
{
2584
{
2614
#ifdef INTERN_TO_OEM
2585
#ifdef INTERN_TO_OEM
2615
    INTERN_TO_OEM(src, dst);
2586
    INTERN_TO_OEM(src, dst);
Lines 2702-2711 zvoid *memcpy(dst, src, len) Link Here
2702
/* Function zstrnicmp() */
2673
/* Function zstrnicmp() */
2703
/************************/
2674
/************************/
2704
2675
2705
int zstrnicmp(s1, s2, n)
2676
int zstrnicmp(register ZCONST char *s1, register ZCONST char *s2, register unsigned n) {
2706
    register ZCONST char *s1, *s2;
2707
    register unsigned n;
2708
{
2709
    for (; n > 0;  --n, ++s1, ++s2) {
2677
    for (; n > 0;  --n, ++s1, ++s2) {
2710
2678
2711
        if (ToLower(*s1) != ToLower(*s2))
2679
        if (ToLower(*s1) != ToLower(*s2))
(-)a/funzip.c (-10 / +6 lines)
Lines 218-226 __GDEF Link Here
218
#endif /* USE_ZLIB */
218
#endif /* USE_ZLIB */
219
219
220
220
221
static void err(n, m)
221
static void err(int n, char *m)
222
int n;
223
char *m;
224
/* Exit on error with a message and a code */
222
/* Exit on error with a message and a code */
225
{
223
{
226
  Info(slide, 1, ((char *)slide, "funzip error: %s\n", m));
224
  Info(slide, 1, ((char *)slide, "funzip error: %s\n", m));
Lines 243-250 extent w; /* number of bytes to flush */ Link Here
243
}
241
}
244
242
245
243
246
int flush(w)    /* used by inflate.c (FLUSH macro) */
244
int flush(ulg w)    /* used by inflate.c (FLUSH macro) */
247
ulg w;          /* number of bytes to flush */
245
//ulg w;          /* number of bytes to flush */
248
{
246
{
249
    uch *rawbuf;
247
    uch *rawbuf;
250
    int ret;
248
    int ret;
Lines 266-273 ulg w; /* number of bytes to flush */ Link Here
266
264
267
#else /* !(USE_DEFLATE64 && __16BIT__) */
265
#else /* !(USE_DEFLATE64 && __16BIT__) */
268
266
269
int flush(w)    /* used by inflate.c (FLUSH macro) */
267
int flush(ulg w)    /* used by inflate.c (FLUSH macro) */
270
ulg w;          /* number of bytes to flush */
268
//ulg w;          /* number of bytes to flush */
271
{
269
{
272
  G.crc32val = crc32(G.crc32val, slide, (extent)w);
270
  G.crc32val = crc32(G.crc32val, slide, (extent)w);
273
  if (fwrite((char *)slide,1,(extent)w,out) != (extent)w && !PIPE_ERROR)
271
  if (fwrite((char *)slide,1,(extent)w,out) != (extent)w && !PIPE_ERROR)
Lines 279-287 ulg w; /* number of bytes to flush */ Link Here
279
#endif /* ?(USE_DEFLATE64 && __16BIT__) */
277
#endif /* ?(USE_DEFLATE64 && __16BIT__) */
280
278
281
279
282
int main(argc, argv)
280
int main(int argc, char **argv)
283
int argc;
284
char **argv;
285
/* Given a zipfile on stdin, decompress the first entry to stdout. */
281
/* Given a zipfile on stdin, decompress the first entry to stdout. */
286
{
282
{
287
  ush n;
283
  ush n;
(-)a/inflate.c (-21 / +16 lines)
Lines 929-938 static ZCONST unsigned dbits = 6; Link Here
929
929
930
#ifndef ASM_INFLATECODES
930
#ifndef ASM_INFLATECODES
931
931
932
int inflate_codes(__G__ tl, td, bl, bd)
932
int inflate_codes(__GPRO__ struct huft *tl, struct huft *td, unsigned bl, unsigned bd)
933
     __GDEF
933
//struct huft *tl, *td;   /* literal/length and distance decoder tables */
934
struct huft *tl, *td;   /* literal/length and distance decoder tables */
934
//unsigned bl, bd;        /* number of bits decoded by tl[] and td[] */
935
unsigned bl, bd;        /* number of bits decoded by tl[] and td[] */
936
/* inflate (decompress) the codes in a deflated (compressed) block.
935
/* inflate (decompress) the codes in a deflated (compressed) block.
937
   Return an error code or zero if it all goes ok. */
936
   Return an error code or zero if it all goes ok. */
938
{
937
{
Lines 1383-1391 cleanup_and_exit: Link Here
1383
1382
1384
1383
1385
1384
1386
static int inflate_block(__G__ e)
1385
static int inflate_block(__GPRO__ int *e)
1387
  __GDEF
1386
  //int *e;               /* last block flag */
1388
  int *e;               /* last block flag */
1389
/* decompress an inflated block */
1387
/* decompress an inflated block */
1390
{
1388
{
1391
  unsigned t;           /* block type */
1389
  unsigned t;           /* block type */
Lines 1434-1442 cleanup_and_exit: Link Here
1434
1432
1435
1433
1436
1434
1437
int inflate(__G__ is_defl64)
1435
int inflate(__GPRO__ int is_defl64)
1438
    __GDEF
1439
    int is_defl64;
1440
/* decompress an inflated entry */
1436
/* decompress an inflated entry */
1441
{
1437
{
1442
  int e;                /* last block flag */
1438
  int e;                /* last block flag */
Lines 1548-1562 int inflate_free(__G) Link Here
1548
#define N_MAX 288       /* maximum number of codes in any set */
1544
#define N_MAX 288       /* maximum number of codes in any set */
1549
1545
1550
1546
1551
int huft_build(__G__ b, n, s, d, e, t, m)
1547
int huft_build(__GPRO__ ZCONST unsigned *b, unsigned n, unsigned s, ZCONST ush *d, ZCONST uch *e, struct huft **t, unsigned *m)
1552
  __GDEF
1548
  //ZCONST unsigned *b;   /* code lengths in bits (all assumed <= BMAX) */
1553
  ZCONST unsigned *b;   /* code lengths in bits (all assumed <= BMAX) */
1549
  //unsigned n;           /* number of codes (assumed <= N_MAX) */
1554
  unsigned n;           /* number of codes (assumed <= N_MAX) */
1550
  //unsigned s;           /* number of simple-valued codes (0..s-1) */
1555
  unsigned s;           /* number of simple-valued codes (0..s-1) */
1551
  //ZCONST ush *d;        /* list of base values for non-simple codes */
1556
  ZCONST ush *d;        /* list of base values for non-simple codes */
1552
  //ZCONST uch *e;        /* list of extra bits for non-simple codes */
1557
  ZCONST uch *e;        /* list of extra bits for non-simple codes */
1553
  //struct huft **t;      /* result: starting table */
1558
  struct huft **t;      /* result: starting table */
1554
  //unsigned *m;          /* maximum lookup bits, returns actual */
1559
  unsigned *m;          /* maximum lookup bits, returns actual */
1560
/* Given a list of code lengths and a maximum table size, make a set of
1555
/* Given a list of code lengths and a maximum table size, make a set of
1561
   tables to decode that set of codes.  Return zero on success, one if
1556
   tables to decode that set of codes.  Return zero on success, one if
1562
   the given code set is incomplete (the tables are still built in this
1557
   the given code set is incomplete (the tables are still built in this
Lines 1754-1761 int huft_build(__G__ b, n, s, d, e, t, m) Link Here
1754
1749
1755
1750
1756
1751
1757
int huft_free(t)
1752
int huft_free(struct huft *t)
1758
struct huft *t;         /* table to free */
1753
//struct huft *t;         /* table to free */
1759
/* Free the malloc'ed tables built by huft_build(), which makes a linked
1754
/* Free the malloc'ed tables built by huft_build(), which makes a linked
1760
   list of the tables it made, with the links in a dummy first entry of
1755
   list of the tables it made, with the links in a dummy first entry of
1761
   each table. */
1756
   each table. */
(-)a/list.c (-7 / +2 lines)
Lines 562-571 static int fn_is_dir(__G) /* returns TRUE if G.filename is directory */ Link Here
562
/* Function get_time_stamp() */
562
/* Function get_time_stamp() */
563
/*****************************/
563
/*****************************/
564
564
565
int get_time_stamp(__G__ last_modtime, nmember)  /* return PK-type error code */
565
int get_time_stamp(__GPRO__ time_t *last_modtime, ulg *nmember)  /* return PK-type error code */
566
    __GDEF
567
    time_t *last_modtime;
568
    ulg *nmember;
569
{
566
{
570
    int do_this_file=FALSE, error, error_in_archive=PK_COOL;
567
    int do_this_file=FALSE, error, error_in_archive=PK_COOL;
571
    ulg j;
568
    ulg j;
Lines 705-713 int get_time_stamp(__G__ last_modtime, nmember) /* return PK-type error code */ Link Here
705
/* Function ratio() */    /* also used by ZipInfo routines */
702
/* Function ratio() */    /* also used by ZipInfo routines */
706
/********************/
703
/********************/
707
704
708
int ratio(uc, c)
705
int ratio(zusz_t uc, zusz_t c) {
709
    zusz_t uc, c;
710
{
711
    zusz_t denom;
706
    zusz_t denom;
712
707
713
    if (uc == 0)
708
    if (uc == 0)
(-)a/match.c (-17 / +10 lines)
Lines 122-132 static int namecmp OF((ZCONST char *s1, ZCONST char *s2)); Link Here
122
122
123
/* match() is a shell to recmatch() to return only Boolean values. */
123
/* match() is a shell to recmatch() to return only Boolean values. */
124
124
125
int match(string, pattern, ignore_case __WDL)
125
int match(ZCONST char *string, ZCONST char *pattern, int ignore_case __WDLPRO) {
126
    ZCONST char *string, *pattern;
127
    int ignore_case;
128
    __WDLDEF
129
{
130
#if (defined(MSDOS) && defined(DOSWILD))
126
#if (defined(MSDOS) && defined(DOSWILD))
131
    char *dospattern;
127
    char *dospattern;
132
    int j = strlen(pattern);
128
    int j = strlen(pattern);
Lines 164-174 int match(string, pattern, ignore_case __WDL) Link Here
164
160
165
161
166
162
167
static int recmatch(p, s, ic __WDL)
163
static int recmatch(ZCONST uch *p, ZCONST uch *s, int ic __WDLPRO)
168
    ZCONST uch *p;        /* sh pattern to match */
164
    //ZCONST uch *p;        /* sh pattern to match */
169
    ZCONST uch *s;        /* string to which to match it */
165
    //ZCONST uch *s;        /* string to which to match it */
170
    int ic;               /* true for case insensitivity */
166
    //int ic;               /* true for case insensitivity */
171
    __WDLDEF              /* directory sepchar for WildStopAtDir mode, or 0 */
167
    //__WDLDEF              /* directory sepchar for WildStopAtDir mode, or 0 */
172
/* Recursively compare the sh pattern p with the string s and return 1 if
168
/* Recursively compare the sh pattern p with the string s and return 1 if
173
 * they match, and 0 or 2 if they don't or if there is a syntax error in the
169
 * they match, and 0 or 2 if they don't or if there is a syntax error in the
174
 * pattern.  This routine recurses on itself no more deeply than the number
170
 * pattern.  This routine recurses on itself no more deeply than the number
Lines 340-347 static int recmatch(p, s, ic __WDL) Link Here
340
336
341
337
342
338
343
static char *isshexp(p)
339
static char *isshexp(ZCONST char *p)
344
ZCONST char *p;
345
/* If p is a sh expression, a pointer to the first special character is
340
/* If p is a sh expression, a pointer to the first special character is
346
   returned.  Otherwise, NULL is returned. */
341
   returned.  Otherwise, NULL is returned. */
347
{
342
{
Lines 355-363 ZCONST char *p; Link Here
355
350
356
351
357
352
358
static int namecmp(s1, s2)
353
static int namecmp(ZCONST char *s1, ZCONST char *s2) {
359
    ZCONST char *s1, *s2;
360
{
361
    int d;
354
    int d;
362
355
363
    for (;;) {
356
    for (;;) {
Lines 377-384 static int namecmp(s1, s2) Link Here
377
370
378
371
379
372
380
int iswild(p)        /* originally only used for stat()-bug workaround in */
373
int iswild(ZCONST char *p)        /* originally only used for stat()-bug workaround in */
381
    ZCONST char *p;  /*  VAX C, Turbo/Borland C, Watcom C, Atari MiNT libs; */
374
    //ZCONST char *p;  /*  VAX C, Turbo/Borland C, Watcom C, Atari MiNT libs; */
382
{                    /*  now used in process_zipfiles() as well */
375
{                    /*  now used in process_zipfiles() as well */
383
    for (; *p; INCSTR(p))
376
    for (; *p; INCSTR(p))
384
        if (*p == '\\' && *(p+1))
377
        if (*p == '\\' && *(p+1))
(-)a/process.c (-61 / +28 lines)
Lines 656-665 void free_G_buffers(__G) /* releases all memory allocated in global vars */ Link Here
656
/* Function do_seekable() */
656
/* Function do_seekable() */
657
/**************************/
657
/**************************/
658
658
659
static int do_seekable(__G__ lastchance)        /* return PK-type error code */
659
static int do_seekable(__GPRO__ int lastchance) {        /* return PK-type error code */
660
    __GDEF
661
    int lastchance;
662
{
663
#ifndef SFX
660
#ifndef SFX
664
    /* static int no_ecrec = FALSE;  SKM: moved to globals.h */
661
    /* static int no_ecrec = FALSE;  SKM: moved to globals.h */
665
    int maybe_exe=FALSE;
662
    int maybe_exe=FALSE;
Lines 1124-1135 static zoff_t file_size(fh) Link Here
1124
/* Function rec_find() */
1121
/* Function rec_find() */
1125
/***********************/
1122
/***********************/
1126
1123
1127
static int rec_find(__G__ searchlen, signature, rec_size)
1124
static int rec_find(__GPRO__ zoff_t searchlen, char* signature, int rec_size)
1128
    /* return 0 when rec found, 1 when not found, 2 in case of read error */
1125
    /* return 0 when rec found, 1 when not found, 2 in case of read error */
1129
    __GDEF
1130
    zoff_t searchlen;
1131
    char* signature;
1132
    int rec_size;
1133
{
1126
{
1134
    int i, numblks, found=FALSE;
1127
    int i, numblks, found=FALSE;
1135
    zoff_t tail_len;
1128
    zoff_t tail_len;
Lines 1225-1234 static int check_ecrec_zip64(__G) Link Here
1225
/* Function find_ecrec64() */
1218
/* Function find_ecrec64() */
1226
/***************************/
1219
/***************************/
1227
1220
1228
static int find_ecrec64(__G__ searchlen)         /* return PK-class error */
1221
static int find_ecrec64(__GPRO__ zoff_t searchlen) {         /* return PK-class error */
1229
    __GDEF
1230
    zoff_t searchlen;
1231
{
1232
    ec_byte_rec64 byterec;          /* buf for ecrec64 */
1222
    ec_byte_rec64 byterec;          /* buf for ecrec64 */
1233
    ec_byte_loc64 byterecL;         /* buf for ecrec64 locator */
1223
    ec_byte_loc64 byterecL;         /* buf for ecrec64 locator */
1234
    zoff_t ecloc64_start_offset;    /* start offset of ecrec64 locator */
1224
    zoff_t ecloc64_start_offset;    /* start offset of ecrec64 locator */
Lines 1455-1464 static int find_ecrec64(__G__ searchlen) /* return PK-class error */ Link Here
1455
/* Function find_ecrec() */
1445
/* Function find_ecrec() */
1456
/*************************/
1446
/*************************/
1457
1447
1458
static int find_ecrec(__G__ searchlen)          /* return PK-class error */
1448
static int find_ecrec(__GPRO__ zoff_t searchlen) {         /* return PK-class error */
1459
    __GDEF
1460
    zoff_t searchlen;
1461
{
1462
    int found = FALSE;
1449
    int found = FALSE;
1463
    int error_in_archive;
1450
    int error_in_archive;
1464
    int result;
1451
    int result;
Lines 1902-1911 int process_local_file_hdr(__G) /* return PK-type error code */ Link Here
1902
/* Function getZip64Data() */
1889
/* Function getZip64Data() */
1903
/*******************************/
1890
/*******************************/
1904
1891
1905
int getZip64Data(__G__ ef_buf, ef_len)
1892
int getZip64Data(__GPRO__ ZCONST uch *ef_buf, unsigned ef_len)
1906
    __GDEF
1893
    //ZCONST uch *ef_buf; /* buffer containing extra field */
1907
    ZCONST uch *ef_buf; /* buffer containing extra field */
1894
    //unsigned ef_len;    /* total length of extra field */
1908
    unsigned ef_len;    /* total length of extra field */
1909
{
1895
{
1910
    unsigned eb_id;
1896
    unsigned eb_id;
1911
    unsigned eb_len;
1897
    unsigned eb_len;
Lines 2009-2018 int getZip64Data(__G__ ef_buf, ef_len) Link Here
2009
/* Function getUnicodeData() */
1995
/* Function getUnicodeData() */
2010
/*******************************/
1996
/*******************************/
2011
1997
2012
int getUnicodeData(__G__ ef_buf, ef_len)
1998
int getUnicodeData(__GPRO__ ZCONST uch *ef_buf, unsigned ef_len)
2013
    __GDEF
1999
    //ZCONST uch *ef_buf; /* buffer containing extra field */
2014
    ZCONST uch *ef_buf; /* buffer containing extra field */
2000
    //unsigned ef_len;    /* total length of extra field */
2015
    unsigned ef_len;    /* total length of extra field */
2016
{
2001
{
2017
    unsigned eb_id;
2002
    unsigned eb_id;
2018
    unsigned eb_len;
2003
    unsigned eb_len;
Lines 2157-2165 static int utf8_to_ucs4_string OF((ZCONST char *utf8, ulg *ucs4buf, Link Here
2157
 * Returns the number of bytes used by the first character in a UTF-8
2142
 * Returns the number of bytes used by the first character in a UTF-8
2158
 * string, or -1 if the UTF-8 is invalid or null.
2143
 * string, or -1 if the UTF-8 is invalid or null.
2159
 */
2144
 */
2160
static int utf8_char_bytes(utf8)
2145
static int utf8_char_bytes(ZCONST char *utf8) {
2161
  ZCONST char *utf8;
2162
{
2163
  int      t, r;
2146
  int      t, r;
2164
  unsigned lead;
2147
  unsigned lead;
2165
2148
Lines 2196-2204 static int utf8_char_bytes(utf8) Link Here
2196
 * Returns ~0 (= -1 in twos-complement notation) and does not advance the
2179
 * Returns ~0 (= -1 in twos-complement notation) and does not advance the
2197
 * pointer when input is ill-formed.
2180
 * pointer when input is ill-formed.
2198
 */
2181
 */
2199
static ulg ucs4_char_from_utf8(utf8)
2182
static ulg ucs4_char_from_utf8(ZCONST char **utf8) {
2200
  ZCONST char **utf8;
2201
{
2202
  ulg  ret;
2183
  ulg  ret;
2203
  int  t, bytes;
2184
  int  t, bytes;
2204
2185
Lines 2264-2274 static int utf8_from_ucs4_char(utf8buf, ch) Link Here
2264
 *
2245
 *
2265
 * Return UCS count.  Now returns int so can return -1.
2246
 * Return UCS count.  Now returns int so can return -1.
2266
 */
2247
 */
2267
static int utf8_to_ucs4_string(utf8, ucs4buf, buflen)
2248
static int utf8_to_ucs4_string(ZCONST char *utf8, ulg *ucs4buf, int buflen) {
2268
  ZCONST char *utf8;
2269
  ulg *ucs4buf;
2270
  int buflen;
2271
{
2272
  int count = 0;
2249
  int count = 0;
2273
2250
2274
  for (;;)
2251
  for (;;)
Lines 2408-2416 char *local_to_utf8_string(local_string) Link Here
2408
 /* set this to the max bytes an escape can be */
2385
 /* set this to the max bytes an escape can be */
2409
#define MAX_ESCAPE_BYTES 8
2386
#define MAX_ESCAPE_BYTES 8
2410
2387
2411
char *wide_to_escape_string(wide_char)
2388
char *wide_to_escape_string(zwchar wide_char) {
2412
  zwchar wide_char;
2413
{
2414
  int i;
2389
  int i;
2415
  zwchar w = wide_char;
2390
  zwchar w = wide_char;
2416
  uch b[sizeof(zwchar)];
2391
  uch b[sizeof(zwchar)];
Lines 2497-2510 zwchar escape_string_to_wide(escape_string) Link Here
2497
2472
2498
#ifndef WIN32  /* WIN32 supplies a special variant of this function */
2473
#ifndef WIN32  /* WIN32 supplies a special variant of this function */
2499
/* convert wide character string to multi-byte character string */
2474
/* convert wide character string to multi-byte character string */
2500
char *wide_to_local_string(wide_string, escape_all)
2475
char *wide_to_local_string(ZCONST zwchar *wide_string, int escape_all) {
2501
  ZCONST zwchar *wide_string;
2502
  int escape_all;
2503
{
2504
  int i;
2476
  int i;
2505
  wchar_t wc;
2477
  wchar_t wc;
2506
  int b;
2478
  int b;
2507
  int state_dependent;
2479
  //int state_dependent;
2508
  int wsize = 0;
2480
  int wsize = 0;
2509
  int max_bytes = MB_CUR_MAX;
2481
  int max_bytes = MB_CUR_MAX;
2510
  char buf[ MB_CUR_MAX+ 1];             /* ("+1" not really needed?) */
2482
  char buf[ MB_CUR_MAX+ 1];             /* ("+1" not really needed?) */
Lines 2526-2535 char *wide_to_local_string(wide_string, escape_all) Link Here
2526
  /* set initial state if state-dependent encoding */
2498
  /* set initial state if state-dependent encoding */
2527
  wc = (wchar_t)'a';
2499
  wc = (wchar_t)'a';
2528
  b = wctomb(NULL, wc);
2500
  b = wctomb(NULL, wc);
2529
  if (b == 0)
2501
  /*if (b == 0)
2530
    state_dependent = 0;
2502
    state_dependent = 0;
2531
  else
2503
  else
2532
    state_dependent = 1;
2504
    state_dependent = 1;*/
2533
  for (i = 0; i < wsize; i++) {
2505
  for (i = 0; i < wsize; i++) {
2534
    if (sizeof(wchar_t) < 4 && wide_string[i] > 0xFFFF) {
2506
    if (sizeof(wchar_t) < 4 && wide_string[i] > 0xFFFF) {
2535
      /* wchar_t probably 2 bytes */
2507
      /* wchar_t probably 2 bytes */
Lines 2624-2633 char *local_to_display_string(local_string) Link Here
2624
#endif /* unused */
2596
#endif /* unused */
2625
2597
2626
/* UTF-8 to local */
2598
/* UTF-8 to local */
2627
char *utf8_to_local_string(utf8_string, escape_all)
2599
char *utf8_to_local_string(ZCONST char *utf8_string, int escape_all) {
2628
  ZCONST char *utf8_string;
2629
  int escape_all;
2630
{
2631
  zwchar *wide;
2600
  zwchar *wide;
2632
  char *loc = NULL;
2601
  char *loc = NULL;
2633
2602
Lines 2701-2709 char *wide_to_utf8_string(wide_string) Link Here
2701
#endif /* unused */
2670
#endif /* unused */
2702
2671
2703
/* convert UTF-8 string to wide string */
2672
/* convert UTF-8 string to wide string */
2704
zwchar *utf8_to_wide_string(utf8_string)
2673
zwchar *utf8_to_wide_string(ZCONST char *utf8_string) {
2705
  ZCONST char *utf8_string;
2706
{
2707
  int wcount;
2674
  int wcount;
2708
  zwchar *wide_string;
2675
  zwchar *wide_string;
2709
2676
Lines 2763-2776 static int read_ux3_value(dbuf, uidgid_sz, p_uidgid) Link Here
2763
/* Function ef_scan_for_izux() */
2730
/* Function ef_scan_for_izux() */
2764
/*******************************/
2731
/*******************************/
2765
2732
2766
unsigned ef_scan_for_izux(ef_buf, ef_len, ef_is_c, dos_mdatetime,
2733
unsigned ef_scan_for_izux(ZCONST uch *ef_buf, unsigned ef_len, int ef_is_c, ulg dos_mdatetime,
2767
                          z_utim, z_uidgid)
2734
                          iztimes *z_utim, ulg *z_uidgid)
2768
    ZCONST uch *ef_buf; /* buffer containing extra field */
2735
    //ZCONST uch *ef_buf; /* buffer containing extra field */
2769
    unsigned ef_len;    /* total length of extra field */
2736
    //unsigned ef_len;    /* total length of extra field */
2770
    int ef_is_c;        /* flag indicating "is central extra field" */
2737
    //int ef_is_c;        /* flag indicating "is central extra field" */
2771
    ulg dos_mdatetime;  /* last_mod_file_date_time in DOS format */
2738
    //ulg dos_mdatetime;  /* last_mod_file_date_time in DOS format */
2772
    iztimes *z_utim;    /* return storage: atime, mtime, ctime */
2739
    //iztimes *z_utim;    /* return storage: atime, mtime, ctime */
2773
    ulg *z_uidgid;      /* return storage: uid and gid */
2740
    //ulg *z_uidgid;      /* return storage: uid and gid */
2774
{
2741
{
2775
    unsigned flags = 0;
2742
    unsigned flags = 0;
2776
    unsigned eb_id;
2743
    unsigned eb_id;
(-)a/ttyio.c (-27 / +19 lines)
Lines 303-311 int tt_getch() Link Here
303
/*
303
/*
304
 * Turn echo off for file descriptor f.  Assumes that f is a tty device.
304
 * Turn echo off for file descriptor f.  Assumes that f is a tty device.
305
 */
305
 */
306
void Echoff(__G__ f)
306
void Echoff(__GPRO__ int f)
307
    __GDEF
307
    //int f;                    /* file descriptor for which to turn echo off */
308
    int f;                    /* file descriptor for which to turn echo off */
309
{
308
{
310
    struct sgttyb sg;         /* tty device structure */
309
    struct sgttyb sg;         /* tty device structure */
311
310
Lines 350-359 void Echon(__G) Link Here
350
349
351
#if (defined(TIOCGWINSZ) && !defined(M_UNIX))
350
#if (defined(TIOCGWINSZ) && !defined(M_UNIX))
352
351
353
int screensize(tt_rows, tt_cols)
352
int screensize(int *tt_rows, int *tt_cols) {
354
    int *tt_rows;
355
    int *tt_cols;
356
{
357
    struct winsize wsz;
353
    struct winsize wsz;
358
#ifdef DEBUG_WINSZ
354
#ifdef DEBUG_WINSZ
359
    static int firsttime = TRUE;
355
    static int firsttime = TRUE;
Lines 436-444 int screensize(tt_rows, tt_cols) Link Here
436
/*
432
/*
437
 * Get a character from the given file descriptor without echo or newline.
433
 * Get a character from the given file descriptor without echo or newline.
438
 */
434
 */
439
int zgetch(__G__ f)
435
int zgetch(__GPRO__ int f)
440
    __GDEF
436
    //int f;                      /* file descriptor from which to read */
441
    int f;                      /* file descriptor from which to read */
442
{
437
{
443
#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS))
438
#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS))
444
    char oldmin, oldtim;
439
    char oldmin, oldtim;
Lines 460-466 int zgetch(__G__ f) Link Here
460
    STTY(f, &sg);               /* set cbreak mode */
455
    STTY(f, &sg);               /* set cbreak mode */
461
    GLOBAL(echofd) = f;         /* in case ^C hit (not perfect: still CBREAK) */
456
    GLOBAL(echofd) = f;         /* in case ^C hit (not perfect: still CBREAK) */
462
457
463
    read(f, &c, 1);             /* read our character */
458
    (void)read(f, &c, 1);             /* read our character */
464
459
465
#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS))
460
#if (defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS))
466
    sg.c_cc[VMIN] = oldmin;     /* restore old values */
461
    sg.c_cc[VMIN] = oldmin;     /* restore old values */
Lines 547-557 int zgetch(__G__ f) Link Here
547
/* This is the getp() function for all systems (with TTY type user interface)
542
/* This is the getp() function for all systems (with TTY type user interface)
548
 * that supply a working `non-echo' getch() function for "raw" console input.
543
 * that supply a working `non-echo' getch() function for "raw" console input.
549
 */
544
 */
550
char *getp(__G__ m, p, n)
545
char *getp(__GPRO__ ZCONST char *m, char *p, int n)
551
    __GDEF
546
    //ZCONST char *m;             /* prompt for password */
552
    ZCONST char *m;             /* prompt for password */
547
    //char *p;                    /* return value: line input */
553
    char *p;                    /* return value: line input */
548
    //int n;                      /* bytes available in p[] */
554
    int n;                      /* bytes available in p[] */
555
{
549
{
556
    char c;                     /* one-byte buffer for read() to use */
550
    char c;                     /* one-byte buffer for read() to use */
557
    int i;                      /* number of characters input */
551
    int i;                      /* number of characters input */
Lines 599-609 char *getp(__G__ m, p, n) Link Here
599
#  endif
593
#  endif
600
#endif
594
#endif
601
595
602
char *getp(__G__ m, p, n)
596
char *getp(__GPRO__ ZCONST char *m, char *p, int n)
603
    __GDEF
597
    //ZCONST char *m;             /* prompt for password */
604
    ZCONST char *m;             /* prompt for password */
598
    //char *p;                    /* return value: line input */
605
    char *p;                    /* return value: line input */
599
    //int n;                      /* bytes available in p[] */
606
    int n;                      /* bytes available in p[] */
607
{
600
{
608
    char c;                     /* one-byte buffer for read() to use */
601
    char c;                     /* one-byte buffer for read() to use */
609
    int i;                      /* number of characters input */
602
    int i;                      /* number of characters input */
Lines 628-634 char *getp(__G__ m, p, n) Link Here
628
        i = 0;
621
        i = 0;
629
        echoff(f);
622
        echoff(f);
630
        do {                    /* read line, keeping n */
623
        do {                    /* read line, keeping n */
631
            read(f, &c, 1);
624
            (void)read(f, &c, 1);
632
            if (i < n)
625
            if (i < n)
633
                p[i++] = c;
626
                p[i++] = c;
634
        } while (c != '\n');
627
        } while (c != '\n');
Lines 652-662 char *getp(__G__ m, p, n) Link Here
652
645
653
#if (defined(VMS) || defined(CMS_MVS))
646
#if (defined(VMS) || defined(CMS_MVS))
654
647
655
char *getp(__G__ m, p, n)
648
char *getp(__GPRO__ ZCONST char *m, char *p, int n)
656
    __GDEF
649
    //ZCONST char *m;             /* prompt for password */
657
    ZCONST char *m;             /* prompt for password */
650
    //char *p;                    /* return value: line input */
658
    char *p;                    /* return value: line input */
651
    //int n;                      /* bytes available in p[] */
659
    int n;                      /* bytes available in p[] */
660
{
652
{
661
    char c;                     /* one-byte buffer for read() to use */
653
    char c;                     /* one-byte buffer for read() to use */
662
    int i;                      /* number of characters input */
654
    int i;                      /* number of characters input */
(-)a/ubz2err.c (-3 / +1 lines)
Lines 45-53 Link Here
45
 * BZ_NO_STDIO), required to handle fatal internal bug-type errors of
45
 * BZ_NO_STDIO), required to handle fatal internal bug-type errors of
46
 * the bzip2 library.
46
 * the bzip2 library.
47
 */
47
 */
48
void bz_internal_error(bzerrcode)
48
void bz_internal_error(int bzerrcode) {
49
    int bzerrcode;
50
{
51
    GETGLOBALS();
49
    GETGLOBALS();
52
50
53
    Info(slide, 0x421, ((char *)slide,
51
    Info(slide, 0x421, ((char *)slide,
(-)a/unix/unix.c (-35 / +10 lines)
Lines 189-197 struct dirent *readdir(dirp) Link Here
189
/* Function do_wild() */   /* for porting: dir separator; match(ignore_case) */
189
/* Function do_wild() */   /* for porting: dir separator; match(ignore_case) */
190
/**********************/
190
/**********************/
191
191
192
char *do_wild(__G__ wildspec)
192
char *do_wild(__GPRO__ ZCONST char *wildspec)
193
    __GDEF
193
    //ZCONST char *wildspec;  /* only used first time on a given dir */
194
    ZCONST char *wildspec;  /* only used first time on a given dir */
195
{
194
{
196
/* these statics are now declared in SYSTEM_SPECIFIC_GLOBALS in unxcfg.h:
195
/* these statics are now declared in SYSTEM_SPECIFIC_GLOBALS in unxcfg.h:
197
    static DIR *wild_dir = (DIR *)NULL;
196
    static DIR *wild_dir = (DIR *)NULL;
Lines 331-340 char *do_wild(__G__ wildspec) Link Here
331
 * file as the user or group.  The new option -K bypasses this check.
330
 * file as the user or group.  The new option -K bypasses this check.
332
 */
331
 */
333
332
334
static unsigned filtattr(__G__ perms)
333
static unsigned filtattr(__GPRO__ unsigned perms) {
335
    __GDEF
336
    unsigned perms;
337
{
338
    /* keep setuid/setgid/tacky perms? */
334
    /* keep setuid/setgid/tacky perms? */
339
    if (!uO.K_flag)
335
    if (!uO.K_flag)
340
        perms &= ~(S_ISUID | S_ISGID | S_ISVTX);
336
        perms &= ~(S_ISUID | S_ISGID | S_ISVTX);
Lines 498-506 int mapattr(__G) Link Here
498
/*  Function mapname()  */
494
/*  Function mapname()  */
499
/************************/
495
/************************/
500
496
501
int mapname(__G__ renamed)
497
int mapname(__GPRO__ int renamed)
502
    __GDEF
503
    int renamed;
504
/*
498
/*
505
 * returns:
499
 * returns:
506
 *  MPN_OK          - no problem detected
500
 *  MPN_OK          - no problem detected
Lines 751-760 int mapname(__G__ renamed) Link Here
751
/* Function checkdir() */
745
/* Function checkdir() */
752
/***********************/
746
/***********************/
753
747
754
int checkdir(__G__ pathcomp, flag)
748
int checkdir(__GPRO__ char *pathcomp, int flag)
755
    __GDEF
756
    char *pathcomp;
757
    int flag;
758
/*
749
/*
759
 * returns:
750
 * returns:
760
 *  MPN_OK          - no problem detected
751
 *  MPN_OK          - no problem detected
Lines 1044-1054 int mkdir(path, mode) Link Here
1044
#if (!defined(MTS) || defined(SET_DIR_ATTRIB))
1035
#if (!defined(MTS) || defined(SET_DIR_ATTRIB))
1045
static int get_extattribs OF((__GPRO__ iztimes *pzt, ulg z_uidgid[2]));
1036
static int get_extattribs OF((__GPRO__ iztimes *pzt, ulg z_uidgid[2]));
1046
1037
1047
static int get_extattribs(__G__ pzt, z_uidgid)
1038
static int get_extattribs(__G__ iztimes *pzt, ulg z_uidgid[2]) {
1048
    __GDEF
1049
    iztimes *pzt;
1050
    ulg z_uidgid[2];
1051
{
1052
/*---------------------------------------------------------------------------
1039
/*---------------------------------------------------------------------------
1053
    Convert from MSDOS-format local time and date to Unix-format 32-bit GMT
1040
    Convert from MSDOS-format local time and date to Unix-format 32-bit GMT
1054
    time:  adjust base year from 1980 to 1970, do usual conversions from
1041
    time:  adjust base year from 1980 to 1970, do usual conversions from
Lines 1276-1285 void close_outfile(__G) /* GRR: change to return PK-style warning level */ Link Here
1276
1263
1277
1264
1278
#if (defined(SYMLINKS) && defined(SET_SYMLINK_ATTRIBS))
1265
#if (defined(SYMLINKS) && defined(SET_SYMLINK_ATTRIBS))
1279
int set_symlnk_attribs(__G__ slnk_entry)
1266
int set_symlnk_attribs(__GPRO__ slinkentry *slnk_entry) {
1280
    __GDEF
1281
    slinkentry *slnk_entry;
1282
{
1283
    if (slnk_entry->attriblen > 0) {
1267
    if (slnk_entry->attriblen > 0) {
1284
# if (!defined(NO_LCHOWN))
1268
# if (!defined(NO_LCHOWN))
1285
      if (slnk_entry->attriblen > sizeof(unsigned)) {
1269
      if (slnk_entry->attriblen > sizeof(unsigned)) {
Lines 1324-1333 int set_symlnk_attribs(__G__ slnk_entry) Link Here
1324
#  endif
1308
#  endif
1325
1309
1326
1310
1327
int defer_dir_attribs(__G__ pd)
1311
int defer_dir_attribs(__GPRO__ direntry **pd) {
1328
    __GDEF
1329
    direntry **pd;
1330
{
1331
    uxdirattr *d_entry;
1312
    uxdirattr *d_entry;
1332
1313
1333
    d_entry = (uxdirattr *)malloc(sizeof(uxdirattr) + strlen(G.filename));
1314
    d_entry = (uxdirattr *)malloc(sizeof(uxdirattr) + strlen(G.filename));
Lines 1346-1355 int defer_dir_attribs(__G__ pd) Link Here
1346
} /* end function defer_dir_attribs() */
1327
} /* end function defer_dir_attribs() */
1347
1328
1348
1329
1349
int set_direc_attribs(__G__ d)
1330
int set_direc_attribs(__GPRO__ direntry *d) {
1350
    __GDEF
1351
    direntry *d;
1352
{
1353
    int errval = PK_OK;
1331
    int errval = PK_OK;
1354
1332
1355
    if (UxAtt(d)->have_uidgid &&
1333
    if (UxAtt(d)->have_uidgid &&
Lines 1397-1406 int set_direc_attribs(__G__ d) Link Here
1397
/*  Function stamp_file()  */
1375
/*  Function stamp_file()  */
1398
/***************************/
1376
/***************************/
1399
1377
1400
int stamp_file(fname, modtime)
1378
int stamp_file(ZCONST char *fname, time_t modtime) {
1401
    ZCONST char *fname;
1402
    time_t modtime;
1403
{
1404
    ztimbuf tp;
1379
    ztimbuf tp;
1405
1380
1406
    tp.modtime = tp.actime = modtime;
1381
    tp.modtime = tp.actime = modtime;
(-)a/unix/unxcfg.h (-1 / +2 lines)
Lines 118-124 typedef struct stat z_stat; Link Here
118
#  endif
118
#  endif
119
#else
119
#else
120
#  include <time.h>
120
#  include <time.h>
121
   struct tm *gmtime(), *localtime();
121
   struct tm *gmtime(const time_t *__timer);
122
   struct tm *localtime(const time_t *__timer);
122
#endif
123
#endif
123
124
124
#if (defined(BSD4_4) || (defined(SYSV) && defined(MODERN)))
125
#if (defined(BSD4_4) || (defined(SYSV) && defined(MODERN)))
(-)a/unshrink.c (-4 / +1 lines)
Lines 304-313 int unshrink(__G) Link Here
304
/* Function partial_clear() */      /* no longer recursive... */
304
/* Function partial_clear() */      /* no longer recursive... */
305
/****************************/
305
/****************************/
306
306
307
static void partial_clear(__G__ lastcodeused)
307
static void partial_clear(__GPRO__ int lastcodeused) {
308
    __GDEF
309
    int lastcodeused;
310
{
311
    register shrint code;
308
    register shrint code;
312
309
313
    /* clear all nodes which have no children (i.e., leaf nodes only) */
310
    /* clear all nodes which have no children (i.e., leaf nodes only) */
(-)a/unzip.c (-18 / +5 lines)
Lines 717-725 See \"unzip -hh\" or unzip.txt for more help. Examples:\n\ Link Here
717
/*  main() / UzpMain() stub  */
717
/*  main() / UzpMain() stub  */
718
/*****************************/
718
/*****************************/
719
719
720
int MAIN(argc, argv)   /* return PK-type error code (except under VMS) */
720
int MAIN(int argc, char *argv[])   /* return PK-type error code (except under VMS) */
721
    int argc;
722
    char *argv[];
723
{
721
{
724
    int r;
722
    int r;
725
723
Lines 736-745 int MAIN(argc, argv) /* return PK-type error code (except under VMS) */ Link Here
736
/*  Primary UnZip entry point  */
734
/*  Primary UnZip entry point  */
737
/*******************************/
735
/*******************************/
738
736
739
int unzip(__G__ argc, argv)
737
int unzip(__GPRO__ int argc, char *argv[])
740
    __GDEF
741
    int argc;
742
    char *argv[];
743
{
738
{
744
#ifndef NO_ZIPINFO
739
#ifndef NO_ZIPINFO
745
    char *p;
740
    char *p;
Lines 1334-1344 static int setsignalhandler(__G__ p_savedhandler_chain, signal_type, Link Here
1334
/* Function uz_opts() */
1329
/* Function uz_opts() */
1335
/**********************/
1330
/**********************/
1336
1331
1337
int uz_opts(__G__ pargc, pargv)
1332
int uz_opts(__GPRO__ int *pargc, char ***pargv) {
1338
    __GDEF
1339
    int *pargc;
1340
    char ***pargv;
1341
{
1342
    char **argv, *s;
1333
    char **argv, *s;
1343
    int argc, c, error=FALSE, negative=0, showhelp=0;
1334
    int argc, c, error=FALSE, negative=0, showhelp=0;
1344
1335
Lines 2045-2053 opts_done: /* yes, very ugly...but only used by UnZipSFX with -x xlist */ Link Here
2045
#    endif
2036
#    endif
2046
#  endif
2037
#  endif
2047
2038
2048
int usage(__G__ error)   /* return PK-type error code */
2039
int usage(__GPRO__ int error)   /* return PK-type error code */
2049
    __GDEF
2050
    int error;
2051
{
2040
{
2052
    Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner),
2041
    Info(slide, error? 1 : 0, ((char *)slide, LoadFarString(UnzipSFXBanner),
2053
      UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
2042
      UZ_MAJORVER, UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL,
Lines 2079-2087 int usage(__G__ error) /* return PK-type error code */ Link Here
2079
#    define QUOTS ""
2068
#    define QUOTS ""
2080
#  endif
2069
#  endif
2081
2070
2082
int usage(__G__ error)   /* return PK-type error code */
2071
int usage(__GPRO__ int error)   /* return PK-type error code */
2083
    __GDEF
2084
    int error;
2085
{
2072
{
2086
    int flag = (error? 1 : 0);
2073
    int flag = (error? 1 : 0);
2087
2074
(-)a/zipinfo.c (-19 / +6 lines)
Lines 446-456 static ZCONST char Far DecimalTime[] = "%04u%02u%02u.%02u%02u%02u"; Link Here
446
/*  Function zi_opts()  */
446
/*  Function zi_opts()  */
447
/************************/
447
/************************/
448
448
449
int zi_opts(__G__ pargc, pargv)
449
int zi_opts(__GPRO__ int *pargc, char ***pargv) {
450
    int *pargc;
451
    char ***pargv;
452
    __GDEF
453
{
454
    char   **argv, *s;
450
    char   **argv, *s;
455
    int    argc, c, error=FALSE, negative=0;
451
    int    argc, c, error=FALSE, negative=0;
456
    int    hflag_slmv=TRUE, hflag_2=FALSE;  /* diff options => diff defaults */
452
    int    hflag_slmv=TRUE, hflag_2=FALSE;  /* diff options => diff defaults */
Lines 1046-1056 int zipinfo(__G) /* return PK-type error code */ Link Here
1046
/*  Function zi_long()  */
1042
/*  Function zi_long()  */
1047
/************************/
1043
/************************/
1048
1044
1049
static int zi_long(__G__ pEndprev, error_in_archive)
1045
static int zi_long(__GPRO__ zusz_t *pEndprev, int error_in_archive)
1050
    /* return PK-type error code */
1046
    /* return PK-type error code */
1051
    __GDEF
1047
    //zusz_t *pEndprev;                /* for zi_long() check of extra bytes */
1052
    zusz_t *pEndprev;                /* for zi_long() check of extra bytes */
1048
    //int error_in_archive;            /* may signal premature return */
1053
    int error_in_archive;            /* may signal premature return */
1054
{
1049
{
1055
#ifdef USE_EF_UT_TIME
1050
#ifdef USE_EF_UT_TIME
1056
    iztimes z_utime;
1051
    iztimes z_utime;
Lines 2269-2278 static int zi_short(__G) /* return PK-type error code */ Link Here
2269
/*  Function zi_showMacTypeCreator()  */
2264
/*  Function zi_showMacTypeCreator()  */
2270
/**************************************/
2265
/**************************************/
2271
2266
2272
static void zi_showMacTypeCreator(__G__ ebfield)
2267
static void zi_showMacTypeCreator(__GPRO__ uch *ebfield) {
2273
    __GDEF
2274
    uch *ebfield;
2275
{
2276
    /* not every Type / Creator character is printable */
2268
    /* not every Type / Creator character is printable */
2277
    if (isprint(native(ebfield[0])) && isprint(native(ebfield[1])) &&
2269
    if (isprint(native(ebfield[0])) && isprint(native(ebfield[1])) &&
2278
        isprint(native(ebfield[2])) && isprint(native(ebfield[3])) &&
2270
        isprint(native(ebfield[2])) && isprint(native(ebfield[3])) &&
Lines 2304-2315 static void zi_showMacTypeCreator(__G__ ebfield) Link Here
2304
/*  Function zi_time()  */
2296
/*  Function zi_time()  */
2305
/************************/
2297
/************************/
2306
2298
2307
static char *zi_time(__G__ datetimez, modtimez, d_t_str)
2299
static char *zi_time(__GPRO__ ZCONST ulg *datetimez, ZCONST time_t *modtimez, char *d_t_str) {
2308
    __GDEF
2309
    ZCONST ulg *datetimez;
2310
    ZCONST time_t *modtimez;
2311
    char *d_t_str;
2312
{
2313
    unsigned yr, mo, dy, hh, mm, ss;
2300
    unsigned yr, mo, dy, hh, mm, ss;
2314
    char monthbuf[4];
2301
    char monthbuf[4];
2315
    ZCONST char *monthstr;
2302
    ZCONST char *monthstr;

Return to bug 910280