summaryrefslogtreecommitdiff
path: root/textproc/agrep/files/patch-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'textproc/agrep/files/patch-main.c')
-rw-r--r--textproc/agrep/files/patch-main.c126
1 files changed, 126 insertions, 0 deletions
diff --git a/textproc/agrep/files/patch-main.c b/textproc/agrep/files/patch-main.c
new file mode 100644
index 000000000000..7c32b3b415b9
--- /dev/null
+++ b/textproc/agrep/files/patch-main.c
@@ -0,0 +1,126 @@
+--- main.c.orig 1992-04-14 22:41:24.000000000 +0200
++++ main.c 2011-11-27 13:36:45.000000000 +0100
+@@ -1,6 +1,14 @@
+ /* Copyright (c) 1991 Sun Wu and Udi Manber. All Rights Reserved. */
+ #include "agrep.h"
+ #include "checkfile.h"
++#include <unistd.h>
++#include <fcntl.h>
++
++int exponen(int m);
++void r_output (CHAR *buffer, int i, int end, int j);
++void file_out(char *fname);
++void usage(void);
++void checksg(CHAR *Pattern, int D);
+
+ unsigned Mask[MAXSYM];
+ unsigned Init1, NO_ERR_MASK, Init[MaxError];
+@@ -33,7 +41,7 @@
+ extern int init();
+ int table[WORD][WORD];
+
+-initial_value()
++void initial_value()
+ {
+ int i;
+
+@@ -51,7 +59,7 @@
+ 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;
+@@ -110,7 +118,7 @@
+ return;
+ }
+
+-exponen(m)
++int exponen(m)
+ int m;
+ { int i, ex;
+ ex= 1;
+@@ -118,7 +126,7 @@
+ return(ex);
+ }
+
+-re1(Text, M, D)
++void re1(Text, M, D)
+ int Text, M, D;
+ {
+ register unsigned i, c, r0, r1, r2, r3, CMask, Newline, Init0, r_NO_ERR;
+@@ -393,7 +401,7 @@
+ return;
+ } /* re1 */
+
+-re(Text, M, D)
++void re(Text, M, D)
+ int Text, M, D;
+ {
+ register unsigned i, c, r1, r2, r3, CMask, k, Newline, Init0, Init1, end;
+@@ -595,7 +603,7 @@
+ } /* re */
+
+
+-r_output (buffer, i, end, j)
++void r_output (buffer, i, end, j)
+ int i, end, j;
+ CHAR *buffer;
+ {
+@@ -612,7 +620,7 @@
+ while (bp <= i ) putchar(buffer[bp++]);
+ }
+
+-main(argc, argv)
++int main(argc, argv)
+ int argc; char *argv[];
+ {
+ int N, M, D=0, fp, fd, i, j;
+@@ -751,7 +759,7 @@
+ }
+ if (!(PAT_FILE) && Pattern[0] == '\0') { /* Pattern not set with -e option */
+ if (argc == 0) usage();
+- strcpy(Pattern, *argv);
++ strncpy(Pattern, *argv, sizeof(Pattern));
+ argc--;
+ argv++;
+ }
+@@ -897,7 +905,7 @@
+ } /* end of main() */
+
+
+-file_out(fname)
++void file_out(fname)
+ char *fname;
+ {
+ int num_read;
+@@ -921,7 +929,7 @@
+ }
+
+
+-usage()
++void usage()
+ {
+ fprintf(stderr, "usage: %s [-#cdehiklnpstvwxBDGIS] [-f patternfile] pattern [files]\n", Progname);
+ printf("\n");
+@@ -942,7 +950,7 @@
+ exit(2);
+ }
+
+-checksg(Pattern, D)
++void checksg(Pattern, D)
+ CHAR *Pattern; int D;
+ {
+ char c;
+@@ -999,7 +1007,8 @@
+ return;
+ }
+
+-output (buffer, i1, i2, j)
++void output (register CHAR *buffer, int i1, int i2, int j);
++void output (buffer, i1, i2, j)
+ register CHAR *buffer; int i1, i2, j;
+ {
+ register CHAR *bp, *outend;