Modernize use of Gnulib, paxutils

* configure.ac: Omit stuff no longer needed now that Gnulib or
paxlib does it, or the code no longer needs the configure-time checks.
Do not use AC_SYS_LARGEFILE (Gnulib largefile does this) or check
for fcntl.h, memory.h, net/errno.h, sgtty.h, string.h,
sys/param.h, sys/device.h, sys/gentape.h, sys/inet.h,
sys/io/trioctl.h, sys/time.h, sys/tprintf.h, sys/tape.h, unistd.h,
locale.h, netdb.h; these are all now standard, or old ways of getting
at magtapes are no longer needed and we now have only sys/mtio.h.
Do not check for lstat, readlink, symlink, and check only for
waitpid’s existence rather than attempting to replace it.
Do not check for decls of getgrgid, getpwuid, or time.
Check just once for iconv.h.
* gnulib.modules: Add largefile.
* lib/.gitignore, lib/Makefile.am (noinst_HEADERS, libtar_a_SOURCES):
Remove system-ioctl.h, which is no longer in paxlib.
All includes now changed to just check HAVE_SYS_MTIO_H directly.
* lib/wordsplit.c (wordsplit_c_escape_tab, wordsplit_errstr)
(wordsplit_nerrs):
Now static or an enum, and without any leading "_" in the name.
* src/buffer.c (record_start, record_end, current_block, records_read):
* src/delete.c (records_skipped): Add extern decl to pacify GCC.
* src/compare.c, src/create.c, src/extract.c: Omit uses of
HAVE_READLINK and HAVE_SYMLINK since we now let Gnulib deal with
platforms lacking readlinkat and symlinkat.
* src/system.c: Use "#if !HAVE_WAITPID" instead of "#if MSDOS".
This commit is contained in:
Paul Eggert
2024-07-26 21:55:31 -07:00
parent 4e0deb7416
commit 9f1c32c18b
11 changed files with 40 additions and 56 deletions

1
lib/.gitignore vendored
View File

@@ -6,5 +6,4 @@ paxnames.c
rmt-command.h
rmt.h
rtapelib.c
system-ioctl.h
system.h

View File

@@ -33,7 +33,6 @@ noinst_HEADERS = \
paxlib.h\
rmt.h\
system.h\
system-ioctl.h\
wordsplit.h\
xattr-at.h
@@ -41,7 +40,7 @@ libtar_a_SOURCES = \
paxerror.c paxexit-status.c paxlib.h paxnames.c \
rtapelib.c \
rmt.h \
system.h system-ioctl.h \
system.h \
wordsplit.c\
xattr-at.c

View File

@@ -193,7 +193,7 @@ wordsplit_init0 (struct wordsplit *wsp)
wsp->ws_errno = 0;
}
char wordsplit_c_escape_tab[] = "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v";
static char wordsplit_c_escape_tab[] = "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v";
static int
wordsplit_init (struct wordsplit *wsp, const char *input, size_t len,
@@ -2513,7 +2513,7 @@ wordsplit_get_words (struct wordsplit *ws, size_t *wordc, char ***wordv)
return 0;
}
const char *_wordsplit_errstr[] = {
static char const *const wordsplit_errstr[] = {
N_("no error"),
N_("missing closing quote"),
N_("memory exhausted"),
@@ -2524,16 +2524,15 @@ const char *_wordsplit_errstr[] = {
N_("unbalanced parenthesis"),
N_("globbing error")
};
int _wordsplit_nerrs =
sizeof (_wordsplit_errstr) / sizeof (_wordsplit_errstr[0]);
enum { wordsplit_nerrs = sizeof wordsplit_errstr / sizeof *wordsplit_errstr };
const char *
wordsplit_strerror (struct wordsplit *ws)
{
if (ws->ws_errno == WRDSE_USERERR)
return ws->ws_usererr;
if (ws->ws_errno < _wordsplit_nerrs)
return _wordsplit_errstr[ws->ws_errno];
if (ws->ws_errno < wordsplit_nerrs)
return wordsplit_errstr[ws->ws_errno];
return N_("unknown error");
}