[98019] trunk/dports/sysutils/agrep
jmr at macports.org
jmr at macports.org
Sat Sep 22 02:27:56 PDT 2012
Revision: 98019
http://trac.macports.org//changeset/98019
Author: jmr at macports.org
Date: 2012-09-22 02:27:56 -0700 (Sat, 22 Sep 2012)
Log Message:
-----------
agrep: fix invalid code (#35333), use correct compiler and archflags, install docs, set license
Modified Paths:
--------------
trunk/dports/sysutils/agrep/Portfile
Added Paths:
-----------
trunk/dports/sysutils/agrep/files/
trunk/dports/sysutils/agrep/files/return_types.patch
trunk/dports/sysutils/agrep/files/warnings.patch
Modified: trunk/dports/sysutils/agrep/Portfile
===================================================================
--- trunk/dports/sysutils/agrep/Portfile 2012-09-22 09:01:45 UTC (rev 98018)
+++ trunk/dports/sysutils/agrep/Portfile 2012-09-22 09:27:56 UTC (rev 98019)
@@ -1,21 +1,34 @@
# $Id$
+
PortSystem 1.0
+
name agrep
version 2.04
+revision 1
description agrep is similar to egrep.
long_description agrep is similar to egrep \(or grep or fgrep\), \
but it is much more general \(and usually faster\).
maintainers nomaintainer
categories sysutils
-platforms darwin
+license Noncommercial
+platforms darwin
homepage http://netbsd.org
master_sites ftp://ftp.cs.arizona.edu/agrep/
checksums md5 abc645404d3926a57c3f5e86a6e89ee9
extract.suffix .tar.Z
+
+patchfiles return_types.patch warnings.patch
+
use_configure no
build.type bsd
build.target ""
+build.args CC="${configure.cc}" \
+ CFLAGS="${configure.cflags} ${configure.cc_archflags} -std=gnu89"
destroot {
xinstall ${worksrcpath}/agrep ${destroot}${prefix}/bin/
- xinstall ${worksrcpath}/agrep.1 ${destroot}${prefix}/share/man/man1/
+ xinstall -m 644 ${worksrcpath}/agrep.1 ${destroot}${prefix}/share/man/man1/
+ xinstall -d ${destroot}${prefix}/share/doc/${name}
+ xinstall -m 644 -W ${worksrcpath} COPYRIGHT README agrep.algorithms \
+ agrep.chronicle contribution.list \
+ ${destroot}${prefix}/share/doc/${name}
}
Added: trunk/dports/sysutils/agrep/files/return_types.patch
===================================================================
--- trunk/dports/sysutils/agrep/files/return_types.patch (rev 0)
+++ trunk/dports/sysutils/agrep/files/return_types.patch 2012-09-22 09:27:56 UTC (rev 98019)
@@ -0,0 +1,453 @@
+--- asearch1.c.orig 1992-01-18 08:00:38.000000000 +1100
++++ asearch1.c 2012-09-22 16:45:50.000000000 +1000
+@@ -8,7 +8,7 @@ extern char CurrentFileName[];
+ extern int num_of_matched;
+
+
+-asearch1(old_D_pat, Text, D)
++void asearch1(old_D_pat, Text, D)
+ char old_D_pat[]; int Text; register unsigned D;
+ {
+ register unsigned end, i, r1, r2, r3, r4, r5, CMask, D_Mask, Init0, k, endpos;
+--- bitap.c.orig 1992-01-18 08:00:15.000000000 +1100
++++ bitap.c 2012-09-22 16:48:16.000000000 +1000
+@@ -22,7 +22,7 @@ extern int num_of_matched;
+
+ /* bitap dispatches job */
+
+-bitap(old_D_pat, Pattern, fd, M, D)
++void bitap(old_D_pat, Pattern, fd, M, D)
+ char old_D_pat[], *Pattern; int fd, M, D;
+ {
+ char c;
+--- checkfile.c.orig 1992-01-18 06:14:42.000000000 +1100
++++ checkfile.c 2012-09-22 16:56:42.000000000 +1000
+@@ -66,6 +66,7 @@ int ftype;
+ }
+ */
+ }
++ return 0;
+ }
+
+ /***************************************************************************
+--- compat.c.orig 1992-01-22 00:36:26.000000000 +1100
++++ compat.c 2012-09-22 17:04:50.000000000 +1000
+@@ -53,5 +53,5 @@ int i, j, k;
+ exit(2);
+ }
+ }
+-
++ return 0;
+ }
+--- asearch.c.orig 1992-01-24 12:49:08.000000000 +1100
++++ asearch.c 2012-09-22 17:08:18.000000000 +1000
+@@ -6,7 +6,9 @@ extern int DELIMITER, FILENAMEONLY, INVE
+ extern CHAR CurrentFileName[];
+ extern int I, num_of_matched, TRUNCATE;
+
+-asearch(old_D_pat, text, D)
++void asearch0(CHAR old_D_pat[], int text, register unsigned D);
++
++void asearch(old_D_pat, text, D)
+ CHAR old_D_pat[]; int text; register unsigned D;
+ {
+ register unsigned i, c, r1, r2, CMask, r_NO_ERR, r_Init1;
+@@ -178,7 +180,7 @@ Nextchar1: i=i+1;
+ return;
+ }
+
+-asearch0(old_D_pat, text, D)
++void asearch0(old_D_pat, text, D)
+ CHAR old_D_pat[]; int text; register unsigned D;
+ {
+ register unsigned i, c, r1, r2, r3, CMask, r_NO_ERR, r_Init1, end, endpos;
+--- main.c.orig 1992-04-15 06:41:24.000000000 +1000
++++ main.c 2012-09-22 17:43:47.000000000 +1000
+@@ -33,7 +33,7 @@ int NOFILENAME = 0, /* Boolean flag, s
+ extern int init();
+ int table[WORD][WORD];
+
+-initial_value()
++void initial_value()
+ {
+ int i;
+
+@@ -51,7 +51,7 @@ initial_value()
+ for (i=0; i< MAXSYM; i++) Mask[i] = 0;
+ }
+
+-compute_next(M, Next, Next1)
++void compute_next(M, Next, Next1)
+ int M; unsigned *Next, *Next1;
+ {
+ int i, j=0, n, k, temp;
+@@ -118,6 +118,8 @@ int m;
+ return(ex);
+ }
+
++void r_output (CHAR *buffer, int i, int end, int j);
++
+ re1(Text, M, D)
+ int Text, M, D;
+ {
+@@ -181,7 +183,7 @@ int Text, M, D;
+ if(FILENAMEONLY) {
+ num_of_matched++;
+ printf("%s\n", CurrentFileName);
+- return;
++ return 0;
+ }
+ r_output(buffer, i-1, end, j);
+ }
+@@ -207,7 +209,7 @@ int Text, M, D;
+ if(FILENAMEONLY) {
+ num_of_matched++;
+ printf("%s\n", CurrentFileName);
+- return;
++ return 0;
+ }
+ r_output(buffer, i-1, end, j);
+ }
+@@ -218,7 +220,7 @@ int Text, M, D;
+ } /* while i < end ... */
+ strncpy(buffer, buffer+num_read, Maxline);
+ } /* end while read()... */
+- return;
++ return 0;
+ } /* end if (D == 0) */
+ while ((num_read = read(Text, buffer + Maxline, BlockSize)) > 0)
+ {
+@@ -294,7 +296,7 @@ int Text, M, D;
+ if(FILENAMEONLY) {
+ num_of_matched++;
+ printf("%s\n", CurrentFileName);
+- return;
++ return 0;
+ }
+ r_output(buffer, i, end, j);
+ }
+@@ -372,7 +374,7 @@ Nextchar: i=i+1;
+ if(FILENAMEONLY) {
+ num_of_matched++;
+ printf("%s\n", CurrentFileName);
+- return;
++ return 0;
+ }
+ r_output(buffer, i, end, j);
+ }
+@@ -390,7 +392,7 @@ Nextchar1: i=i+1;
+ } /* while */
+ strncpy(buffer, buffer+num_read, Maxline);
+ } /* while */
+- return;
++ return 0;
+ } /* re1 */
+
+ re(Text, M, D)
+@@ -447,7 +449,7 @@ int Text, M, D;
+ if(FILENAMEONLY) {
+ num_of_matched++;
+ printf("%s\n", CurrentFileName);
+- return;
++ return 0;
+ }
+ r_output(buffer, i-1, end, j);
+ }
+@@ -470,7 +472,7 @@ int Text, M, D;
+ if(FILENAMEONLY) {
+ num_of_matched++;
+ printf("%s\n", CurrentFileName);
+- return;
++ return 0;
+ }
+ r_output(buffer, i-1, end, j);
+ }
+@@ -485,7 +487,7 @@ int Text, M, D;
+ strncpy(buffer+Maxline-ResidueSize, buffer+lasti, ResidueSize);
+ lasti = Maxline - ResidueSize;
+ } /* while */
+- return;
++ return 0;
+ } /* end if(D==0) */
+ while ((num_read = read(Text, buffer + Maxline, BlockSize)) > 0)
+ {
+@@ -533,7 +535,7 @@ int Text, M, D;
+ if(FILENAMEONLY) {
+ num_of_matched++;
+ printf("%s\n", CurrentFileName);
+- return;
++ return 0;
+ }
+ r_output(buffer, i-1, end, j);
+ }
+@@ -574,7 +576,7 @@ Nextchar:
+ if(FILENAMEONLY) {
+ num_of_matched++;
+ printf("%s\n", CurrentFileName);
+- return;
++ return 0;
+ }
+ r_output(buffer, i, end, j);
+ }
+@@ -591,11 +593,11 @@ Nextchar1: i++;
+ } /* while i < end */
+ strncpy(buffer, buffer+num_read, Maxline);
+ } /* while read() */
+- return;
++ return 0;
+ } /* re */
+
+
+-r_output (buffer, i, end, j)
++void r_output (buffer, i, end, j)
+ int i, end, j;
+ CHAR *buffer;
+ {
+@@ -612,6 +614,8 @@ int bp;
+ while (bp <= i ) putchar(buffer[bp++]);
+ }
+
++void checksg(CHAR *Pattern, int D);
++
+ main(argc, argv)
+ int argc; char *argv[];
+ {
+@@ -942,7 +946,7 @@ usage()
+ exit(2);
+ }
+
+-checksg(Pattern, D)
++void checksg(Pattern, D)
+ CHAR *Pattern; int D;
+ {
+ char c;
+@@ -1003,10 +1007,10 @@ output (buffer, i1, i2, j)
+ register CHAR *buffer; int i1, i2, j;
+ {
+ register CHAR *bp, *outend;
+- if(i1 > i2) return;
++ if(i1 > i2) return 0;
+ num_of_matched++;
+- if(COUNT) return;
+- if(SILENT) return;
++ if(COUNT) return 0;
++ if(SILENT) return 0;
+ if(OUTTAIL) {
+ i1 = i1 + D_length;
+ i2 = i2 + D_length;
+@@ -1031,6 +1035,7 @@ register CHAR *bp, *outend;
+ bp = buffer + i1;
+ outend = buffer + i2;
+ while(bp <= outend) putchar(*bp++);
++ return 0;
+ }
+
+ /* end of main.c */
+--- preprocess.c.orig 1992-01-18 06:14:43.000000000 +1100
++++ preprocess.c 2012-09-22 17:59:15.000000000 +1000
+@@ -207,9 +207,9 @@ CHAR *D_pattern, *Pattern;
+ exit(2);
+ }
+ strcpy(old_pat, Pattern); /* do real change to the Pattern to be returned */
+- return;
++ return 0;
+ } /* if regex */
+
+- return;
++ return 0;
+ }
+
+--- sgrep.c.orig 1992-04-11 08:12:02.000000000 +1000
++++ sgrep.c 2012-09-22 19:08:01.000000000 +1000
+@@ -39,7 +39,7 @@ unsigned Hashmask;
+ char MEMBER_1[MAXMEMBER_1];
+ CHARTYPE TR[MAXSYM];
+
+-char_tr(pat, m)
++void char_tr(pat, m)
+ unsigned char *pat;
+ int *m;
+ {
+@@ -64,6 +64,12 @@ unsigned char temp[MAXPATT];
+ }
+ }
+
++void bm(CHARTYPE *pat, int m, CHARTYPE *text, CHARTYPE *textend);
++void agrep(register CHARTYPE *pat, int M, register CHARTYPE *text, register CHARTYPE *textend, int D);
++void a_monkey(register CHARTYPE *pat, register int m, register CHARTYPE *text, register CHARTYPE *textend, register int D);
++void monkey(register CHARTYPE *pat, register int m, register CHARTYPE *text, register CHARTYPE *textend);
++void monkey4(register unsigned char *pat, register int m, register unsigned char *text, register unsigned char *textend, register int D);
++
+ sgrep(pat, m, fd, D)
+ CHARTYPE *pat; int fd, m, D;
+ {
+@@ -112,7 +118,7 @@ CHARTYPE *pat; int fd, m, D;
+ }
+ if(FILENAMEONLY && num_of_matched) {
+ printf("%s\n", CurrentFileName);
+- return; }
++ return 0; }
+ start = offset - residue ;
+ if(start < MAXLINE) {
+ start = MAXLINE;
+@@ -120,13 +126,13 @@ CHARTYPE *pat; int fd, m, D;
+ strncpy(text+start, text+end, residue);
+ start++;
+ } /* end of while(num_read = ... */
+- return;
++ return 0;
+ } /* end sgrep */
+
+ /* SUN: bm assumes that the content of text[n]...text[n+m-1] is
+ pat[m-1] such that the skip loop is guaranteed to terminated */
+
+-bm(pat, m, text, textend)
++void bm(pat, m, text, textend)
+ CHARTYPE *text, *textend, *pat; int m;
+ {
+ register int shift;
+@@ -200,6 +206,7 @@ CHARTYPE *pattern; unsigned *Mask; regis
+ if( c == pattern[j] )
+ Mask[c] = Mask[c] & ~( Bit1 >> j ) ;
+ }
++ return 0;
+ }
+
+ prep(Pattern, M, D) /* preprocessing for partitioning_bm */
+@@ -247,10 +254,12 @@ unsigned hash, b_size = 3;
+ #endif
+ MEMBER[hash] = 1;
+ }
++ return 0;
+ }
+
++void s_output(CHARTYPE *text, int *i);
+
+-agrep( pat, M, text, textend, D )
++void agrep( pat, M, text, textend, D )
+ int M, D ; register CHARTYPE *text, *textend, *pat;
+ {
+ register int i;
+@@ -357,7 +366,7 @@ int M, D ; register CHARTYPE *text, *tex
+ return;
+ }
+
+-s_output (text, i)
++void s_output (text, i)
+ int *i; CHARTYPE *text;
+ {
+ int kk, bp;
+@@ -404,7 +413,7 @@ unsigned char lastc;
+
+ /* a_monkey() the approximate monkey move */
+
+-a_monkey( pat, m, text, textend, D )
++void a_monkey( pat, m, text, textend, D )
+ register int m, D ; register CHARTYPE *text, *textend, *pat;
+ {
+ register CHARTYPE *oldtext;
+@@ -451,7 +460,7 @@ register int m1 = m-1-D, j, pos;
+
+ CHARTYPE SHIFT_2[MAX_SHIFT_2];
+
+-monkey( pat, m, text, textend )
++void monkey( pat, m, text, textend )
+ register int m ; register CHARTYPE *text, *textend, *pat;
+ {
+ register unsigned hash, i;
+@@ -589,13 +598,14 @@ unsigned hash;
+ }
+ if(shift_1 == 0) shift_1 = 1;
+ SHIFT_2[0] = 0;
++ return 0;
+ }
+
+ /* monkey4() the approximate monkey move */
+
+ char *MEMBER_D;
+
+-monkey4( pat, m, text, textend, D )
++void monkey4( pat, m, text, textend, D )
+ register int m, D ; register unsigned char *text, *pat, *textend;
+ {
+ register unsigned char *oldtext;
+@@ -670,6 +680,7 @@ char_map['n'] = char_map['n'] = 5;
+ MEMBER_D[hash] = 1;
+ }
+ }
++ return 0;
+ }
+
+ blog(base, m )
+--- mgrep.c.orig 1992-04-11 08:12:27.000000000 +1000
++++ mgrep.c 2012-09-22 19:17:16.000000000 +1000
+@@ -36,6 +36,7 @@ unsigned char pat_spool[MAXPATFILE+2*max
+ unsigned char *patt[max_num];
+ unsigned char pat_len[max_num];
+
++void f_prep(int pat_index, unsigned char *Pattern);
+
+ prepf(fp)
+ int fp;
+@@ -95,8 +96,12 @@ int fp;
+ HASH[i] = 0;
+ }
+ for(i=1; i<= num_pat; i++) f_prep(i, patt[i]);
++ return 0;
+ }
+
++void monkey1(register unsigned char *text, int start, int end);
++void m_short(register unsigned char *text, int start, int end);
++void countline(unsigned char *text, int len);
+
+ mgrep(fd)
+ int fd;
+@@ -119,7 +124,7 @@ int fd;
+ else monkey1(text, start, end);
+ if(FILENAMEONLY && num_of_matched) {
+ printf("%s\n", CurrentFileName);
+- return;
++ return 0;
+ }
+ start = MAXLINE - residue;
+ if(start < 0) {
+@@ -133,10 +138,10 @@ int fd;
+ if(SHORT) m_short(text, start, end);
+ else monkey1(text, start, end);
+ }
+- return;
++ return 0;
+ } /* end mgrep */
+
+-countline(text, len)
++void countline(text, len)
+ unsigned char *text; int len;
+ {
+ int i;
+@@ -144,7 +149,7 @@ int i;
+ }
+
+
+-monkey1( text, start, end )
++void monkey1( text, start, end )
+ int start, end; register unsigned char *text;
+ {
+ register unsigned char *textend;
+@@ -232,7 +237,7 @@ while (text <= textend) {
+ if(INVERSE && !COUNT) while(lastout <= textend) putchar(*lastout++);
+ }
+
+-m_short( text, start, end )
++void m_short( text, start, end )
+ int start, end; register unsigned char *text;
+ {
+ register unsigned char *textend;
+@@ -292,7 +297,7 @@ while (++text <= textend) {
+ if(INVERSE && !COUNT) while(lastout <= textend) putchar(*lastout++);
+ }
+
+-f_prep(pat_index, Pattern)
++void f_prep(pat_index, Pattern)
+ unsigned char *Pattern ; int pat_index;
+ {
+ int i, j, m;
Added: trunk/dports/sysutils/agrep/files/warnings.patch
===================================================================
--- trunk/dports/sysutils/agrep/files/warnings.patch (rev 0)
+++ trunk/dports/sysutils/agrep/files/warnings.patch 2012-09-22 09:27:56 UTC (rev 98019)
@@ -0,0 +1,103 @@
+--- agrep.h.orig 1992-01-18 06:15:13.000000000 +1100
++++ agrep.h 2012-09-22 17:00:23.000000000 +1000
+@@ -1,10 +1,10 @@
+ #include <stdio.h>
+ #include <math.h>
+ #include <ctype.h>
++#include <string.h>
++#include <stdlib.h>
+ #include "re.h"
+
+-extern unsigned char *strcpy(), *strncpy(), *strcat();
+-extern int strlen();
+ #define CHAR unsigned char
+ #define MAXPAT 128
+ #define MAXPATT 256
+--- compat.c.orig 2012-09-22 17:07:23.000000000 +1000
++++ compat.c 2012-09-22 17:11:54.000000000 +1000
+@@ -1,5 +1,6 @@
+ /* test the conflicts between options */
+ #include <stdio.h>
++#include <stdlib.h>
+
+ extern int FILENAMEONLY, APPROX, PAT_FILE, COUNT, INVERSE, BESTMATCH;
+ extern FILEOUT;
+@@ -16,7 +17,7 @@ compat()
+ int i, j, k;
+ if(BESTMATCH) if(COUNT || FILENAMEONLY || APPROX || PAT_FILE) {
+ BESTMATCH = 0;
+- fprintf(stderr, "WARNING!!! -B option ignored when -c, -l, -f, or -# is on\n", Progname);
++ fprintf(stderr, "WARNING!!! -B option ignored when -c, -l, -f, or -# is on\n");
+ }
+ if(PAT_FILE) {
+ if(APPROX) {
+--- follow.c.orig 1992-01-18 06:14:42.000000000 +1100
++++ follow.c 2012-09-22 17:21:26.000000000 +1000
+@@ -3,14 +3,12 @@
+ construction. */
+
+ #include <stdio.h>
++#include <string.h>
++#include <stdlib.h>
+ #include "re.h"
+
+-extern char *strncpy(), *strcat(), *strcpy();
+-extern int strlen();
+-
+ #define TRUE 1
+
+-extern char *malloc();
+ extern Pset pset_union();
+ extern int pos_cnt;
+ extern Re_node parse();
+--- parse.c.orig 1992-01-18 06:14:43.000000000 +1100
++++ parse.c 2012-09-22 17:52:04.000000000 +1000
+@@ -3,6 +3,7 @@
+ tree for that regular expression. */
+
+ #include <stdio.h>
++#include <stdlib.h>
+ #include "re.h"
+
+ #define FALSE 0
+--- sgrep.c.orig 2012-09-22 18:40:26.000000000 +1000
++++ sgrep.c 2012-09-22 18:42:06.000000000 +1000
+@@ -1,6 +1,8 @@
+ /* Copyright (c) 1991 Sun Wu and Udi Manber. All Rights Reserved. */
+ #include <stdio.h>
+ #include <ctype.h>
++#include <string.h>
++#include <stdlib.h>
+ #define MAXSYM 256
+ #define MAXMEMBER 8192
+ #define CHARTYPE unsigned char
+--- utilities.c.orig 1992-01-18 06:14:43.000000000 +1100
++++ utilities.c 2012-09-22 19:09:47.000000000 +1000
+@@ -2,6 +2,7 @@
+ and manipulating regular expression syntax trees. */
+
+ #include <stdio.h>
++#include <stdlib.h>
+ #include "re.h"
+
+ /************************************************************************/
+--- mgrep.c.orig 2012-09-22 19:17:16.000000000 +1000
++++ mgrep.c 2012-09-22 19:19:21.000000000 +1000
+@@ -2,6 +2,8 @@
+ /* multipattern matcher */
+ #include <stdio.h>
+ #include <ctype.h>
++#include <stdlib.h>
++#include <string.h>
+ #define MAXPAT 256
+ #define MAXLINE 1024
+ #define MAXSYM 256
+@@ -86,7 +88,7 @@ int fp;
+ if(p!=0 && p < p_size) p_size = p;
+ }
+ if(p_size == 0) {
+- fprintf(stderr, "%s: the pattern file is empty\n");
++ fprintf(stderr, "%s: the pattern file is empty\n", Progname);
+ exit(2);
+ }
+ if(length > 400 && p_size > 2) LONG = 1;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120922/2d70fcbd/attachment-0001.html>
More information about the macports-changes
mailing list