Thread View: gnu.utils.bug
1 messages
1 total messages
Started by Andrew Herbert
Wed, 04 Nov 1992 11:58
sed 1.11 "-n" fix
Author: Andrew Herbert
Date: Wed, 04 Nov 1992 11:58
Date: Wed, 04 Nov 1992 11:58
109 lines
3413 bytes
3413 bytes
Hi guys,
sed has a bug that causes it to print out lines even when it has been told not
to (with the -n commandline option). For instance, the "n" command will cause
sed to print out a line. This stuffs up various scripts used by INN. Here
is the fix (also a 386BSD conditional which should probably be made more
general - how about just using memcpy in your code, plus a #define memcpy(a,b,c)
bcopy(b,a,c) for people that don't have memcpy?).
Thanks for your the sed - it works great now.
Andrew
*** sed.c.unhacked Sun Oct 18 18:45:56 1992
--- sed.c Wed Nov 4 00:48:45 1992
***************
*** 42,47 ****
--- 42,48 ----
#include <strings.h>
#endif
+ #ifndef __386BSD__
void bcopy (from, to, len)
char * from;
char * to;
***************
*** 58,63 ****
--- 59,65 ----
while (len--)
*to++ = *from++;
}
+ #endif
char *version_string = "GNU sed version 1.11";
***************
*** 1166,1172 ****
case 'c':
line.length=0;
! if(!(cur_cmd->aflags&A1_MATCHED_BIT))
ck_fwrite(cur_cmd->x.cmd_txt.text,1,cur_cmd->x.cmd_txt.text_len,stdout);
end_cycle++;
break;
--- 1168,1174 ----
case 'c':
line.length=0;
! if(!(cur_cmd->aflags&A1_MATCHED_BIT) && !no_default_output)
ck_fwrite(cur_cmd->x.cmd_txt.text,1,cur_cmd->x.cmd_txt.text_len,stdout);
end_cycle++;
break;
***************
*** 1210,1216 ****
break;
case 'i':
! ck_fwrite(cur_cmd->x.cmd_txt.text,1,cur_cmd->x.cmd_txt.text_len,stdout);
break;
case 'l':
--- 1212,1219 ----
break;
case 'i':
! if(!no_default_output)
! ck_fwrite(cur_cmd->x.cmd_txt.text,1,cur_cmd->x.cmd_txt.text_len,stdout);
break;
case 'l':
***************
*** 1283,1289 ****
case 'n':
if (feof(input_file)) goto quit;
! ck_fwrite(line.text,1,line.length,stdout);
read_pattern_space();
break;
--- 1286,1293 ----
case 'n':
if (feof(input_file)) goto quit;
! if(!no_default_output)
! ck_fwrite(line.text,1,line.length,stdout);
read_pattern_space();
break;
***************
*** 1409,1417 ****
tmp.text=t.text;
tmp.length=t.length;
tmp.alloc=t.alloc;
! if(cur_cmd->x.cmd_regex.flags&S_WRITE_BIT)
ck_fwrite(line.text,1,line.length,cur_cmd->x.cmd_regex.wio_file);
! if(cur_cmd->x.cmd_regex.flags&S_PRINT_BIT)
ck_fwrite(line.text,1,line.length,stdout);
break;
--- 1413,1421 ----
tmp.text=t.text;
tmp.length=t.length;
tmp.alloc=t.alloc;
! if(cur_cmd->x.cmd_regex.flags&S_WRITE_BIT && !no_default_output)
ck_fwrite(line.text,1,line.length,cur_cmd->x.cmd_regex.wio_file);
! if(cur_cmd->x.cmd_regex.flags&S_PRINT_BIT && !no_default_output)
ck_fwrite(line.text,1,line.length,stdout);
break;
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