Thread View: gnu.utils.bug
2 messages
2 total messages
Started by Tapani Tarvainen
Fri, 13 Oct 1989 10:45
yasf (Yet Another Sed Fix)
Author: Tapani Tarvainen
Date: Fri, 13 Oct 1989 10:45
Date: Fri, 13 Oct 1989 10:45
76 lines
2998 bytes
2998 bytes
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)
Re: yasf (Yet Another Sed Fix)
Author: Tapani Tarvainen
Date: Fri, 13 Oct 1989 18:50
Date: Fri, 13 Oct 1989 18:50
9 lines
803 bytes
803 bytes
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)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads