9fans archive / 1995 / 11 / 71 / prev next
From: presotto@pla... presotto@pla...
Subject: ftpfs change to compensate for some servers
Date: Fri, 10 Nov 1995 03:58:16 -0500
some FTP servers include . and .. in the list, which messes up
common commands applied to a mounted ftpfs directory.
the following change prevents them from being seen:
vortex% diff $home/cd/cmd/ftpfs /sys/src/cmd/ftpfs/proto.c
38a39
> static int isdotdot(char*);
670a672,673
> if(isdotdot(field[7]))
> return 0;
681a685,686
> if(isdotdot(field[8]))
> return 0;
692a698,699
> if(isdotdot(field[9]))
> return 0;
703a711,712
> if(isdotdot(field[0]))
> return 0;
721a731,736
> }
>
> static int
> isdotdot(char *n)
> {
> return n[0]=='.' && (n[1]=='\0' || n[1]=='.' && n[2]=='\0');
I think this is easier and more correct since it covers all systems, not
just Unix-like:
at the end of the switch statement of crackdir(), before
line 714, add
if(strcmp(longname, ".") == 0 || strcmp(longname, "..") == 0)
return 0;
or, if the strcmp's bug you, use forsyth's isdotdot().