From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sam To: <9fans@cse.psu.edu> Subject: Re: [9fans] So, do you space or not? In-Reply-To: <3D271964.48FB0D81@gsyc.escet.urjc.es> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: Sat, 6 Jul 2002 12:47:35 -0400 Topicbox-Message-UUID: c352e90a-eaca-11e9-9e20-41e7f4b1d025 Long winded e-mail follows. I've only just jumped onto this thread and since I didn't want to repeat anything, I googled up the chain that started this (back on may 30th!). I may have missed part of it, so if I'm restating anything or being terribly obvious, forgive me. Here's my 2 cents: I've become familiar with quoted arguments as in my CLIs the following is typical (where val is some value containing spaces). cli> set param 'val' I have a little function that breaks up the line into an argc & argv, similarly as I presume a shell would. Fairly simple, though I don't consider escape sequences or single quotes inside of an arg. I've been debating for some time whether to modify the input read routine such that when read in, cli> set param0 'set param1 \'set param2 \'val\'\'' the args will look like this: arg[0] == "set" arg[1] == "param0" arg[2] == "set param1 'set param2 \'val\''" ... essentially taking the outermost enclosed, escaped single quotes and unescaping them. It would obviously be fairly easy to do, but I've yet to run into a use for it. Also an avenue is unescaping all the quotes, as usual. I presume that option (b) in the replied to e-mail considers "fixing" programs such that if you output shell commands that require args containing spaces, we enclose the arg in quotes. Easy enough with %q. Since ' is a printable character, though, we run into inclusion problems ... right? What happens when we want to name files by ownership (ie: "Bob's file")? Does %q escape all ' inside the string it's enclosing? (online man page for print is still from 3E; no 4E for me just yet) If we're going to try changing these programs for this purpose, why not introduce a new format that outputs the string with spaces escaped? The shell should handle this just fine, right? ie (eg, z): print("%z", "This is a file name"); results in: This\ is\ a\ file\ name There would be caveats with this as well (suppose we want to print "this\ is\ a\ file\ name"), but is no more complex than the proposed ' solution. It just doesn't seem like we've arrived at a decent solution yet. Until we find one, I'm going to have to vote a (or perhaps d, if no one has tomatoes handy). Am I way off? Cheers, Sam On Sat, 6 Jul 2002, FJ Ballesteros wrote: > > Just to know it, do you want to > > a) keep things as they are > b) remove quoting from ls et al, add it to those that print commands, > and > fix those that don't cosider ' ' in file names. > c) forbid space and rename blanks in servers > d) Write poems > e) None of the above > > Should you choose b or c, I may help. > > PS: Bad answers may discount points from your average. >