appears to work on sunos 4.1.4

btw, the length limit is 120 bytes, not 128.

Paul Eggert <[EMAIL PROTECTED]>:
> We could use AWK as a fallback if the standard tools fail.  However, I
> think we can do it with the standard tools.  The following works for
> me, using Solaris 8 /usr/ucb/expr (sorry, I no longer have a SunOS 4
> host to test with).
> 
>       # Prefer expr to sed, since it's usually faster and it handles
>       # newlines correctly.  However, SunOS 4 expr and Solaris
>       # /usr/ucb/expr have a silly length limit that causes expr to
>       # fail if the matched substring is longer than 128 bytes.
>       # So use sed if expr fails.
>       dirname=`expr "X$filename" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
>             "X$filename" : 'X\(//\)[^/]' \| \
>             "X$filename" : 'X\(//\)$' \| \
>             "X$filename" : 'X\(/\)' \| \
>             . : '\(.\)' \
>             2>/dev/null` ||
>       dirname=`
>         sed '
>           /^\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/p; q; }
>           /^\(\/\/\)[^/].*/{ s//\1/p; q; }
>           /^\(\/\/\)$/{ s//\1/p; q; }
>           /^\(\/\).*/{ s//\1/p; q; }
>           s/.*/./p; q
>         ' <<EOF
> $filename
> EOF
>       `
> 

Reply via email to