date > $HOME///////filename
No common sense reason for this has occurred to me.
(no mail through newsreader, her...@horus.cem.msu.edu)
It means that your programs can do things like:
printf(Enter directory name: ");
gets(file_name);
strcat(file_name, "/basename");
Whereas in DOS you wind up doing:
printf(Enter directory name: ");
gets(file_name);
if (file_name[strlen(file_name) - 1] == '\\')
strcat(file_name, "basename");
else
strcat(file_name, "\\basename");
Actually it's worse since both slash and backslash are acceptable so you
really have to test for both.
If directory separators didn't collapse then what would "$HOME/////filename"
mean?
--
D'Arcy J.M. Cain (darcy@druid) |
D'Arcy Cain Consulting | There's no government
Toronto, Ontario, Canada | like no government!
+1 416 424 2871 DoD#0082 |
>This created $HOME/filename !?
>date > $HOME///////filename
>No common sense reason for this has occurred to me.
Well, in the typical unix tradition, this has mutated into
date > $HOME/././././././filename
However, most of the kernel's that I have seen all strip multiple '/' within
the middle of a pathname.
Several versions of "unix" treat leading double shashes "//foo" as a special
case. Examples of these are Domain OS (Apollo) and older versions of UTek
(Tektronix, rip)
-Jeff
--
Jeff Beadles je...@onion.rain.com
I am rather curious as to what special case "//foo" would signal?
James Risner
Peter
This behavior is reasonable and desirable. On more than one
occasion, I've used a command such as
% mv f1 foo/bar/baz # baz is a directory, so file will be foo/bar/baz/f1
to move a file into a new directory without changing it's name.
Now, if I do this and misspell "baz", then instead of putting the
file in the directory foo/bar/baz, I end up with a file named
foo/bar/bax, or something like that. After doing this enough times,
I've gotten in the habbit of ALWAYS putting a slash at the end of
directory names in such cases.
% mv f1 foo/bar/baz/
Now if I misspell baz, the mv will fail, since the directory
foo/bar/bax doesn't exist. When I do spell baz correctly, mv almost
surely generates the target pathname internally as foo/bar/baz//f1,
so this trick of mine will only work if multiple slashes are treated
sensibly. This does NOT work under DOS...
% COPY F1.C SOURCE\
will barf. Stupid DOS.
Jim
--
Spoken: James W. Williams Internet: will...@nssdcs.gsfc.nasa.gov
USPS: NASA/Goddard SFC; Code 933; Greenbelt, MD 20771
Phone: +1 301 286-1131 Maryland Car Tags: DEV CAR
Motto: There is no 'd' in "kluge"! It rhymes with "huge", not "sludge"!
In Domain/OS and, I think, some other systems, "//foo/bar" was "file
named 'bar' in the root directory of the machine named 'foo'".
The double slash in UTek means a host on the same network with
you. So, it means that you can
cp *.c //r2d2/usr/local/src/foo.
to copy files from wherever you are to /usr/local/src/foo
on host, r2d2. You can also:
cd //r2d2/usr/users/foo
and
//c3p0/usr/local/bin/ispell foobar.
--
Dan Flak - Just another idiot, born in the USA and over 35.