[gnu.utils.bug] yasf

tarvaine@tukki.jyu.fi (Tapani Tarvainen) (10/13/89)

I just discovered that Gnu sed recognizes only '/' as context address
delimiter, i.e., it doesn't accept the "\xstringx" syntax (which is
useful if you have lots of slashes in the string).  This was easy
enough to add (at least it seems to work).  I'll enclose diff from my
previous version (as a context diff it should be easy enough to apply
to 1.06 distribution, just remove the comment changes in the
beginning, or change the three lines by hand; if somebody wants diffs
from 1.06 or the entire sed.c - which isn't much longer than the diff
by now - just send me mail).

*** sed.old	Fri Oct 13 12:35:07 1989
--- sed.c	Fri Oct 13 12:35:12 1989
***************
*** 1,7 ****
  
  /*  GNU SED, a batch stream editor.
      Copyright (C) 1989, Free Software Foundation, Inc.
! 	Last changed by Tapani Tarvainen 29 September 1989
  
      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
--- 1,7 ----
  
  /*  GNU SED, a batch stream editor.
      Copyright (C) 1989, Free Software Foundation, Inc.
! 	Last changed by Tapani Tarvainen 13 October 1989
  
      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
***************
*** 59,64 ****
--- 59,66 ----
  	  (introduced ck_strdup)
  	- added ANSI-style prorotypes for everything (so this compiles
  	  OK even when sizeof(int) != sizeof(pointer) ...)
+ 	- added \x delimiter syntax for context addresses
+ 	  (e.g., '\-string-p' works like '/string/p')
  */
  
  
***************
*** 867,872 ****
--- 869,875 ----
  	int	num;
  	char	*b;
  	VOID	*init_buffer();
+ 	char	slash = '/';
  
  	ch=inchar();
  
***************
*** 880,889 ****
  		addr->addr_type=ADDR_NUM;
  		addr->addr_number = num;
  		return 1;
! 	} else if(ch=='/') {
  		addr->addr_type=ADDR_REGEX;
  		b=init_buffer();
! 		while((ch=inchar())!=EOF && ch!='/'') {
  			add1_buffer(b,ch);
  			if(ch=='\\') {
  				ch=inchar();
--- 883,892 ----
  		addr->addr_type=ADDR_NUM;
  		addr->addr_number = num;
  		return 1;
! 	} else if(ch=='/' || ch=='\\' && (slash = inchar()) != EOF) {
  		addr->addr_type=ADDR_REGEX;
  		b=init_buffer();
! 		while((ch=inchar())!=EOF && ch!=slash) {
  			add1_buffer(b,ch);
  			if(ch=='\\') {
  				ch=inchar();

-- 
Tapani Tarvainen    (tarvaine@tukki.jyu.fi, tarvainen@finjyu.bitnet)

tarvaine@tukki.jyu.fi (Tapani Tarvainen) (10/14/89)

In article <1501@tukki.jyu.fi> tarvaine@tukki.jyu.fi I wrote:

>+ 	char	slash = '/';
...
>! 	} else if(ch=='/' || ch=='\\' && (slash = inchar()) != EOF) {

I can only plead temporary insanity.  Slash has to be int, of course.
-- 
Tapani Tarvainen    (tarvaine@tukki.jyu.fi, tarvainen@finjyu.bitnet)