basenc supports the --base58 option to encode and decode
the visually unambiguous Base58 encoding.
+ realpath supports the -E option as required by POSIX. The behavior is
+ the same as realpath with no options. The corresponding long option
+ is --canonicalize.
+
** Improvements
'factor' is now much faster at identifying large prime numbers,
@findex realpath
@command{realpath} expands all symbolic links and resolves references to
-@samp{/./}, @samp{/../} and extra @samp{/} characters. By default,
-all but the last component of the specified files must exist. Synopsis:
+@samp{/./}, @samp{/../} and extra @samp{/} characters. Synopsis:
@example
realpath [@var{option}]@dots{} @var{file}@dots{}
@table @samp
+@item -E
+@itemx --canonicalize
+@opindex -E
+@opindex --canonicalize
+
+Ensure all but the last component of the specified file name exist.
+Otherwise, @command{realpath} will output a diagnostic unless the
+@option{-q} option is specified, and exit with a nonzero exit code. A
+trailing slash is ignored. This option is the default behavior, but is
+included for POSIX compatibility.
+
@item -e
@itemx --canonicalize-existing
@opindex -e
static struct option const longopts[] =
{
+ {"canonicalize", no_argument, nullptr, 'E'},
{"canonicalize-existing", no_argument, nullptr, 'e'},
{"canonicalize-missing", no_argument, nullptr, 'm'},
{"relative-to", required_argument, nullptr, RELATIVE_TO_OPTION},
{
printf (_("Usage: %s [OPTION]... FILE...\n"), program_name);
fputs (_("\
-Print the resolved absolute file name;\n\
-all but the last component must exist\n\
-\n\
+Print the resolved absolute file name.\n\
"), stdout);
fputs (_("\
+ -E, --canonicalize all but the last component must exist (default)\
+\n\
-e, --canonicalize-existing all components of the path must exist\n\
-m, --canonicalize-missing no path components need exist or be a directory\
\n\
while (true)
{
- int c = getopt_long (argc, argv, "eLmPqsz", longopts, nullptr);
+ int c = getopt_long (argc, argv, "EeLmPqsz", longopts, nullptr);
if (c == -1)
break;
switch (c)
{
+ case 'E':
+ can_mode &= ~CAN_MODE_MASK;
+ can_mode |= CAN_ALL_BUT_LAST;
+ break;
case 'e':
can_mode &= ~CAN_MODE_MASK;
can_mode |= CAN_EXISTING;
returns_ 1 realpath -e --relative-to=dir1/f --relative-base=. . || fail=1
realpath -e --relative-to=dir1/ --relative-base=. . || fail=1
+# Check that using -E after -e uses -E as specified by POSIX.
+realpath -e -E --relative-to=dir1/f --relative-base=. . || fail=1
+
# Note NUL params are unconditionally rejected by canonicalize_filename_mode
returns_ 1 realpath -m '' || fail=1
returns_ 1 realpath --relative-base= --relative-to=. . || fail=1