From fetchpop Wed Nov  4 14:34:57 1998
Received: from mail2.deltanet.com (mail2.deltanet.com [199.171.190.56])
	by pisoft.it (8.8.5/8.8.5) with ESMTP id IAA08337
	for <andreoli@pisoft.it>; Wed, 4 Nov 1998 08:21:14 +0100
Received: from jlpcnt (john.deltanet.com [208.229.108.100])
	by mail2.deltanet.com (8.9.0/8.9.0) with SMTP id XAA18939
	for <andreoli@pisoft.it>; Tue, 3 Nov 1998 23:21:04 -0800 (PST)
Reply-To: <john@deltanet.com>
From: "John Lombardo" <john@deltanet.com>
To: <andreoli@pisoft.it>
Subject: dirname
Date: Tue, 3 Nov 1998 23:22:25 -0800
Message-ID: <000a01be07c3$dedd3a10$0a00a8c0@jlpcnt.home>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
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 V4.72.3110.3
Importance: Normal
X-UIDL: 041673d041b3672cc7f39dcd0ce3db45
Status: RO
X-Status: A

Hello,

Thanks for the great muLinux product!  I'm using your 'gateway' script in my
ShareTheNet program.  I found a problem with 'dirname', and fixed it.  Here
is a closer approximation of "dirname":
------------------------- cut ---------------------
dirname|*/dirname)

    dirname=`echo  $1 | tr '/' ' '`
    if [ "$dirname" = "$1" ];then
        echo ".";
        exit
    fi

    case $1 in
    /*)     echo -n "/"
    ;;
    esac

    set -- `echo  $dirname`

    if [ $# = 1 ]; then
        echo
        exit
    fi

    while [ $# -gt 2 ]; do
        echo -n "$1/"
        shift
    done

    echo "$1"
    ;;
------------------------- cut ---------------------
And here is a quick script to test it.  Make sure you run this test script
in the same directory as the "dirname" symlink...
------------------------- cut ---------------------
#!/bin/sh
for x in / /x x /x/y/z p/d/q; do
        echo "----------------"
        echo "x=$x"
        basename $x
        ./basename $x
        dirname $x
        ./dirname $x
done
------------------------- cut ---------------------

Regards,
John Lombardo
john@deltanet.com


