From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 19 16:07:32 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0DF6116A4E5 for ; Sat, 19 Aug 2006 16:07:32 +0000 (UTC) (envelope-from mwm-keyword-freebsdhackers2.e313df@mired.org) Received: from mired.org (vpn.mired.org [66.92.153.74]) by mx1.FreeBSD.org (Postfix) with SMTP id 4EB5E43D55 for ; Sat, 19 Aug 2006 16:07:31 +0000 (GMT) (envelope-from mwm-keyword-freebsdhackers2.e313df@mired.org) Received: (qmail 38554 invoked by uid 1001); 19 Aug 2006 16:07:22 -0000 Received: by bhuda.mired.org (tmda-sendmail, from uid 1001); Sat, 19 Aug 2006 12:07:22 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17639.14138.471768.271459@bhuda.mired.org> Date: Sat, 19 Aug 2006 12:07:22 -0400 To: "mal content" In-Reply-To: <8e96a0b90608190527p3a2b9b90hf18b4a0f947cffec@mail.gmail.com> References: <8e96a0b90608190527p3a2b9b90hf18b4a0f947cffec@mail.gmail.com> X-Mailer: VM 7.17 under 21.4 (patch 19) "Constant Variable" XEmacs Lucid X-Primary-Address: mwm@mired.org X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`; h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ X-Delivery-Agent: TMDA/1.0.3 (Seattle Slew) From: Mike Meyer Cc: freebsd-hackers@freebsd.org Subject: Re: Path transformation X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Aug 2006 16:07:32 -0000 In <8e96a0b90608190527p3a2b9b90hf18b4a0f947cffec@mail.gmail.com>, mal content typed: > For example, this path corresponds to the current working directory: > > "dir1/dir2/dir3/../../../" > > So I'd like to be able to pass that to a function and get the optimised > result of: > > "." > > It's giving me a real headache trying to work out the algorithm > to do this. If you just want the algorithm, the python distribution has one in posixpath.py: the normpath function. Heed the warning about symbolic links. http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.