Date: Wed, 26 Dec 2001 03:50:02 -0800 (PST) From: mikem <mike_makonnen@yahoo.com> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/33187: [PATCH] /bin/ls -dF adds trailing slash regardless of whether there is already one there Message-ID: <200112261150.fBQBo2X46712@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/33187; it has been noted by GNATS.
From: mikem <mike_makonnen@yahoo.com>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:
Subject: Re: bin/33187: [PATCH] /bin/ls -dF adds trailing slash regardless of
whether there is already one there
Date: Wed, 26 Dec 2001 04:00:44 -0800
ok, let's try this one more time...
--- /usr/src/bin/ls/ls.c Tue Nov 27 06:30:05 2001
+++ ls.c Wed Dec 26 03:35:50 2001
@@ -132,7 +132,7 @@
{
static char dot[] = ".", *dotav[] = { dot, NULL };
struct winsize win;
- int ch, fts_options, notused;
+ int ch, fts_options, notused, index, len;
char *p;
#ifdef COLORLS
@@ -382,6 +382,19 @@
printfcn = printlong;
else
printfcn = printcol;
+
+ /*
+ * Remove trailing '/' if -d and -F are specified
+ * so we don't get into the situation where:
+ * % ls -dF /usr/
+ * outputs: /usr//
+ */
+ if (f_listdir && f_type)
+ for(index=0; index < argc ; index++) {
+ len = strlen(argv[index]);
+ if (argv[index][len - 1] == '/')
+ argv[index][len - 1] = '\0';
+ }
if (argc)
traverse(argc, argv, fts_options);
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112261150.fBQBo2X46712>
