From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 19 12:27:51 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 C6AE216A4DD for ; Sat, 19 Aug 2006 12:27:51 +0000 (UTC) (envelope-from artifact.one@googlemail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2E73F43D53 for ; Sat, 19 Aug 2006 12:27:50 +0000 (GMT) (envelope-from artifact.one@googlemail.com) Received: by nf-out-0910.google.com with SMTP id n15so1686748nfc for ; Sat, 19 Aug 2006 05:27:49 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=JQ/TEZ0bww/FYG4SiQ3C2oKjkx/F3yY+7yLxUyaQPgaSekNqk4ZqEB2V0w992sfFsMwuqnjGoNYWqftQBWqU1+st0ZpJSTFcTiP8xQWPJ2d10l1KLMxxF6DWv1pRCVYdlaLZvMLXkUGpeybgF/Nl+EtgaycBAbJponZVxAWv5cw= Received: by 10.49.41.18 with SMTP id t18mr5209888nfj; Sat, 19 Aug 2006 05:27:49 -0700 (PDT) Received: by 10.49.54.3 with HTTP; Sat, 19 Aug 2006 05:27:49 -0700 (PDT) Message-ID: <8e96a0b90608190527p3a2b9b90hf18b4a0f947cffec@mail.gmail.com> Date: Sat, 19 Aug 2006 13:27:49 +0100 From: "mal content" To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: 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 12:27:51 -0000 Hello. Is there any code in the tree that does general path transformation or 'optimisation'? 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: "." And so on for paths such as: "dir1/dir2/dir3/../../../../" (Which obviously becomes ".."). "dir1/dir2/dir3/../../../dir1" (Optimised to "dir1"). "dir1/dir2/dir3/../../../dir1/file.txt" ("dir1/file.txt") It's giving me a real headache trying to work out the algorithm to do this. thanks, MC