#include <tic.h>
+MODULE_ID("$Id: write_entry.c,v 1.127 2023/05/27 20:13:10 tom Exp $")
+
#if 1
#define TRACE_OUT(p) DEBUG(2, p)
#define TRACE_NUM(n) if (VALID_NUMERIC(Numbers[n])) { \
#define TRACE_NUM(n) /* nothing */
#endif
-MODULE_ID("$Id: write_entry.c,v 1.121 2023/03/05 18:45:59 tom Exp $")
+/*
+ * FIXME: special case to work around Cygwin bug in link(), which updates
+ * the target file's timestamp.
+ */
+#if HAVE_LINK && !USE_SYMLINKS && !MIXEDCASE_FILENAMES && defined(__CYGWIN__)
+#define LINK_TOUCHES 1
+#else
+#define LINK_TOUCHES 0
+#endif
static int total_written;
static int total_parts;
if (fp == 0) {
perror(filename);
- _nc_syserr_abort("can't open %s/%s", _nc_tic_dir(0), filename);
+ _nc_syserr_abort("cannot open %s/%s", _nc_tic_dir(0), filename);
}
actual = fwrite(buffer, sizeof(char), (size_t) offset, fp);
char dir[sizeof(LEAF_FMT)];
char *s = 0;
- if (code == 0 || (s = (strchr) (dirnames, code)) == 0)
+ if (code == 0 || (s = (strchr) (dirnames, code)) == 0) {
_nc_err_abort("Illegal terminfo subdirectory \"" LEAF_FMT "\"", code);
-
- if (verified[s - dirnames])
- return;
-
- _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code);
- if (make_db_root(dir) < 0) {
- _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir);
+ } else if (!verified[s - dirnames]) {
+ _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code);
+ if (make_db_root(dir) < 0) {
+ _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir);
+ } else {
+ verified[s - dirnames] = TRUE;
+ }
}
-
- verified[s - dirnames] = TRUE;
}
#endif /* !USE_HASHED_DB */
const char *destination;
char actual[PATH_MAX];
- if (dir == 0
-#ifndef USE_ROOT_ENVIRON
- && use_terminfo_vars()
-#endif
- )
+ if (dir == 0 && use_terminfo_vars())
dir = getenv("TERMINFO");
if (dir != 0)
if (ptr != name_list) {
*ptr = '\0';
- for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++)
- continue;
+ for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++) {
+ /* EMPTY */ ;
+ }
if (*ptr == '\0')
other_names = ptr;
if (strcmp(filename, linkname) == 0) {
_nc_warning("self-synonym ignored");
- } else if (stat(linkname, &statbuf) >= 0 &&
- statbuf.st_mtime > start_time) {
+ }
+#if !LINK_TOUCHES
+ else if (stat(linkname, &statbuf) >= 0 &&
+ statbuf.st_mtime < start_time) {
_nc_warning("alias %s multiply defined.", ptr);
- } else if (_nc_access(linkname, W_OK) == 0)
+ }
+#endif
+ else if (_nc_access(linkname, W_OK) == 0)
#if HAVE_LINK
{
int code;
write_file(linkname, tp);
else {
#if MIXEDCASE_FILENAMES
- _nc_syserr_abort("can't link %s to %s", filename, linkname);
+ _nc_syserr_abort("cannot link %s to %s", filename, linkname);
#else
- _nc_warning("can't link %s to %s (errno=%d)", filename,
+ _nc_warning("cannot link %s to %s (errno=%d)", filename,
linkname, errno);
#endif
}
unsigned last_str = STRWRITE;
#if NCURSES_EXT_NUMBERS
bool need_ints = FALSE;
- size_t (*convert_numbers) (unsigned char *, NCURSES_INT2 *, size_t) = convert_32bit;
+ size_t (*convert_numbers) (unsigned char *, NCURSES_INT2 *, size_t);
#else
#define convert_numbers convert_shorts
#endif