From: David King Landrith Date: 2003-03-31T06:39:01+09:00 Subject: Hard coded newline characters There are a surprising number of ruby source files that have newline (\n) characters hardcoded as the line terminator--it appears that way more than half of the files do. Shouldn't these be set to a macro that outputs $\ (or perhaps $,) character. It seems to me that the most of the places where ruby programs write directly to stdout are not places where speed is of the essense (e.g., printing stack traces.) Given that this is the case, it appears that setting $\ to '\r\n' doesn't changed the output of routines that utilize a c puts, fputs, printf, or printf variant to write text to stdout. Specifically, I'd like to control the printout of exception backtraces by changing $\. I'd like to do this because I am using ncurses, and the backtraces of exceptions do not print correctly in ncurses windows (or pads); '\r\s' is needed to do this in ncurses, since '\n' simply causes the lines to step down across the screen as follows /libtest.rb:100:in `puts': Interrupt from test.rb:11 from test.rb:10:in `times' As a work around, I've dabbled a bit with doing traps in order to issue an endwin before the exception gets printed, but I have not found good documentation on how to do to traps, and it appears impossible to raise or throw an exception within a trap proc block. Any quick workaround that anyone could provide would be appreciated. ------------------------------------------------------- David King Landrith (w) 617.227.4469x213 (h) 617.696.7133 One useless man is a disgrace, two are called a law firm, and three or more become a congress -- John Adams ------------------------------------------------------- public key available upon request