-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
After my recent patch submission to coreutils, GNU dirname/basename will
now return // on platforms (for now, cygwin) that have // distinct from /.
So the documentation needs an update; in the process, I noticed that
AS_DIRNAME is documented but not AS_BASENAME.
Also, do we want to remove this line about m4sh, that was picked up in the
context of my first hunk? "For the time being, it is not mature enough to
be widely used."
2006-03-22 Eric Blake <[EMAIL PROTECTED]>
* doc/autoconf.texi (Limitations of Usual Tools): Document
basename. Mention cygwin's treatment of //.
(Programming in M4sh): Document AS_BASENAME.
- --
Life is short - so eat dessert first!
Eric Blake [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEIVKI84KuGfSFAYARAhu9AKCa6ma61ZCxkYAgusC9cuYSxK3DOQCgooNK
bRZ0YP0CKYlcsX1SqQT4zjg=
=W9WU
-----END PGP SIGNATURE-----
Index: doc/autoconf.texi
===================================================================
RCS file: /sources/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.971
diff -u -p -U5 -r1.971 autoconf.texi
--- doc/autoconf.texi 21 Mar 2006 21:51:07 -0000 1.971
+++ doc/autoconf.texi 22 Mar 2006 13:32:02 -0000
@@ -9377,10 +9377,18 @@ A mess; trouble. [Obs.] --Beau.@: & Fl.
For the time being, it is not mature enough to be widely used.
M4sh provides portable alternatives for some common shell constructs
that unfortunately are not portable in practice.
[EMAIL PROTECTED] AS_BASENAME (@var{file-name})
[EMAIL PROTECTED]
+Return the filename portion of @var{file-name}, using the algorithm
+required by Posix. @xref{Limitations of Usual Tools}, for more
+details about what this returns and why it is more portable than the
[EMAIL PROTECTED] command.
[EMAIL PROTECTED] defmac
+
@defmac AS_BOURNE_COMPATIBLE
@asindex{BOURNE_COMPATIBLE}
Set up the shell to be more compatible with the Bourne shell as
standardized by Posix, if possible. This may involve setting
environment variables, or setting options, or similar
@@ -12156,10 +12164,35 @@ Traditional Awk @code{split} supports on
Traditional Awk has a limit of 99
fields in a record. You may be able to circumvent this problem by using
@code{split}.
[EMAIL PROTECTED] @command{basename}
[EMAIL PROTECTED] --------------------
[EMAIL PROTECTED] @command{basename}
+Not all hosts have a working @command{basename}, and you should instead
+use @code{AS_BASENAME} (@pxref{Programming in M4sh}). For example:
+
[EMAIL PROTECTED]
+file=`basename "$file"` # This is not portable.
+file=`AS_BASENAME(["$file"])` # This is more portable.
[EMAIL PROTECTED] example
+
+Unfortunately, neither of the above commands work if @code{$file} ends
+in newline, since @[EMAIL PROTECTED] removes all trailing newlines.
+
[EMAIL PROTECTED]
+This handles a few subtleties in the standard way required by
+Posix. For example, Posix permits implementations to treat leading
[EMAIL PROTECTED]//} with special semantics, but requires leading @samp{///} and
+beyond to be equivalent to @samp{/}. While most flavors of Unix treat
[EMAIL PROTECTED]//} identically to @samp{/}, there are some which treat it as a
+``super-root'' where it can provide access to other machines' files.
+This tradition started with Apollo Domain/OS, and continues today with
+Cygwin.
+
+
@item @command{cat}
@c ----------------
@prindex @command{cat}
Don't rely on any option.
@@ -12329,27 +12362,11 @@ dir=`AS_DIRNAME(["$file"])` # This is mo
Unfortunately, neither of the above commands work if @code{$file}'s
directory name ends in newline, since @[EMAIL PROTECTED] removes all
trailing newlines.
@noindent
-This handles a few subtleties in the standard way required by
-Posix. For example, under UN*X, should @samp{dirname //1} give
[EMAIL PROTECTED]/}? Paul Eggert answers:
-
[EMAIL PROTECTED]
-No, under some older flavors of Unix, leading @samp{//} is a special
-file name: it refers to a ``super-root'' and is used to access other
-machines' files. Leading @samp{///}, @samp{////}, etc.@: are equivalent
-to @samp{/}; but leading @samp{//} is special. This tradition
-started with Apollo Domain/OS, though it has largely died out in practice.
-
-Posix allows but does not require the special treatment for
[EMAIL PROTECTED]//}. It says that the behavior of @command{dirname} on file
names of the
-form @samp{//([^/]+/*)?} is implementation defined. In these cases,
[EMAIL PROTECTED] @command{dirname} returns @samp{/}, but those no-longer-used
-flavors of Unix returned @samp{//}.
[EMAIL PROTECTED] quotation
+Similar to AS_BASENAME, AS_DIRNAME correctly handles leading @samp{//}.
@item @command{egrep}
@c ------------------
@prindex @command{egrep}