🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Mike Sangrey Mon, 21 Dec 1992 04:59
sed (my suggested fix is broke)
#1144
Author: Mike Sangrey
Date: Mon, 21 Dec 1992 04:59
64 lines
2098 bytes
This message refers to the patch that dealt with what I think is a bug with
   sed -n s/foo/bar/p

Specifically, in sed.c the change was

	  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;

---- to ----

	  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;


A few days ago I made this suggestion.  However, my simple fix causes
something else to break.  

For example:

----------------------
#!/bin/sh

az=abcdefghijklmnopqrstuvwxyz
AZ=ABCDEFGHIJKLMNOPQRSTUVWXYZ

/bin/sed -e "
	y/$AZ/$az/
	h
	y/$az/$AZ/
	G
        s/\(.\).*\n./\1/
"
----------------------

echo fooHaaHAA | this-script         # gives Foohaahaa with*out* my patch

And that is as it should be, at least with my understanding.  With my
patch, it gives two lines:

Foohaahaa
Foohaahaa

Hope this helps. 
Hope that any previous help that I helped with didn't unhelp.

Thanks again.

mike@sojurn.lns.pa.us
-- 
  |  UUCP-stuff:  ...!pitt!devon!sojurn!mike | "Disk space ...               |
  |  Internet  :  mike@sojurn.lns.pa.us      |      the final frontier."     |
  |  Fast-stuff:  (717) 396-9897             |                               |
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