head	1.8;
access;
symbols
	RELEASE_4_8_0:1.7
	RELEASE_5_0_0:1.7
	RELEASE_4_7_0:1.4
	RELEASE_4_6_2:1.4
	RELEASE_4_6_1:1.4
	RELEASE_4_6_0:1.4
	RELEASE_5_0_DP1:1.4
	RELEASE_4_5_0:1.4
	RELEASE_4_4_0:1.4
	RELEASE_4_3_0:1.4
	RELEASE_4_2_0:1.4
	RELEASE_4_1_1:1.3
	RELEASE_4_1_0:1.3
	RELEASE_3_5_0:1.3
	RELEASE_4_0_0:1.3
	RELEASE_3_4_0:1.3
	RELEASE_3_3_0:1.2
	RELEASE_3_2_0:1.2
	RELEASE_3_1_0:1.2
	RELEASE_2_2_8:1.1;
locks; strict;
comment	@# @;


1.8
date	2003.03.28.21.44.15;	author obrien;	state dead;
branches;
next	1.7;

1.7
date	2002.12.30.08.46.35;	author obrien;	state Exp;
branches;
next	1.6;

1.6
date	2002.12.12.23.31.51;	author obrien;	state Exp;
branches;
next	1.5;

1.5
date	2002.10.29.11.26.34;	author edwin;	state Exp;
branches;
next	1.4;

1.4
date	2000.11.03.10.01.02;	author obrien;	state Exp;
branches;
next	1.3;

1.3
date	99.11.29.10.14.16;	author obrien;	state Exp;
branches;
next	1.2;

1.2
date	99.01.18.02.53.23;	author steve;	state Exp;
branches;
next	1.1;

1.1
date	98.11.10.02.05.13;	author steve;	state Exp;
branches;
next	;


desc
@@


1.8
log
@Update to the Mar 14, 2003 version:
	the internationalization changes, somewhat modified, are now
	reinstated.  in theory awk will now do character comparisons
	and case conversions in national language, but "." will always
	be the decimal point separator on input and output regardless
	of national language.  isblank(){} has an #ifndef.

	fixed subtle behavior in field and record splitting: if FS is
	a single character and RS is not empty, \n is NOT a separator.
	this tortuous reading is found in the awk book; behavior now
	matches gawk and mawk.
@
text
@--- b.c.orig	Sun Sep 24 17:18:38 2000
+++ b.c	Fri Nov  3 01:59:32 2000
@@@@ -27,6 +27,9 @@@@
 #define	DEBUG
 
 #include <ctype.h>
+#ifdef	__FreeBSD__
+#include <limits.h>
+#endif
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@


1.7
log
@Update to the Dec 13, 2002 version:
	for the moment, the internationalization changes of nov 29 are
	rolled back -- programs like x = 1.2 don't work in some locales,
	because the parser is expecting x = 1,2.  until i understand this
	better, this will have to wait.

Approved by:	knu(portmgr)
@
text
@@


1.6
log
@Update to the 29-Nov-2002 distribution.
Since the distfile isn't versioned, this was the only way to fix the
"make distclean all" problem on 5-CURRENT.

Approved by:	kris
@
text
@d1 2
a2 2
--- b.c.orig	Fri Nov 29 06:56:01 2002
+++ b.c	Wed Dec 11 20:43:35 2002
a12 16
@@@@ -714,6 +717,7 @@@@
  * must be less than twice the size of their full name.
  */
 
+#ifndef __FreeBSD__
 /* and because isblank doesn't show up in any of the header files on any
  * system i use, it's defined here.  if some other locale has a richer
  * definition of "blank", sorry about that.
@@@@ -723,6 +727,7 @@@@
 {
 	return c==' ' || c=='\t';
 }
+#endif
 
 struct charclass {
 	const char *cc_name;
@


1.5
log
@Make lang/nawk building on -current again.
I didn't really take the patches from the PR, since 95% of them
where tab to space conversions. Also tweaked the makefile to use
${CC} instead of cc. The distinfo change is because of the rollout
of a new version, of which the Makefile was already changed but the
distinfo not.

PR:		ports/44281
Submitted by:	Steven G. Kargl <kargl@@troutmask.apl.washington.edu>
@
text
@d1 2
a2 2
--- b.c.orig	Sun Sep 24 17:18:38 2000
+++ b.c	Fri Nov  3 01:59:32 2000
d13 3
a15 3
@@@@ -75,6 +78,24 @@@@
 fa	*fatab[NFA];
 int	nfatab	= 0;	/* entries in fatab */
d17 5
a21 19
+#ifdef	__FreeBSD__
+static int
+collate_range_cmp(a, b)
+int a, b;
+{
+	int r;
+	static char s[2][2];
+
+	if ((unsigned char)a == (unsigned char)b)
+		return 0;
+	s[0][0] = a;
+	s[1][0] = b;
+	if ((r = strcoll(s[0], s[1])) == 0)
+		r = (unsigned char)a - (unsigned char)b;
+	return r;
+}
+#endif
+
 fa *makedfa(const char *s, int anchor)	/* returns dfa for reg expr s */
d23 2
a24 7
 	int i, use, nuse;
@@@@ -287,6 +308,9 @@@@
 	int i, c, c2;
 	uschar *p = (uschar *) argp;
 	uschar *op, *bp;
+#ifdef	__FreeBSD__
+ 	int c3;
a25 2
 	static uschar *buf = 0;
 	static int bufsz = 100;
d27 2
a28 31
@@@@ -303,6 +327,22 @@@@
 				c2 = *p++;
 				if (c2 == '\\')
 					c2 = quoted((char **) &p);
+#ifdef	__FreeBSD__
+ 				if (collate_range_cmp(c, c2) > 0) {
+ 					bp--;
+ 					i--;
+ 					continue;
+ 				}
+ 				for (c3 = 0; c3 < (1 << CHAR_BIT) - 1; c3++) {
+ 					if (collate_range_cmp(c, c3) <= 0 &&
+ 					    collate_range_cmp(c3, c2) <= 0) {
+ 						if (!adjbuf(&buf, &bufsz, bp-buf+2, 100, &bp, 0))
+ 							FATAL("out of space for character class [%.10s...] 2", p);
+ 						*bp++ = c3 + 1;
+ 						i++;
+ 					}
+ 				}
+#else /*FreeBSD*/
 				if (c > c2) {	/* empty; ignore */
 					bp--;
 					i--;
@@@@ -314,6 +354,7 @@@@
 					*bp++ = ++c;
 					i++;
 				}
+#endif /*FreeBSD*/
 				continue;
 			}
 		}
@


1.4
log
@Update to the 30-Oct-2000 version.
@
text
@d35 1
a35 1
 fa *makedfa(char *s, int anchor)	/* returns dfa for reg expr s */
@


1.3
log
@Update to the Jun 20, 1999 fixes.
@
text
@d1 2
a2 2
--- b.c.orig	Mon May 10 07:26:44 1999
+++ b.c	Mon Nov 29 02:10:52 1999
d38 1
a38 3
@@@@ -285,6 +306,9 @@@@
 char *cclenter(char *p)	/* add a character class */
 {
d40 2
d43 1
a43 1
+	int c3;
d45 1
a45 2
 	char *op, *bp;
 	static char *buf = 0;
d47 2
a48 1
@@@@ -302,6 +326,23 @@@@
d51 1
a51 1
 					c2 = quoted(&p);
d53 15
a67 16
+				if (collate_range_cmp(c, c2) > 0) {
+					bp--;
+					i--;
+					continue;
+				}
+				for (c3 = 0; c3 < (1 << CHAR_BIT) - 1; c3++) {
+					if (collate_range_cmp(c, c3) <= 0 &&
+					    collate_range_cmp(c3, c2) <= 0) {
+						if (!adjbuf(&buf, &bufsz, bp-buf+2, 100, &bp, 0))
+							FATAL("out of space for character class [%.10s...] 2", p);
+						*bp++ = c3 + 1;
+						i++;
+					}
+				}
+#else
+ 				if (c > c2) {	/* empty; ignore */					
d71 1
a71 1
@@@@ -313,6 +354,7 @@@@
d75 1
a75 1
+#endif
@


1.2
log
@Fix an FPE error.

PR:		9492
Submitted by:	Pedro F. Giffuni <giffunip@@asme.org>
@
text
@d1 79
a79 123
*** b.c.orig	Mon Oct 19 18:42:53 1998
--- b.c	Wed Jan 13 17:46:54 1999
***************
*** 27,32 ****
--- 27,35 ----
  #define	DEBUG
  
  #include <ctype.h>
+ #ifdef	__FreeBSD__
+ #include <limits.h>
+ #endif
  #include <stdio.h>
  #include <string.h>
  #include <stdlib.h>
***************
*** 74,79 ****
--- 77,100 ----
  fa	*fatab[NFA];
  int	nfatab	= 0;	/* entries in fatab */
  
+ #ifdef	__FreeBSD__
+ static int
+ collate_range_cmp(a, b)
+ int a, b;
+ {
+ 	int r;
+ 	static char s[2][2];
+ 
+ 	if ((unsigned char)a == (unsigned char)b)
+ 		return 0;
+ 	s[0][0] = a;
+ 	s[1][0] = b;
+ 	if ((r = strcoll(s[0], s[1])) == 0)
+ 		r = (unsigned char)a - (unsigned char)b;
+ 	return r;
+ }
+ #endif
+ 
  fa *makedfa(char *s, int anchor)	/* returns dfa for reg expr s */
  {
  	int i, use, nuse;
***************
*** 284,289 ****
--- 305,313 ----
  char *cclenter(char *p)	/* add a character class */
  {
  	int i, c, c2;
+ #ifdef	__FreeBSD__
+ 	int c3;
+ #endif
  	char *op, *bp;
  	static char *buf = 0;
  	static int bufsz = 100;
***************
*** 301,306 ****
--- 325,347 ----
  				c2 = *p++;
  				if (c2 == '\\')
  					c2 = quoted(&p);
+ #ifdef	__FreeBSD__
+ 				if (collate_range_cmp(c, c2) > 0) {
+ 					bp--;
+ 					i--;
+ 					continue;
+ 				}
+ 				for (c3 = 0; c3 < (1 << CHAR_BIT) - 1; c3++) {
+ 					if (collate_range_cmp(c, c3) <= 0 &&
+ 					    collate_range_cmp(c3, c2) <= 0) {
+ 						if (!adjbuf(&buf, &bufsz, bp-buf+2, 100, &bp, 0))
+ 							ERROR "out of space for character class [%.10s...] 2", p FATAL;
+ 						*bp++ = c3 + 1;
+ 						i++;
+ 					}
+ 				}
+ #else
+  				if (c > c2) {	/* empty; ignore */					
  				if (c > c2) {	/* empty; ignore */
  					bp--;
  					i--;
***************
*** 312,317 ****
--- 353,359 ----
  					*bp++ = ++c;
  					i++;
  				}
+ #endif
  				continue;
  			}
  		}
*** main.c.orig	Mon Oct 19 18:49:03 1998
--- main.c	Wed Jan 13 17:51:59 1999
***************
*** 27,32 ****
--- 27,33 ----
  #define DEBUG
  #include <stdio.h>
  #include <ctype.h>
+ #include <locale.h>
  #include <stdlib.h>
  #include <string.h>
  #include <signal.h>
***************
*** 55,61 ****
  	char *fs = NULL, *marg;
  	int temp;
  
! 	cmdname = argv[0];
  	if (argc == 1) {
  		fprintf(stderr, "Usage: %s [-f programfile | 'program'] [-Ffieldsep] [-v var=value] [files]\n", cmdname);
  		exit(1);
--- 56,67 ----
  	char *fs = NULL, *marg;
  	int temp;
  
! 	setlocale(LC_ALL, "");
! 
! 	if ((cmdname = strrchr(argv[0], '/')) != NULL)
! 		cmdname++;
! 	else
! 		cmdname = argv[0];
  	if (argc == 1) {
  		fprintf(stderr, "Usage: %s [-f programfile | 'program'] [-Ffieldsep] [-v var=value] [files]\n", cmdname);
  		exit(1);
@


1.1
log
@Update to version 98.10.20.

PR:		8530
Reviewed by:	maintainer
Submitted by:	Pedro F. Giffuni <pfgiffun@@bachue.usc.unal.edu.co>
@
text
@d1 2
a2 2
*** b.c.orig	Sun Nov  1 17:14:22 1998
--- b.c	Sun Nov  1 17:23:00 1998
d90 2
a91 2
*** main.c.orig	Sun Nov  1 17:24:32 1998
--- main.c	Sun Nov  1 17:28:40 1998
d93 2
a94 2
*** 27,38 ****
--- 27,43 ----
a101 10
  #include "awk.h"
  #include "ytab.h"
  
+ #ifdef __FreeBSD__
+ #	include <floatingpoint.h>
+ #endif
+ 
  extern	char	**environ;
  extern	int	nfields;
  
d103 1
a103 1
*** 55,66 ****
d111 1
a111 6
  	}
  	signal(SIGFPE, fpecatch);
  	yyin = NULL;
  	symtab = makesymtab(NSYMTAB);
  	while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') {
--- 60,80 ----
a123 9
  	}
  	signal(SIGFPE, fpecatch);
+ #ifdef	__FreeBSD__
+ 	fpsetround(FP_RN);
+ 	fpsetmask(0L);
+ #endif
  	yyin = NULL;
  	symtab = makesymtab(NSYMTAB);
  	while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') {
@

