Fixed directory printing in case there was both a ~user and a ~user1.
authorChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Thu, 13 Feb 1992 12:07:11 +0000 (04:07 -0800)
committerChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Thu, 13 Feb 1992 12:07:11 +0000 (04:07 -0800)
SCCS-vsn: bin/csh/dir.c 5.18

usr/src/bin/csh/dir.c

index 31fdf2f..ceefc1b 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)dir.c      5.17 (Berkeley) %G%";
+static char sccsid[] = "@(#)dir.c      5.18 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -191,9 +191,11 @@ printdirs()
            (void) fprintf(cshout, "%d\t", idx++);
            cur = 0;
        }
            (void) fprintf(cshout, "%d\t", idx++);
            cur = 0;
        }
+       len = Strlen(hp);
        if (!(dirflag & DIR_LONG) && hp != NULL && !eq(hp, STRslash) &&
        if (!(dirflag & DIR_LONG) && hp != NULL && !eq(hp, STRslash) &&
-           prefix(hp, dp->di_name))
-           len = Strlen(s = (dp->di_name + Strlen(hp))) + 2;
+           Strncmp(hp, dp->di_name, len) == 0 &&
+           (dp->di_name[len] == '\0' || dp->di_name[len] == '/')) 
+           len = Strlen(s = (dp->di_name + len)) + 2;
        else
            len = Strlen(s = dp->di_name) + 1;
 
        else
            len = Strlen(s = dp->di_name) + 1;