
Dear Alexander Holler,
In message 4FAE7232.1050407@ahsoftware.de you wrote:
I would like to put as little restrictions on the content of an environment variable as possible. I can see valid use for strings that contain a CR character.
I don't see any reasonable usage for carriage returns in imported environment variables, but I've seen many people from the windows camp
A CR causes the output to re-start from start of line. I can construct all kind of fancy disply by using "echo $var" - especially so if "var" can contain control characters including CR. It makes no sense striiping these out.
struggling in writing small text files to set some environment variables (which mostly end up in the kernel cmdline). Especially because those CR's often will lead to obscure errors because almost nothing (in u-boot or linux) is able to handle them.
This is a problem that is as old as DOS, and solutions for this have been known since. I already mentioned dos2unix.
Anyway I don't really care, I just found it very user friendly to strip the carriage returns, especially for those embedded newbies which are in need to use some unnamed windows IDE.
So I've decided (after having that patch lying around for about a year) to finally post it.
Thanks - but it adds restrictions to doing perfectly valid things. I see the disadvantages significantly bigger than what we can win - keep in mind, that dealing wqith DOS line endings is a topic that is decades old.
Best regards,
Wolfgang Denk