Leo Bicknell wrote:
| I ran into a pair of all too common annoyances this morning that
| got me thinking. Via the magic of cut and paste I ended up with
| the following two sorts of command lines:
|
| mutt mailto:[EMAIL PROTECTED]
| traceroute http://www.ufp.org/
|
| These of course come from the 'copy link location' available in
| most browsers. When pasted into most Unix commands (with the
| exception of fetch and lynx, of course) the result is something
| that just doesn't work. This got me thinking, should all commands
| know how to take an URL, and 'do the right thing'? Could this
| be made easy by providing a standard URL parsing library that
| all commands could use for parsing?
Why not do it the Unix way? Create a new application, e.g.,
url(1), to parse the URLs and use it like so:
mutt `url mailto:[EMAIL PROTECTED]`
--> mutt [EMAIL PROTECTED]
traceroute `url -h http://www.ufp.org/`
--> traceroute www.ufp.org
With no options, url would provide a "sane" default for the type
of URL, e.g., "[EMAIL PROTECTED]" for a mailto. Options then modify
that; e.g., -u could extract the user part from a mailto; -h
would give the host part of any URL; and so on.
An alternate approach might be to have url exec the command once
it had done its parsing:
url mailto:[EMAIL PROTECTED] mutt
url -h http://www.ufp.org/ traceroute
This way, we don't have to modify all those applications.
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message