Hi,

When using busybox' awk to bootstrap, libgo's syscalls are generated
incorrectly.

I'm attaching the split() used by busybox' awk including output before
and after the patch for reference.

Please install / ok to install?

Bernhard Reutner-Fischer (1):
  mksyscalls.awk: make split ERE more portable

 libgo/go/syscall/mksyscall.awk |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
1.7.10.4
#include <regex.h>
#include <string.h>
#include <stdio.h>
int main(void) {
	int l, n = 0;
	char *inp = "//sysnb	pipe(p *[2]_C_int) (err error)";
	char *out = __builtin_alloca(strlen(inp)*2+3);
	regex_t re;
	regmatch_t m[1];
	strcpy(out, inp);
#ifndef ERE
# define ERE "[	 (]*"
#endif
	if (regcomp(&re, ERE, REG_EXTENDED) != 0)
		__builtin_abort();
	do {
		l = strcspn(inp, "\n\0");
		if (regexec(&re, inp, 1, m, 0) == 0 && m[0].rm_so <= l) {
			l = m[0].rm_so;
			if (m[0].rm_eo == 0)
				m[0].rm_eo++, l++;
			n++;
		} else {
			m[0].rm_eo = l;
			if (inp[l])
				m[0].rm_eo++;
		}
		memcpy(out, inp, l);
		do {
			out[l] = '\0';
		} while (++l < m[0].rm_eo);
		printf("[%2d] '%s'\n", n, out);
		while (*(out++) != '\0')
			continue;
		inp += m[0].rm_eo;
	} while (*inp);
	regfree(&re);
	return 0;
}

#if 0
+ gcc '-DERE="[ 	(]*"' -o x regexec.c
+ ./x
[ 1] '/'
[ 2] '/'
[ 3] 's'
[ 4] 'y'
[ 5] 's'
[ 6] 'n'
[ 7] 'b'
[ 8] ''
[ 9] 'p'
[10] 'i'
[11] 'p'
[12] 'e'
[13] ''
[14] 'p'
[15] ''
[16] '*'
[17] '['
[18] '2'
[19] ']'
[20] '_'
[21] 'C'
[22] '_'
[23] 'i'
[24] 'n'
[25] 't'
[26] ')'
[27] ''
[28] 'e'
[29] 'r'
[30] 'r'
[31] ''
[32] 'e'
[33] 'r'
[34] 'r'
[35] 'o'
[36] 'r'
[37] ')'
+ gcc '-DERE="[ 	(]"' -o x regexec.c
+ ./x
[ 1] '//sysnb'
[ 2] 'pipe'
[ 3] 'p'
[ 4] '*[2]_C_int)'
[ 5] ''
[ 6] 'err'
[ 6] 'error)'
#endif

Reply via email to