This little series adds a ldirname function to libiberty and makes the
COBOL front-end to use it so it doesn't have to include the host's
libgen.h.

The ldirname implementation doesn't exactly implement the same
semantics than the POSIX dirname.  In particular, it returns the empty
string rather than "." when given pathnames that do not contain a
directory separator.  Note that lbasename doesn't mimic the POSIX
basename interface neither, so I suppose this is ok.

I tested this using the Algol 68 front-end, which is off-tree.

I tested the COBOL change by running `make check-cobol', but I am not
sure whether the small testsuite now in master covers this particular
code change.

Jose E. Marchesi (2):
  libiberty: add ldirname function
  cobol: use ldirname in cdf-copy.cc

 gcc/cobol/cdf-copy.cc   | 24 +++++++----
 include/libiberty.h     | 12 ++++++
 libiberty/Makefile.in   | 14 +++++-
 libiberty/configure.com |  2 +-
 libiberty/ldirname.c    | 94 +++++++++++++++++++++++++++++++++++++++++
 libiberty/makefile.vms  |  2 +-
 6 files changed, 137 insertions(+), 11 deletions(-)
 create mode 100644 libiberty/ldirname.c

-- 
2.30.2

Reply via email to