delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/20/08:28:20

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Ralf Habacker" <Ralf DOT Habacker AT freenet DOT de>
To: "cygwin" <cygwin AT cygwin DOT com>
Subject: [Patch] added sh-utils/dirname backslash support
Date: Wed, 20 Feb 2002 14:21:33 +0100
Message-ID: <006601c1ba11$842b38c0$062006d5@BRAMSCHE>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Importance: Normal

------=_NextPart_000_0067_01C1BA19.E5EFA0C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi all,

the current dirname tool does not support backslash support. This patch fixes this. 

Regards 

Ralf Habacker

------=_NextPart_000_0067_01C1BA19.E5EFA0C0
Content-Type: application/octet-stream;
	name="dirname.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="dirname.patch"

--- dirname.c.org	Wed Feb 20 11:46:14 2002=0A=
+++ dirname.c	Wed Feb 20 13:16:40 2002=0A=
@@ -65,6 +65,7 @@ main (int argc, char **argv)=0A=
 {=0A=
   register char *path;=0A=
   register char *slash;=0A=
+  char delim =3D '/'; =0A=
 =0A=
   program_name =3D argv[0];=0A=
   setlocale (LC_ALL, "");=0A=
@@ -91,13 +92,17 @@ main (int argc, char **argv)=0A=
   path =3D argv[1];=0A=
   strip_trailing_slashes (path);=0A=
 =0A=
-  slash =3D strrchr (path, '/');=0A=
+  slash =3D strrchr (path, delim);=0A=
+  if (slash =3D=3D NULL) =0A=
+    delim =3D '\\';=0A=
+    slash =3D strrchr (path, delim);=0A=
+=0A=
   if (slash =3D=3D NULL)=0A=
     path =3D (char *) ".";=0A=
   else=0A=
     {=0A=
       /* Remove any trailing slashes and final element. */=0A=
-      while (slash > path && *slash =3D=3D '/')=0A=
+      while (slash > path && *slash =3D=3D delim)=0A=
 	--slash;=0A=
       slash[1] =3D 0;=0A=
     }=0A=

------=_NextPart_000_0067_01C1BA19.E5EFA0C0
Content-Type: application/octet-stream;
	name="dirname.ChangeLog"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="dirname.ChangeLog"

2002-02-20  Ralf Habacker  <ralf DOT habacker AT freenet DOT de>

        * src/dirname.c (main): added cygwin backslash support.


------=_NextPart_000_0067_01C1BA19.E5EFA0C0
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------=_NextPart_000_0067_01C1BA19.E5EFA0C0--


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019