Changeset 37 for trunk/src/gcc/fastjar


Ignore:
Timestamp:
Apr 25, 2003, 6:54:01 PM (22 years ago)
Author:
bird
Message:

use xregex to avoid linking trouble

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gcc/fastjar/jargrep.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r36 r37  
    33  Copyright (C) 2002 Free Software Foundation
    44  Copyright (C) 1999, 2000 Bryan Burns
    5   Copyright (C) 2000 Cory Hollingsworth 
    6  
    7   Parts of this program are base on Bryan Burns work with fastjar 
    8   Copyright (C) 1999. 
     5  Copyright (C) 2000 Cory Hollingsworth
     6
     7  Parts of this program are base on Bryan Burns work with fastjar
     8  Copyright (C) 1999.
    99
    1010  This program is free software; you can redistribute it and/or
     
    1212  as published by the Free Software Foundation; either version 2
    1313  of the License, or (at your option) any later version.
    14  
     14
    1515  This program is distributed in the hope that it will be useful,
    1616  but WITHOUT ANY WARRANTY; without even the implied warranty of
    1717  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1818  GNU General Public License for more details.
    19  
     19
    2020  You should have received a copy of the GNU General Public License
    2121  along with this program; if not, write to the Free Software
     
    2525/* Id: jargrep.c,v 1.5 2002/01/03 04:57:56 rodrigc Exp
    2626
    27 Log: jargrep.c,v 
     27Log: jargrep.c,v
    2828Revision 1.5  2002/01/03 04:57:56  rodrigc
    29292001-01-02  Craig Rodrigues  <rodrigc@gcc.gnu.org>
     
    106106#include <stdio.h>
    107107#include <unistd.h>
    108 #include <regex.h>
     108/* bird: use xregex to avoid linking trouble
     109 * #include <regex.h>
     110 */
     111#include <xregex.h>
    109112#include <errno.h>
    110113#include <string.h>
     
    140143        int retflag;
    141144
    142         if((options & JG_PRINT_COUNT) && 
     145        if((options & JG_PRINT_COUNT) &&
    143146                (options & (JG_PRINT_BYTEOFFSET | JG_PRINT_LINE_NUMBER)))
    144147        {
     
    152155/*
    153156Function name: create_regexp
    154 args:   regstr  String containing the uncompiled regular expression.  This may be the 
     157args:   regstr  String containing the uncompiled regular expression.  This may be the
    155158                                expression as is passed in through argv.
    156159                options This is the flag containing the commandline options that have been
    157160                                parsed by getopt.
    158 purpose: Handle the exception handling involved with setting upt a new regular 
     161purpose: Handle the exception handling involved with setting upt a new regular
    159162expression.
    160163returns: Newly allocated compile regular expression ready to be used in an regexec call.
     
    192195        }
    193196
    194         return exp; 
     197        return exp;
    195198}
    196199
     
    211214        signature = UNPACK_UB4(scratch, 0);
    212215
    213 #ifdef DEBUG   
     216#ifdef DEBUG
    214217    printf("signature is %x\n", signature);
    215218#endif
    216219    if(signature == 0x08074b50){
    217 #ifdef DEBUG   
     220#ifdef DEBUG
    218221      printf("skipping data descriptor\n");
    219222#endif
     
    221224      retflag = 2;
    222225    } else if(signature == 0x02014b50){
    223 #ifdef DEBUG   
     226#ifdef DEBUG
    224227      printf("Central header reached.. we're all done!\n");
    225228#endif
     
    229232      retflag = 1;
    230233    }
    231    
     234
    232235        return retflag;
    233236}
     
    247250static void decd_siz(ub4 *csize, ub4 *usize, ub2 *fnlen, ub2 *eflen, ub2 *flags, ub2 *method, ub1 *file_header) {
    248251    *csize = UNPACK_UB4(file_header, LOC_CSIZE);
    249 #ifdef DEBUG   
     252#ifdef DEBUG
    250253    printf("Compressed size is %u\n", *csize);
    251254#endif
     
    257260
    258261    *fnlen = UNPACK_UB2(file_header, LOC_FNLEN);
    259 #ifdef DEBUG   
     262#ifdef DEBUG
    260263    printf("Filename length is %hu\n", *fnlen);
    261264#endif
    262265
    263266    *eflen = UNPACK_UB2(file_header, LOC_EFLEN);
    264 #ifdef DEBUG   
     267#ifdef DEBUG
    265268    printf("Extra field length is %hu\n", *eflen);
    266269#endif
    267270
    268271    *flags = UNPACK_UB2(file_header, LOC_EXTRA);
    269 #ifdef DEBUG   
     272#ifdef DEBUG
    270273    printf("Flags are %#hx\n", *flags);
    271274#endif
     
    296299    filename[len] = '\0';
    297300
    298 #ifdef DEBUG   
     301#ifdef DEBUG
    299302    printf("filename is %s\n", filename);
    300303#endif
     
    414417                num                     Number of matches in pmatch array.
    415418                lines           Number of lines in file.  Not set if -n is not set on command line.
    416                 options         Bitwise flag containing flags set to represent the command line 
     419                options         Bitwise flag containing flags set to represent the command line
    417420                                        options.
    418421purpose:        Control output of jargrep.  Output is controlled by which options have been
     
    495498        size_t i;
    496499
    497         for(i = 0; i < usize; i++) 
     500        for(i = 0; i < usize; i++)
    498501                if(stream[i] != '\t'
    499502                   && (iscntrl((unsigned char)stream[i])
     
    520523
    521524        match_array = NULL;
    522         for(*i = 0, regflag = regexec(exp, str_stream, 1, &match, 0); !regflag; 
     525        for(*i = 0, regflag = regexec(exp, str_stream, 1, &match, 0); !regflag;
    523526                regflag = regexec(exp, &(str_stream[match.rm_eo]), 1, &match, 0), (*i)++)
    524527        {
    525                 if((tmp = (regmatch_t *) 
     528                if((tmp = (regmatch_t *)
    526529                    realloc(match_array, sizeof(regmatch_t) * ((*i) + 1))))
    527530                {
     
    538541                        exit(1);
    539542                }
    540         } 
     543        }
    541544
    542545        return match_array;
     
    582585                lseek(fd, eflen, SEEK_CUR);
    583586                if(filename[fnlen - 1] != '/') {
    584                         str_stream = (method == 8 || (flags & 0x0008)) ? 
    585                                 (char *) inflate_string(pbf, &csize, &usize) : 
     587                        str_stream = (method == 8 || (flags & 0x0008)) ?
     588                                (char *) inflate_string(pbf, &csize, &usize) :
    586589                                        read_string(pbf, csize);
    587590                        if(flags & 0x008) check_crc(pbf, str_stream, usize);
    588591                        mk_ascii(str_stream, usize);
    589592                        match_array = fnd_match(exp, str_stream, &i);
    590                         if((options & JG_PRINT_LINE_NUMBER) && i) 
     593                        if((options & JG_PRINT_LINE_NUMBER) && i)
    591594                                nl_offsets = fnd_match(nl_exp, str_stream, &j);
    592595                        prnt_mtchs(exp, filename, str_stream, match_array, nl_offsets, i, j, options);
     
    604607Funtion name: jargrep
    605608args:   exp             Pointer to compiled POSIX style regular expression of search target.
    606                 nl_exp  Pointer to compiled regular expression for newlines or NULL.  Only set 
     609                nl_exp  Pointer to compiled regular expression for newlines or NULL.  Only set
    607610                                if -n option is present at command line.
    608611                jarfile Filename of jar file to be searched.
Note: See TracChangeset for help on using the changeset viewer.