Fred JamesFri May 6 12:10:36 PDT 2005
Jason Van Cleve
Documentation is good, but it takes someone to write it - they always
seem to be looking for volunteers in that department, it seems.
In the meantime, with all puristic thoughts aside, there are in this
world at least two ways to terminate a line - now you know. Move
forward in peace.
At one time I found/wrote/copied/stole/ the code below, which I have
found useful from time to time - perhaps it will help you as well.
Regards
Fred James
/* ==========
| utod.c
*/
#include <stdio.h>
int main() {
int c;
while ((c = getchar()) != EOF) {
if (c == '\n') {
putchar('\r');
}
putchar(c);
}
return (0);
}
/* ==========
| dtou.c
*/
#include <stdio.h>
int main() {
int c;
while ((c = getchar()) != EOF) {
if (c != '\r') {
putchar(c);
}
}
return (0);
}
Jason Van Cleve wrote:
>Quoth larry price, on Fri, 6 May 2005 01:04:28 -0700:
>
>
>
>>>I also ack that M$ newlines are borked, but I find them inescapable.
>>>
>>>
>>really, I find them quite easy to escape, vide.
>>
>>
>
>s/inescapable/unavoidable
>
>Incidentally, I don't really mind the fact that sed won't acknowledge
>other, less perfect end-of-line conventions, assuming there is genuine
>value in so much pedantry. I just think it would help to document that
>behavior explicitly, for I cannot be the first person to have bumped
>into this problem. You apologists may say I had only to put two and two
>together: to assume a particular treatment based on the unix
>convention. But let's remember why we document things at all, to make
>them easier to learn and understand.
>
>I sense much hostility toward DOS newlines, a foolish relic from the
>days of dot-matrix printers, as I understand. However, there's little
>point in pretending they don't exist, or that a developer using linux
>will never encounter them. And pardon me, but I can't help thinking a
>command-line switch in sed enabling "$" to work with different newline
>formats would make the tool more useful. Purism can be impractical. It
>would never have produced Open Office.
>
>--Jason V. C.
>
>--
>Quantum mechanics: the dreams stuff is made of.
>_______________________________________________
>EUGLUG mailing list
>euglug at euglug.org
>http://www.euglug.org/mailman/listinfo/euglug
>
>
>
>
--
Compassion alone stands apart from the continuous traffic between good and evil proceeding within us. "Om Mani Padme Hum"